KEYCTL_CAPABILITIES(3)
β¨ KEYCTL_CAPABILITIES β¨
okay bestie, so this one lives in the Linux Key Management Calls section of the manual β it's keyctl_capabilities(3) and it's basically the vibe check for the kernel's keyrings subsystem π
π NAME π
keyctl_capabilities β no cap, this is the one that queries subsystem capabilities πβ¨
π¦ SYNOPSIS π¦
#include <keyutils.h>
long keyctl_capabilities(unsigned char *buffer, size_t buflen);
π DESCRIPTION π
So keyctl_capabilities() goes and asks the keyrings subsystem in the kernel what it can actually do, and then it fills in the array in the buffer with bits that say whether each specific feature is present or not. it's giving "let me check what you're capable of" energy π
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. like, it works with what you gave it, periodt π«Ά
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 whether the kernel operation is available will be cleared. so you can always tell, iykyk β¨
πΈ In buffer[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 thebig_keykey 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). π
π In buffer[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. π
β RETURN VALUE β
On success keyctl_capabilities() returns the size of the data it has available, irrespective of the size of the buffer. so it's literally telling you how much it could have given you π
On error, the value -1 will be returned and errno will have been set to an appropriate error. π
π ERRORS π
EFAULTβ the buffer cannot be written to. rude tbh π
π§ LINKING π§
This is a library function that can be found in libkeyutils. When linking, -lkeyutils should be specified to the linker. don't forget it bestie, fr fr π₯
π SEE ALSO π
keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)
that's the whole thing, bestie π this page came from Linux and it's dated 30 May 2019, filed under the name KEYCTL_CAPABILITIES(3) β and honestly? iconic. slay. periodt β¨ππ¦
π¦ where this page comes from
- alpine 3.22: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- arch rolling: keyutils 1.6.3-4 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: keyutils-libs-devel 1.6.3-5.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- debian bookworm: libkeyutils-dev 1.6.3-2 Β· GPL-2.0-or-later
- debian trixie: libkeyutils-dev 1.6.3-6 Β· GPL-2.0-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixpkgs unstable: keyutils 1.6.3
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu noble: libkeyutils-dev 1.6.3-3build1 Β· GPL-2.0-or-later
- ubuntu questing: libkeyutils-dev 1.6.3-6ubuntu2
- ubuntu resolute: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- ubuntu stonking: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- Copyright (C) 2019 Red Hat, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms