Operates on and modifies a user-key-set.
Standard C library (libc.a)
#include <sys/ukeys.h>
int ukeyset_add_key (uset, key, flags)
ukeyset_t * uset;
ukey_t key;
unsigned int flags;
int ukeyset_remove_key (uset, key, flags)
ukeyset_t * uset;
ukey_t key;
unsigned int flags;
int ukeyset_add_set (uset, aset)
ukeyset_t * uset;
ukeyset_t aset;
int ukeyset_remove_set (uset, rset)
ukeyset_t * uset;
ukeyset_t rset;
These subroutines operate on and modify user-key-sets. The user-key-set must have been originally initialized with the ukeyset_init subroutine.
Individual or groups (sets) of user-keys can be added or removed . When adding or removing an individual key, the accesses (read or write, or both read and write) being added or removed must be specified through the flags parameter. When adding or removing user-key-sets, specification is not required, because a key-set contains not only information on what keys are enabled, but also information on which specific access permissions are enabled for each one of those keys.
The ukeyset_add_key subroutine adds the user-key specified by the key parameter with accesses as specified by the flags parameter to the user-key-set specified by the uset parameter. The ukeyset_remove_key subroutine removes the accesses specified by the flags parameter of the key specified by the key parameter from the user-key-set specified by the uset parameter. The ukeyset_add_set subroutine adds the keys and accesses specified by the aset key-set parameter to the user-key-set specified by the uset parameter. The ukeyset_remove_set subroutine removes the keys and accesses specified by the rset key-set parameter from the user-key-set specified by the uset parameter.
Attempting to remove a defined user-key that does not exist in the source key-set is ignored silently in a manner similar to the signal set services.
These subroutines will fail unless the ukey_enable subroutine has already been successfully executed by a thread in the process. Refer to the Storage Protect Keys article for more details.
Item | Description |
---|---|
uset | User-key-set to be modified. |
rset | User-key-set to remove. |
aset | User-key-set to add. |
key | User-key to add or remove from a key-set. This parameter is combined with read or write flags when performing add or remove operations. |
flags | The
following flags are defined for the ukeyset_add_key() and ukeyset_remove_key() services:
|
If successful, the user-key-set subroutines return a value of 0. Otherwise, they return a value of -1 and set the errno global variable to indicate the error.
The ukeyset_add_key and ukeyset_remove_key subroutines are unsuccessful if the following are true:
Item | Description |
---|---|
EINVAL | Invalid flags parameter, invalid key-set specified in uset parameter or invalid (undefined) keys specified in the key parameter. |
ENOSYS | Unconfigured (unavailable) private key specified in the key parameter or process is not user-key enabled. |
The ukeyset_add_set, ukeyset_remove_set, ukeyset_add_set and ukeyset_remove_set subroutines are unsuccessful if the following are true:
Item | Description |
---|---|
EINVAL | Invalid key-set specified in uset , rset or aset parameter. |
ENOSYS | Process is not user-key enabled. |
Only the subroutines that take keys (instead of keysets) to add or remove can fail because of invalid or unused key number or invalid access flags.