File: KEYCTL_SET_TIMEOUT.2const

package info (click to toggle)
manpages 6.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,184 kB
  • sloc: sh: 575; python: 222; perl: 190; makefile: 29; lisp: 22
file content (70 lines) | stat: -rw-r--r-- 1,792 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH KEYCTL_SET_TIMEOUT 2const 2025-05-17 "Linux man-pages (unreleased)"
.SH NAME
KEYCTL_SET_TIMEOUT
\-
set the expiration timer on a key
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.BR "#include <linux/keyctl.h>" "  /* Definition of " KEY* " constants */"
.BR "#include <sys/syscall.h>" "   /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
.BI "long syscall(SYS_keyctl, KEYCTL_SET_TIMEOUT, key_serial_t " key \
", time_t " t );
.fi
.SH DESCRIPTION
Set a timeout on a key.
.P
The ID of the key is specified in
.IR key .
The timeout value, in seconds from the current time,
is specified in
.IR t .
The timeout is measured against the realtime clock.
.P
Specifying the timeout value as 0 clears any existing timeout on the key.
.P
The
.I /proc/keys
file displays the remaining time until each key will expire.
(This is the only method of discovering the timeout on a key.)
.P
The caller must either have the
.I setattr
permission on the key
or hold an instantiation authorization token for the key (see
.BR request_key (2)).
.P
The key and any links to the key will be
automatically garbage collected after the timeout expires.
Subsequent attempts to access the key will then fail with the error
.BR EKEYEXPIRED .
.P
This operation cannot be used to set timeouts on revoked, expired,
or negatively instantiated keys.
.SH RETURN VALUE
On success,
0 is returned.
.P
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH VERSIONS
A wrapper is provided in the
.I libkeyutils
library:
.BR keyctl_set_timeout (3).
.SH STANDARDS
Linux.
.SH HISTORY
Linux 2.6.16.
.SH SEE ALSO
.BR keyctl (2),
.BR keyctl_set_timeout (3)