| 1 |
.\" Copyright 2002-2015, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH PR_SET_KEEPCAPS 2const 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
PR_SET_KEEPCAPS |
| 9 |
\- |
| 10 |
set the state of the "keep capabilities" flag |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 17 |
.B #include <sys/prctl.h> |
| 18 |
.P |
| 19 |
.BI "int prctl(PR_SET_KEEPCAPS, long " state ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Set the state of the calling thread's "keep capabilities" flag. |
| 23 |
The effect of this flag is described in |
| 24 |
.BR capabilities (7). |
| 25 |
.I state |
| 26 |
must be either |
| 27 |
.B 0L |
| 28 |
(clear the flag) |
| 29 |
or |
| 30 |
.B 1L |
| 31 |
(set the flag). |
| 32 |
The "keep capabilities" value will be reset to 0 on subsequent calls to |
| 33 |
.BR execve (2). |
| 34 |
.SH RETURN VALUE |
| 35 |
On success, |
| 36 |
0 is returned. |
| 37 |
On error, \-1 is returned, and |
| 38 |
.I errno |
| 39 |
is set to indicate the error. |
| 40 |
.SH ERRORS |
| 41 |
.TP |
| 42 |
.B EINVAL |
| 43 |
.I state |
| 44 |
is not a valid value. |
| 45 |
.TP |
| 46 |
.B EPERM |
| 47 |
The caller's |
| 48 |
.B SECBIT_KEEP_CAPS_LOCKED |
| 49 |
flag is set |
| 50 |
(see |
| 51 |
.BR capabilities (7)). |
| 52 |
.SH STANDARDS |
| 53 |
Linux. |
| 54 |
.SH HISTORY |
| 55 |
Linux 2.2.18. |
| 56 |
.SH SEE ALSO |
| 57 |
.BR prctl (2), |
| 58 |
.BR PR_GET_KEEPCAPS (2const) |