Updated: April 19, 2023 |
Get the group ID
#include <sys/types.h> #include <unistd.h> gid_t getgid( void );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The getgid() function gets the group ID for the calling process.
The calling process's group ID. This function can't fail.
/* * Print the group id of a process. */ #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main( void ) { printf( "I belong to group ID %d\n", getgid() ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |