| 1 |
.\" Copyright 2016, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright 2016, Eugene Syromyatnikov <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH KEYCTL_UNLINK 2const 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
KEYCTL_UNLINK |
| 10 |
\- |
| 11 |
unlink a key from a keyring |
| 12 |
.SH LIBRARY |
| 13 |
Standard C library |
| 14 |
.RI ( libc ,\~ \-lc ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */" |
| 18 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" |
| 19 |
.B #include <unistd.h> |
| 20 |
.P |
| 21 |
.BI "long syscall(SYS_keyctl, KEYCTL_UNLINK, key_serial_t " key , |
| 22 |
.BI " key_serial_t " keyring ); |
| 23 |
.fi |
| 24 |
.SH DESCRIPTION |
| 25 |
Unlink a key from a keyring. |
| 26 |
.P |
| 27 |
The ID of the key to be unlinked is specified in |
| 28 |
.IR key ; |
| 29 |
the ID of the keyring from which it is to be unlinked is specified in |
| 30 |
.IR keyring . |
| 31 |
.P |
| 32 |
If the key is not currently linked into the keyring, an error results. |
| 33 |
.P |
| 34 |
The caller must have |
| 35 |
.I write |
| 36 |
permission on the keyring from which the key is being removed. |
| 37 |
.P |
| 38 |
If the last link to a key is removed, |
| 39 |
then that key will be scheduled for destruction. |
| 40 |
.SH RETURN VALUE |
| 41 |
On success, |
| 42 |
0 is returned. |
| 43 |
.P |
| 44 |
On error, \-1 is returned, and |
| 45 |
.I errno |
| 46 |
is set to indicate the error. |
| 47 |
.SH ERRORS |
| 48 |
.TP |
| 49 |
.B ENOENT |
| 50 |
The key to be unlinked isn't linked to the keyring. |
| 51 |
.SH VERSIONS |
| 52 |
A wrapper is provided in the |
| 53 |
.I libkeyutils |
| 54 |
library: |
| 55 |
.BR keyctl_unlink (3). |
| 56 |
.SH STANDARDS |
| 57 |
Linux. |
| 58 |
.SH HISTORY |
| 59 |
Linux 2.6.10. |
| 60 |
.SH SEE ALSO |
| 61 |
.BR keyctl (2), |
| 62 |
.BR keyctl_unlink (3), |
| 63 |
.BR KEYCTL_LINK (2const) |