NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |ERRORS |LINKING |SEE ALSO |COLOPHON | |
KEYCTL_CAPABILITIES(3) Linux Key Management CallsKEYCTL_CAPABILITIES(3)keyctl_capabilities - Query subsystem capabilities
#include <keyutils.h>long keyctl_capabilities(unsigned char *buffer, size_tbuflen);
keyctl_capabilities() queries the keyrings subsystem in the kernel to ask about its capabilities and fills in the array in the buffer with bits that indicate the presence or absence of specific features in the keyrings subsystem. The function returns the amount of data the kernel has available, irrespective of the amount of buffer space available. If the buffer is shorter than the data, a short copy will be made; if the buffer is larger than the data, the excess space will be cleared. If this operation is not available in the kernel, the keyutils library will emulate it as best it can and the capability bit that indicates if the kernel operation is available will be cleared. Inbuffer[0], the following capabilities exist:KEYCTL_CAPS0_CAPABILITIES This is set if the kernel supports this operation and cleared otherwise. If it is cleared, the rest of the flags are emulated.KEYCTL_CAPS0_PERSISTENT_KEYRINGS This is set if the kernel supports persistent keyrings and cleared otherwise. Seekeyctl_get_persistent(3).KEYCTL_CAPS0_DIFFIE_HELLMAN This is set if the kernel supports Diffie-Hellman calculation and cleared otherwise. Seekeyctl_dh_compute(3).KEYCTL_CAPS0_PUBLIC_KEY This is set if the kernel supports public-key operations and cleared otherwise. Seekeyctl_pkey_query(3).KEYCTL_CAPS0_BIG_KEY This is set if the kernel supports the big_key key type and cleared otherwise.KEYCTL_CAPS0_INVALIDATE This is set if the kernel supports key invalidation and cleared otherwise. Seekeyctl_invalidate(3).KEYCTL_CAPS0_RESTRICT_KEYRING This is set if the kernel supports restrictions on keyrings and cleared otherwise. Seekeyctl_restrict_keyring(3).KEYCTL_CAPS0_MOVE This is set if the kernel supports the move key operation and cleared otherwise. Seekeyctl_move(3). Inbuffer[1], the following capabilities exist:KEYCTL_CAPS1_NS_KEYRING_NAME This is set if the keyring names are segregated according to the user-namespace in which a keyring is created.KEYCTL_CAPS1_NS_KEY_TAG This is set if a key or keyring may get tagged with a namespace, thereby allowing multiple keys with the same type and description, but different namespace tags, to coexist within the same keyring. Tagging may be automatic depending on the key type. Only network-namespace tagging is currently used.
On successkeyctl_capabilities() returns the size of the data it has available, irrespective of the size of the buffer. On error, the value-1will be returned anderrno will have been set to an appropriate error.
EFAULTThe buffer cannot be written to.
This is a library function that can be found inlibkeyutils. When linking,-lkeyutilsshould be specified to the linker.
keyctl(1),add_key(2),keyctl(2),request_key(2),keyctl(3),keyrings(7),keyutils(7)
This page is part of thekeyutils (key management utilities) project. Information about the project can be found at [unknown -- if you know, please contact man-pages@man7.org] If you have a bug report for this manual page, send it to keyrings@linux-nfs.org. This page was obtained from the project's upstream Git repository ⟨http://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2023-03-20.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux 30 May 2019KEYCTL_CAPABILITIES(3)Pages that refer to this page:keyctl(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |