KEYCTL_LINK


Creates a link from the keyring to the key.

Arguments

ecx Key serial number.
edx Keyring serial number. It may be one of the following special values:

KEY_SPEC_THREAD_KEYRING Caller's thread-specific keyring.
KEY_SPEC_PROCESS_KEYRING Caller's process-specific keyring.
KEY_SPEC_SESSION_KEYRING Caller's session-specific keyring.
KEY_SPEC_USER_KEYRING Caller's UID-specific keyring.
KEY_SPEC_USER_SESSION_KEYRING Caller's UID-session keyring.
KEY_SPEC_GROUP_KEYRING Caller's GID-specific keyring.
KEY_SPEC_REQKEY_AUTH_KEY This specifies the authorization key created by request_key() and passed to the process it spawns to generate a key. If a valid keyring ID is passed in, then this will simply be returned if the key exists; an error will be issued if it doesn't exist.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-ENOKEY No matching key or keyring was found.
-EKEYEXPIRED The keyring specified has expired.
-EKEYREVOKED The keyring specified had been revoked.
-EACCES The keyring exists, but is not writable or linkable by the calling process.
-ENOMEM Insufficient memory to create a key.
-EDQUOT Expanding the keyring would exceed the keyring owner's quota.
-ENOTDIR edx is not a valid keyring.
-ENFILE Keyring is full.
-ELOOP Nesting of the keyrings is too deep.
-EDEADLK The link would introduce a cycle in the current nesting of the keyrings.

Remarks

The process must have write permission on the keyring and must have link permission on the key.