diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 07:11:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 07:11:15 +0000 |
commit | d2279fb6e2482b1a5f7780b7a6bf0f393e6040f3 (patch) | |
tree | 4c0b55a0f5653eca9718344fc4afdd2d34b307c0 /lib/libc | |
parent | 7eaa1da8a65b7c1bc8323712e85e7711eb61a588 (diff) |
add getsid(2), XPG4
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 5 | ||||
-rw-r--r-- | lib/libc/sys/getsid.2 | 81 |
2 files changed, 84 insertions, 2 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index b3af836f35c..4aa099044a7 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.23 1997/05/30 21:53:10 kstailey Exp $ +# $OpenBSD: Makefile.inc,v 1.24 1997/11/13 07:11:13 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -25,6 +25,7 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ getfh.o getfsstat.o getgid.o getgroups.o getitimer.o getpeername.o \ getpgid.o \ getpgrp.o getpid.o getppid.o getpriority.o getrlimit.o getrusage.o \ + getsid.o \ getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \ ioctl.o kill.o \ ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \ @@ -116,7 +117,7 @@ MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \ execve.2 _exit.2 fcntl.2 flock.2 fork.2 fsync.2 getdirentries.2 \ getfh.2 getfsstat.2 \ getgid.2 getgroups.2 getitimer.2 getlogin.2 getpeername.2 getpgrp.2 \ - getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsockname.2 \ + getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \ getsockopt.2 gettimeofday.2 getuid.2 intro.2 issetugid.2 ioctl.2 \ kill.2 ktrace.2 link.2 \ listen.2 lseek.2 mkdir.2 mkfifo.2 mknod.2 madvise.2 mincore.2 \ diff --git a/lib/libc/sys/getsid.2 b/lib/libc/sys/getsid.2 new file mode 100644 index 00000000000..a25e072f882 --- /dev/null +++ b/lib/libc/sys/getsid.2 @@ -0,0 +1,81 @@ +.\" $OpenBSD: getsid.2,v 1.1 1997/11/13 07:11:14 deraadt Exp $ +.\" +.\" Copyright (c) 1997 Peter Wemm <peter@freebsd.org> +.\" +.\" 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: getsid.2,v 1.1 1997/11/13 07:11:14 deraadt Exp $ +.\" +.Dd August 19, 1997 +.Dt GETSID 2 +.Os BSD 4.2 +.Sh NAME +.Nm getsid +.Nd get process session +.Sh SYNOPSIS +.Fd #include <unistd.h> +.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 getpgid 2 , +.Xr getpgrp 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 , +and is mandated by +.St -xpg4 . |