---
name: "capng_stage_additional_groups"
section: "3"
platform: "linux"
package: "libcap-ng"
version: "0.9.6-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/capng_stage_additional_groups"
---

# capng\_stage\_additional\_groups(3)

stage additional gids for capng\_change\_id

## NAME

capng\_stage\_additional\_groups - stage additional gids for capng\_change\_id

## SYNOPSIS

**#include \<cap-ng.h\>**

int capng\_stage\_additional\_groups(const gid\_t \*gids, size\_t count);

## DESCRIPTION

This function stages an additional gid list for the next [**capng\_change\_id**(3)](/capng_change_id/3.md) call that uses **CAPNG\_APPLY\_STAGED\_GROUPS**. The gids are copied into libcap-ng internal state. Once **capng\_change\_id** returns, libcap-ng clears the staged gids whether they were applied, ignored because the flag was not set, or discarded because the call failed. If staged gids remain unused, libcap-ng also clears them when the thread-local state is deinitialized.

Passing a *count* of 0 clears any currently staged gids.

Normally, you should stick to using the supplemantal groups that are associated with the uid's account that is being changed to. This is provided to simulate the gid model that systemd uses. This interface is available in libcap-ng 0.9.3 and later.

## RETURN VALUE

This returns 0 on success and -1 on failure. A non-zero *count* with a NULL *gids* pointer fails with **errno** set to **EINVAL**.

## SEE ALSO

[**capng\_change\_id**(3)](/capng_change_id/3.md), [**capabilities**(7)](/capabilities/7.md)

## AUTHOR

Steve Grubb
