KEYCTL_INVALIDATE(2const)
๐ KEYCTL_INVALIDATE (it's a 2const page, bestie)
okay so welcome to the group chat, we're talking about KEYCTL_INVALIDATE from the linux/keyctl.h cinematic universe ๐
โจ NAME โจ
KEYCTL_INVALIDATE โ invalidate a key. that's it. that's the whole job. she ghosts the key ๐
๐ LIBRARY ๐
Standard C library (libc, -lc) โ the classic, the icon, the one you already have ๐ซถ
๐ธ SYNOPSIS ๐ธ
#include <linux/keyctl.h> /* Definition of KEY* constants */
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
long syscall(SYS_keyctl, KEYCTL_INVALIDATE, key_serial_t key);
no cap, that's the whole summoning circle ๐ฎ
๐ฆ DESCRIPTION ๐ฆ
okay so picture this: you have a key, and you want it marked as invalid. That's the vibe. That's the function.
The ID of the key you're about to send to the shadow realm is specified in key โจ
But here's the thing, bestie โ to invalidate a key, the caller must have search permission on the key. no permission, no invalidation, no exceptions. it's giving "you can't sit with us" ๐ซ
So when you do call it: this operation marks the key as invalid and schedules immediate garbage collection. The garbage collector then:
- removes the invalidated key from all keyrings ๐
- deletes the key when its reference count reaches zero ๐
And after this operation, the key will be ignored by all searches, even if it hasn't actually been deleted yet. She's out of the search results already, she just hasn't finished packing her bags ๐งณ
Keys that are marked invalid become invisible to normal key operations immediately, though โ plot twist โ they are still visible in /proc/keys (marked with an 'i' flag) until they are actually removed. so she's gone but the receipts are still there ๐
fr fr: invisible to operations โ deleted. the'i'flag is your only warning in/proc/keys.
๐ฅ RETURN VALUE ๐ฅ
- On success,
0is returned. slay. โจ - On error,
-1is returned, anderrnois set to indicate the error. ๐ญ
โญ VERSIONS โญ
A wrapper is provided in the libkeyutils library: keyctl_invalidate(3). use it if you don't wanna hand-roll the syscall, iykyk ๐
๐ STANDARDS ๐
Linux. just Linux. that's the standard. periodt ๐ซถ
๐ HISTORY ๐
Linux 3.5 โ she's been iconic since 2012-ish, we stan a legacy queen ๐ธ
๐ SEE ALSO ๐
and that's the page, bestie ๐ this came to you courtesy of Linux man-pages 6.20, dated 2026-02-08 โ go invalidate something (respectfully), mwah ๐ซถโจ
๐ฆ 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