KEYCTL_DESCRIBE(2const)
π
KEYCTL_DESCRIBE β described in the 2const manual, bestie
okay so hi!! welcome to the KEYCTL_DESCRIBE page, it's a 2const thing, and honestly? it's giving "tell me everything about this key, no gatekeeping." let's get into it π
β¨ NAME β¨
KEYCTL_DESCRIBE β spill the tea about a key, aka describe a key π¦
π LIBRARY π
Standard C library (libc, -lc). the classic.
πΈ SYNOPSIS πΈ
#include <linux/keyctl.h> /* Definition of KEY* constants */
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
long syscall(size_t size;
SYS_keyctl, KEYCTL_DESCRIBE, key_serial_t key,
char desc[_Nullable size], size_t size);
like yes we're raw-dogging syscall() here, iykyk π
π DESCRIPTION π
So the whole vibe of this one is: you hand it a key, it hands you back a string. A whole little string that describes that key's attributes. that's it, that's the function π
The ID of the key you wanna have described? that goes in key. The descriptive string comes back in the buffer that desc points at, and size says how many bytes big that buffer is. easy.
The key must grant the caller view permission. no view perms, no vibes, no description. π
The returned string is null-terminated and contains this info about the key:
type;uid;gid;perm;description
In that lineup: type and description are strings, uid and gid are decimal strings, and perm is a hexadecimal permissions mask. the descriptive string gets written with this exact format:
%s;%d;%d;%08x;%s
Note: the intention is that the descriptive string should be extensible in future kernel versions. In particular, the description field will not contain semicolons; it should be parsed by working backwards from the end of the string to find the last semicolon. This allows future semicolon-delimited fields to be inserted in the descriptive string in the future.
^^ not me warning you to parse from the back, that's the main character move here π
Writing to the buffer is attempted only when desc is non-NULL and the specified buffer size is big enough to accept the descriptive string (including the terminating null byte). So how do you know if your buffer was too small? check whether the return value of the operation is greater than size. that's your vibe check π
β RETURN VALUE β
On success, you get the size of the description (including the terminating null byte), and that's irrespective of the provided buffer size. so even if your buffer was tiny, it still tells you how much room you actually needed. iconic behaviour, honestly.
On error, -1 is returned, and errno is set to indicate the error. π
π¦ VERSIONS π¦
A wrapper is provided in the libkeyutils library: keyctl_describe(3). yes bestie, you don't have to do the raw syscall every time π
π STANDARDS π
Linux. that's the whole list. periodt.
π HISTORY π
Linux 2.6.10. an elder, a legend, a queen π
πΈ SEE ALSO πΈ
and that's the page!! mwah π this was Linux man-pages 6.20, dated 2026-02-08, and it lives under the name KEYCTL_DESCRIBE(2const). go describe some keys, you absolute genius π«Άβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2016, Michael Kerrisk <mtk.manpages@gmail.com>
- Copyright 2016, Eugene Syromyatnikov <evgsyr@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms