capng_stage_additional_groups(3) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | SEE ALSO | AUTHOR | COLOPHON

CAPNG_STAGE...IONAL_GROUPS(3) Libcap-ng API CAPNG_STAGE...IONAL_GROUPS(3)

NAME         top

       capng_stage_additional_groups - stage additional gids for
       capng_change_id

SYNOPSIS         top

       #include <cap-ng.h>

       int capng_stage_additional_groups(const gid_t *gids, size_t
       count);

DESCRIPTION         top

       This function stages an additional gid list for the next
       capng_change_id(3) 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         top

       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         top

       capng_change_id(3), capabilities(7)

AUTHOR         top

       Steve Grubb

COLOPHON         top

       This page is part of the libcap-ng (capabilities commands and
       library (NG)) project.  Information about the project can be found
       at ⟨https://people.redhat.com/sgrubb/libcap-ng/⟩.  It is not known
       how to report bugs for this man page; if you know, please send a
       mail to man-pages@man7.org.  This page was obtained from the
       tarball fetched from
       ⟨https://people.redhat.com/sgrubb/libcap-ng/index.html⟩ on
       2026-05-24.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Red Hat                          Mar 2026   CAPNG_STAGE...IONAL_GROUPS(3)

Pages that refer to this page: capng_change_id(3)