Debian Codegraph @

upstream/debian-unstable/man2/KEYCTL_SET_TIMEOUT.2const

raw
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_SET_TIMEOUT 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 KEYCTL_SET_TIMEOUT
10 \-
11 set the expiration timer on a key
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_SET_TIMEOUT, key_serial_t " key \
22 ", time_t " t );
23 .fi
24 .SH DESCRIPTION
25 Set a timeout on a key.
26 .P
27 The ID of the key is specified in
28 .IR key .
29 The timeout value, in seconds from the current time,
30 is specified in
31 .IR t .
32 The timeout is measured against the realtime clock.
33 .P
34 Specifying the timeout value as 0 clears any existing timeout on the key.
35 .P
36 The
37 .I /proc/keys
38 file displays the remaining time until each key will expire.
39 (This is the only method of discovering the timeout on a key.)
40 .P
41 The caller must either have the
42 .I setattr
43 permission on the key
44 or hold an instantiation authorization token for the key (see
45 .BR request_key (2)).
46 .P
47 The key and any links to the key will be
48 automatically garbage collected after the timeout expires.
49 Subsequent attempts to access the key will then fail with the error
50 .BR EKEYEXPIRED .
51 .P
52 This operation cannot be used to set timeouts on revoked, expired,
53 or negatively instantiated keys.
54 .SH RETURN VALUE
55 On success,
56 0 is returned.
57 .P
58 On error, \-1 is returned, and
59 .I errno
60 is set to indicate the error.
61 .SH VERSIONS
62 A wrapper is provided in the
63 .I libkeyutils
64 library:
65 .BR keyctl_set_timeout (3).
66 .SH STANDARDS
67 Linux.
68 .SH HISTORY
69 Linux 2.6.16.
70 .SH SEE ALSO
71 .BR keyctl (2),
72 .BR keyctl_set_timeout (3)