| 1 |
.\" Copyright 2014, 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 group_member 3 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
group_member \- test whether a process is in a group |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <unistd.h> |
| 15 |
.P |
| 16 |
.BI "int group_member(gid_t " gid ); |
| 17 |
.fi |
| 18 |
.P |
| 19 |
.RS -4 |
| 20 |
Feature Test Macro Requirements for glibc (see |
| 21 |
.BR feature_test_macros (7)): |
| 22 |
.RE |
| 23 |
.P |
| 24 |
.BR group_member (): |
| 25 |
.nf |
| 26 |
_GNU_SOURCE |
| 27 |
.fi |
| 28 |
.SH DESCRIPTION |
| 29 |
The |
| 30 |
.BR group_member () |
| 31 |
function tests whether any of the caller's supplementary group IDs |
| 32 |
(as returned by |
| 33 |
.BR getgroups (2)) |
| 34 |
matches |
| 35 |
.IR gid . |
| 36 |
.SH RETURN VALUE |
| 37 |
The |
| 38 |
.BR group_member () |
| 39 |
function returns nonzero if any of the caller's |
| 40 |
supplementary group IDs matches |
| 41 |
.IR gid , |
| 42 |
and zero otherwise. |
| 43 |
.SH STANDARDS |
| 44 |
GNU. |
| 45 |
.SH SEE ALSO |
| 46 |
.BR getgid (2), |
| 47 |
.BR getgroups (2), |
| 48 |
.BR getgrouplist (3), |
| 49 |
.BR group (5) |