Debian Codegraph @

upstream/fedora-44/man2const/KEYCTL_CLEAR.2const

raw
1 .\" Copyright 2016, Michael Kerrisk <[email protected]>
2 .\" Copyright 2016, Eugene Syromyatnikov <[email protected]>
3 .\" A very few fragments remain from an earlier version of this page
4 .\" written by David Howells ([email protected])
5 .\" Copyright 2024, Alejandro Colomar <[email protected]>
6 .\"
7 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .\"
9 .TH KEYCTL_CLEAR 2const 2024-08-21 "Linux man-pages 6.13"
10 .SH NAME
11 KEYCTL_CLEAR
12 \-
13 clear a keyring
14 .SH LIBRARY
15 Standard C library
16 .RI ( libc ,\~ \-lc )
17 .SH SYNOPSIS
18 .nf
19 .BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */"
20 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
21 .B #include <unistd.h>
22 .P
23 .BI "long syscall(SYS_keyctl, KEYCTL_CLEAR, key_serial_t " key );
24 .fi
25 .SH DESCRIPTION
26 Clear the contents of (i.e., unlink all keys from) a keyring.
27 .P
28 The ID of the key
29 (which must be of keyring type)
30 .\" or the error ENOTDIR results
31 is provided in
32 .IR key .
33 .\" According to Documentation/security/keys.txt:
34 .\" This function can also be used to clear special kernel keyrings if they
35 .\" are appropriately marked if the user has CAP_SYS_ADMIN capability. The
36 .\" DNS resolver cache keyring is an example of this.
37 .P
38 The caller must have
39 .I write
40 permission on the keyring.
41 .SH RETURN VALUE
42 On success,
43 0 is returned.
44 .P
45 On error, \-1 is returned, and
46 .I errno
47 is set to indicate the error.
48 .SH VERSIONS
49 A wrapper is provided in the
50 .I libkeyutils
51 library:
52 .BR keyctl_clear (3).
53 .SH STANDARDS
54 Linux.
55 .SH HISTORY
56 Linux 2.6.10.
57 .SH SEE ALSO
58 .BR keyctl (2),
59 .BR keyctl_clear (3)