---
name: "PR_SET_KEEPCAPS"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/PR_SET_KEEPCAPS"
---

# PR\_SET\_KEEPCAPS(2const)

set the state of the "keep capabilities" flag

## NAME

PR\_SET\_KEEPCAPS - set the state of the "keep capabilities" flag

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>
```

**int prctl(PR\_SET\_KEEPCAPS, long** *state***);**

## DESCRIPTION

Set the state of the calling thread's "keep capabilities" flag. The effect of this flag is described in [**capabilities**(7)](/capabilities/7.md). *state* must be either **0L** (clear the flag) or **1L** (set the flag). The "keep capabilities" value will be reset to 0 on subsequent calls to [**execve**(2)](/execve/2.md).

## RETURN VALUE

On success, 0 is returned. On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

- **EINVAL**

  *state* is not a valid value.

- **EPERM**

  The caller's **SECBIT\_KEEP\_CAPS\_LOCKED** flag is set (see [**capabilities**(7)](/capabilities/7.md)).

## STANDARDS

Linux.

## HISTORY

Linux 2.2.18.

## SEE ALSO

[**prctl**(2)](/prctl/2.md), [**PR\_GET\_KEEPCAPS**(2const)](/PR_GET_KEEPCAPS/2const.md)
