File: getsid.2

package info (click to toggle)
manpages 6.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,184 kB
  • sloc: sh: 575; python: 222; perl: 190; makefile: 29; lisp: 22
file content (74 lines) | stat: -rw-r--r-- 1,488 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: GPL-2.0-or-later
.\"
.TH getsid 2 2025-05-17 "Linux man-pages (unreleased)"
.SH NAME
getsid \- get session ID
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.P
.BI "pid_t getsid(pid_t" " pid" );
.fi
.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.P
.BR getsid ():
.nf
    _XOPEN_SOURCE >= 500
.\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
        || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
.fi
.SH DESCRIPTION
.BR getsid ()
returns the session ID of the process with process ID
.IR pid .
If
.I pid
is 0,
.BR getsid ()
returns the session ID of the calling process.
.SH RETURN VALUE
On success, a session ID is returned.
On error,
.I (pid_t)\ \-1
is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EPERM
A process with process ID
.I pid
exists, but it is not in the same session as the calling process,
and the implementation considers this an error.
.TP
.B ESRCH
No process with process ID
.I pid
was found.
.SH VERSIONS
Linux does not return
.BR EPERM .
.SH STANDARDS
POSIX.1-2008.
.SH HISTORY
POSIX.1-2001, SVr4.
Linux 2.0.
.\" Linux has this system call since Linux 1.3.44.
.\" There is libc support since libc 5.2.19.
.SH NOTES
See
.BR credentials (7)
for a description of sessions and session IDs.
.SH SEE ALSO
.BR getpgid (2),
.BR setsid (2),
.BR credentials (7)