getsid(2) System Calls Manual getsid(2) getsid - ID C (libc, -lc) #include pid_t getsid(pid_t pid); glibc (. feature_test_macros(7)): getsid(): _XOPEN_SOURCE >= 500 || /* glibc 2.12: */ _POSIX_C_SOURCE >= 200809L getsid() ID pid. pid 0, getsid() . On success, a session ID is returned. On error, (pid_t) -1 is returned, and errno is set to indicate the error. EPERM pid , ; . ESRCH pid . Linux EPERM. POSIX.1-2024. SVr4, SUSv1, Linux 2.0, POSIX.1-2001 XSI, POSIX.1-2008. credentials(7) . getpgid(2), setsid(2), credentials(7) () Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () . Linux man-pages 6.18 8 2026 . getsid(2)