1 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
2 .\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
7 .\" Modified 2001-12-17, aeb
8 .TH getsid 2 (date) "Linux man-pages (unreleased)"
10 getsid \- get session ID
13 .RI ( libc ", " \-lc )
16 .B #include <unistd.h>
18 .BI "pid_t getsid(pid_t" " pid" );
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
29 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
30 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
34 returns the session ID of the process with process ID
40 returns the session ID of the calling process.
42 On success, a session ID is returned.
43 On error, \fI(pid_t)\ \-1\fP is returned, and
45 is set to indicate the error.
49 A process with process ID
51 exists, but it is not in the same session as the calling process,
52 and the implementation considers this an error.
55 No process with process ID
66 .\" Linux has this system call since Linux 1.3.44.
67 .\" There is libc support since libc 5.2.19.
71 for a description of sessions and session IDs.