Generates a system-wide unique PAG value for a given PAG type.
int kcred_genpagvalue(crp, pag_type, pag_value, pag_flags);
cred_t *crp;
int pag_type;
uint64_t * pag_value;
int pag_flags;
The kcred_genpagvalue kernel service generates a new PAG value for a given PAG type. It is essential that for this function to succeed the PAG type must have been previously registered with the operating system using the kcred_setpagname kernel service. The scope of the kcred_genpagvalue kernel service is limited to maintaining information about the last generated PAG number and accordingly generating a new number. This service optionally stores the PAG value in the cred structure. It does not monitor the PAG values stored in the cred structure by other means.
The caller must convert a PAG name to a PAG type using the kcred_getpagid kernel service prior to invoking the kcred_genpagvalue kernel service.
The pag_flags parameter with the PAG_SET_VALUE value set causes the generated value to be atomically stored in the process's credentials.
The PAG value returned is of size 64 bits. The number of significant bits is determined by the requested PAG type. 32-bit PAGs have 32 significant bits. 64-bit PAGs have 62 significant bits.
Item | Description |
---|---|
pag_type | The pag_type parameter is the ID value associated with a PAG name. |
pag_value | This pointer points to a buffer where the OS will return the newly generated PAG value. |
pag_flags | This parameter must be 0 or the value PAG_SET_VALUE. |
A value of 0 is returned upon successful completion. A negative value is returned if unsuccessful.
Item | Description |
---|---|
EINVAL | The PAG value cannot be generated because the named PAG type does not exist as part of the table. |
EPERM | The named PAG type is a 32-bit PAG and the caller does not have the SET_PROC_DAC privilege. |