CAPNG\_RESTORE\_STATE(3) Libcap-ng API CAPNG\_RESTORE\_STATE(3)

# [NAME](#NAME)

capng\_restore\_state - set the internal library state

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;cap-ng.h&gt;**

void capng\_restore\_state(void \*\*state);

# [DESCRIPTION](#DESCRIPTION)

capng\_restore\_state is a function that takes the state information previously saved by capng\_save\_state and restores the libraries internal state. This function is not available in the python bindings.

# [RETURN VALUE](#RETURN_VALUE)

None.

# [NOTES](#NOTES)

capng\_restore\_state free's the previously malloc'd state, thus the state can't be restored multiple times.

The working pid is part of the restored state, if restoring the state to a different thread, capng\_setpid can be used to update it.

# [SEE ALSO](#SEE_ALSO)

[**capng\_save\_state**(3)](/man/os/libcap-ng/capng_save_state.3), [**capabilities**(7)](/man/os/libcap-ng/capabilities.7)

# [AUTHOR](#AUTHOR)

Steve Grubb

March 2026 Red Hat

---

Document: capng_restore_state(3) from libcap-ng 0.9.6-r0 (Chainguard OS)
Source: https://github.com/stevegrubb/libcap-ng.git
