| 1 |
.\" Copyright 1993, Rickard E. Faith <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH getgid 2 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
getgid, getegid \- get group identity |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <unistd.h> |
| 15 |
.P |
| 16 |
.B gid_t getgid(void); |
| 17 |
.B gid_t getegid(void); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
.BR getgid () |
| 21 |
returns the real group ID of the calling process. |
| 22 |
.P |
| 23 |
.BR getegid () |
| 24 |
returns the effective group ID of the calling process. |
| 25 |
.SH ERRORS |
| 26 |
These functions are always successful |
| 27 |
and never modify |
| 28 |
.\" https://www.austingroupbugs.net/view.php?id=511 |
| 29 |
.\" 0000511: getuid and friends should not modify errno |
| 30 |
.IR errno . |
| 31 |
.SH VERSIONS |
| 32 |
On Alpha, instead of a pair of |
| 33 |
.BR getgid () |
| 34 |
and |
| 35 |
.BR getegid () |
| 36 |
system calls, a single |
| 37 |
.BR getxgid () |
| 38 |
system call is provided, which returns a pair of real and effective GIDs. |
| 39 |
The glibc |
| 40 |
.BR getgid () |
| 41 |
and |
| 42 |
.BR getegid () |
| 43 |
wrapper functions transparently deal with this. |
| 44 |
See |
| 45 |
.BR syscall (2) |
| 46 |
for details regarding register mapping. |
| 47 |
.SH STANDARDS |
| 48 |
POSIX.1-2024. |
| 49 |
.SH HISTORY |
| 50 |
4.3BSD, |
| 51 |
POSIX.1-1988. |
| 52 |
.P |
| 53 |
The original Linux |
| 54 |
.BR getgid () |
| 55 |
and |
| 56 |
.BR getegid () |
| 57 |
system calls supported only 16-bit group IDs. |
| 58 |
Subsequently, Linux 2.4 added |
| 59 |
.BR getgid32 () |
| 60 |
and |
| 61 |
.BR getegid32 (), |
| 62 |
supporting 32-bit IDs. |
| 63 |
The glibc |
| 64 |
.BR getgid () |
| 65 |
and |
| 66 |
.BR getegid () |
| 67 |
wrapper functions transparently deal with the variations across kernel versions. |
| 68 |
.SH SEE ALSO |
| 69 |
.BR getresgid (2), |
| 70 |
.BR setgid (2), |
| 71 |
.BR setregid (2), |
| 72 |
.BR credentials (7) |