Blame man2/getsid.2

Packit 7cfc04
.\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
Packit 7cfc04
.\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
Packit 7cfc04
.\" Modified 2001-12-17, aeb
Packit 7cfc04
.TH GETSID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
getsid \- get session ID
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.B #include <sys/types.h>
Packit 7cfc04
.br
Packit 7cfc04
.B #include <unistd.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "pid_t getsid(pid_t" " pid" );
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.ad l
Packit 7cfc04
.PD 0
Packit 7cfc04
.BR getsid ():
Packit 7cfc04
.RS 4
Packit 7cfc04
_XOPEN_SOURCE\ >=\ 500
Packit 7cfc04
.\"    || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
Packit 7cfc04
.br
Packit 7cfc04
    || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
Packit 7cfc04
.RE
Packit 7cfc04
.PD
Packit 7cfc04
.ad
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.I getsid(0)
Packit 7cfc04
returns the session ID of the calling process.
Packit 7cfc04
.BR getsid ()
Packit 7cfc04
returns the session ID of the process with process ID
Packit 7cfc04
.IR pid .
Packit 7cfc04
If
Packit 7cfc04
.I pid
Packit 7cfc04
is 0,
Packit 7cfc04
.BR getsid ()
Packit 7cfc04
returns the session ID of the calling process.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success, a session ID is returned.
Packit 7cfc04
On error, \fI(pid_t)\ \-1\fP will be returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set appropriately.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
A process with process ID
Packit 7cfc04
.I pid
Packit 7cfc04
exists, but it is not in the same session as the calling process,
Packit 7cfc04
and the implementation considers this an error.
Packit 7cfc04
.TP
Packit 7cfc04
.B ESRCH
Packit 7cfc04
No process with process ID
Packit 7cfc04
.I pid
Packit 7cfc04
was found.
Packit 7cfc04
.SH VERSIONS
Packit 7cfc04
This system call is available on Linux since version 2.0.
Packit 7cfc04
.\" Linux has this system call since Linux 1.3.44.
Packit 7cfc04
.\" There is libc support since libc 5.2.19.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008, SVr4.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Linux does not return
Packit 7cfc04
.BR EPERM .
Packit 7cfc04
.PP
Packit 7cfc04
See
Packit 7cfc04
.BR credentials (7)
Packit 7cfc04
for a description of sessions and session IDs.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR getpgid (2),
Packit 7cfc04
.BR setsid (2),
Packit 7cfc04
.BR credentials (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.