tcgetsid(3) Library Functions Manual tcgetsid(3) tcgetsid - Standard C library (libc, -lc) #define _XOPEN_SOURCE 500 /* See feature_test_macros(7) */ #include pid_t tcgetsid(int fd); tcgetsid() , fd. . When fd refers to the controlling terminal of our session, the function tcgetsid() will return the session ID of this session. Otherwise, -1 is returned, and errno is set to indicate the error. EBADF fd . ENOTTY fd . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |tcgetsid() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1-2008. glibc 2.1. POSIX.1-2001. ioctl(2) TIOCGSID, Linux 2.1.71. getsid(2) () Azamat Hackimov , Dmitry Bolkhovskikh , Yuri Kozlov , Kirill Rekhov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux man-pages 6.12 23 2024 . tcgetsid(3)