KCMS Application Developer's Guide

KcsCreateProfile()


KcsStatusId
 KcsCreateProfile(KcsProfileId *resultProfileId,
 		KcsCreationDesc *desc)

Purpose

Use KcsCreateProfile() to create an empty profile. The profile will contain neither attributes nor CMM-specific data.


Note -

Currently, your application cannot call KcsGetAttribute() for a list of the installed and available CMMs. The workaround is to load all available profiles and call K()csGetAttribute() for each individual CMM type.


Arguments

Table 4-5 KcsCreateProfile() Arguments

Argument 

Description 

resultProfileId

The reference to the resultant profile, returned if the function executes successfully.

desc

This is a pointer to a KcsCreationDesc (see "KcsCreationDesc ") structure that describes the static store used to save the profile and an extendable union of profile information used to create the profile. The id member of the union describes which CMM and version to use, and the profile format and version to use.

If desc is NULL the default CMM and profile format are used.

Returns

Table 4-6 KcsCreateProfile() Return Strings

KCS_SUCCESS

KCS_MEM_ALLOC_ERROR

Example


Example 4-2 KcsCreateProfile()

KcsProfileDesc								desc;
 KcsCreationDesc								c_desc;
 KcsProfileId								profileid;
 KcsStatusId								status;
 KcsErrDesc								errDesc;
 /* The filename is a command line argument */
 /* Create a new profile with the default CMM */

 desc.type = KcsSolarisProfile;
 desc.desc.solarisFile.fileName = argv[1];
 desc.desc.solarisFile.hostName = NULL;
 desc.desc.solarisFile.oflag = O_RDWR|O_CREAT|O_TRUNC;
 desc.desc.solarisFile.mode = 0666;
 c_desc.profileDesc = &desc;
 c_desc.desc.id.cmmId = 0;
 c_desc.desc.id.cmmVersionId = 0;
 c_desc.desc.id.profileId = 0;
 c_desc.desc.id.profileVersionId = 0;
 status = KcsCreateProfile(&profileid, &c_desc);
 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("CreateProfile error: %s\n", errDesc.desc);
 }


Note -

Other required fields in the profile must be set with KcsSetAttribute().