From 04b8783cdae364179fd0f9b76d2b139e8e927138 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Tue, 19 Aug 1997 07:19:43 +0000 Subject: [PATCH] Manpage for getsid(2). --- lib/libc/sys/Makefile.inc | 5 ++- lib/libc/sys/getsid.2 | 77 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 lib/libc/sys/getsid.2 diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 60056df89cde..d074a87ba12f 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,5 +1,5 @@ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 -# $Id: Makefile.inc,v 1.35 1997/08/19 06:23:45 peter Exp $ +# $Id: Makefile.inc,v 1.36 1997/08/19 07:00:53 peter Exp $ # sys sources .PATH: ${.CURDIR}/../libc/${MACHINE}/sys ${.CURDIR}/../libc/sys @@ -96,7 +96,8 @@ MAN2+= sys/accept.2 sys/access.2 sys/acct.2 sys/adjtime.2 sys/bind.2 \ sys/getdirentries.2 sys/getdtablesize.2 sys/getfh.2 sys/getfsstat.2 \ sys/getgid.2 sys/getgroups.2 sys/getitimer.2 sys/getlogin.2 \ sys/getpeername.2 sys/getpgrp.2 sys/getpid.2 sys/getpriority.2 \ - sys/getrlimit.2 sys/getrusage.2 sys/getsockname.2 sys/getsockopt.2 \ + sys/getrlimit.2 sys/getrusage.2 sys/getsid.2 \ + sys/getsockname.2 sys/getsockopt.2 \ sys/gettimeofday.2 sys/getuid.2 sys/intro.2 sys/ioctl.2 \ sys/issetugid.2 sys/kill.2 \ sys/ktrace.2 sys/link.2 sys/listen.2 sys/lseek.2 sys/mkdir.2 \ diff --git a/lib/libc/sys/getsid.2 b/lib/libc/sys/getsid.2 new file mode 100644 index 000000000000..a1bb99992220 --- /dev/null +++ b/lib/libc/sys/getsid.2 @@ -0,0 +1,77 @@ +.\" Copyright (c) 1997 Peter Wemm +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id$ +.\" +.Dd August 19, 1997 +.Dt GETSID 2 +.Os BSD 4.2 +.Sh NAME +.Nm getsid +.Nd get process session +.Sh SYNOPSIS +.Fd #include +.Ft pid_t +.Fn getsid "pid_t pid" +.Sh DESCRIPTION +The session ID of the process identified by +.Fa pid +is returned by +.Fn getsid . +If +.Fa pid +is zero, +.Fn getsid +returns the session ID of the current process. +.Sh RETURN VALUES +Upon successful completion, the function +.Fn getsid +returns the session ID of +the specified process; otherwise, it returns a value of -1 and +sets errno to indicate an error. +.Sh ERRORS +.Fn getsid +will succeed unless: +.Bl -tag -width Er +.It Bq Er ESRCH +if there is no process with a process ID equal to +.Fa pid . +.El +.Pp +Note that an implementation may restrict this function call to +processes within the same session ID as the calling process. +.Sh SEE ALSO +.Xr getpgrp 2 , +.Xr getpgid 2 , +.Xr setpgid 2 , +.Xr setsid 2 , +.Xr termios 4 +.Sh HISTORY +The +.Fn setsid +function call appeared in +.Fx 3.0 . +The +.Fn getsid +function call is derived from it's usage in +.At V .