diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-01-12 18:27:29 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-01-12 18:27:29 +0000 |
commit | c78de9b5b51f8b1c4417376bfb8082663054f9ab (patch) | |
tree | b348cda6579e77e03479dca8988920e27ec7d8e9 | |
parent | cfb6d69827f4da4a70525d42c45b97713d4951f2 (diff) |
new syscall closefrom(2). ok deraadt millert
-rw-r--r-- | lib/libc/shlib_version | 2 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 8 | ||||
-rw-r--r-- | lib/libc/sys/closefrom.2 | 60 | ||||
-rw-r--r-- | lib/libpthread/shlib_version | 2 |
4 files changed, 66 insertions, 6 deletions
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version index 76dddc88a6b..48f1de2da8a 100644 --- a/lib/libc/shlib_version +++ b/lib/libc/shlib_version @@ -1,2 +1,2 @@ major=30 -minor=1 # note: remember to update minor in ../libpthread/shlib_version +minor=3 # note: remember to update minor in ../libpthread/shlib_version diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index ee78625d6b0..fc16d954812 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.66 2003/05/10 17:52:17 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.67 2004/01/12 18:27:28 tedu Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -31,7 +31,7 @@ SRCS+= stack_protector.c # modules with default implementations on all architectures: ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ chown.o chroot.o clock_gettime.o clock_settime.o clock_getres.o \ - close.o connect.o dup.o dup2.o execve.o fchdir.o \ + close.o closefrom.o connect.o dup.o dup2.o execve.o fchdir.o \ fchflags.o fchmod.o fchown.o fcntl.o fhopen.o fhstat.o fhstatfs.o \ flock.o fpathconf.o fstat.o \ fstatfs.o fsync.o futimes.o getdirentries.o getegid.o geteuid.o \ @@ -208,8 +208,8 @@ LintSysPseudoNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \ -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR} MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \ - chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 connect.2 dup.2 \ - execve.2 _exit.2 fcntl.2 fhopen.2 \ + chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 connect.2 \ + dup.2 execve.2 _exit.2 fcntl.2 fhopen.2 \ flock.2 fork.2 fsync.2 getdirentries.2 \ getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \ getpeername.2 getpeereid.2 getpgrp.2 \ diff --git a/lib/libc/sys/closefrom.2 b/lib/libc/sys/closefrom.2 new file mode 100644 index 00000000000..e8821e40d60 --- /dev/null +++ b/lib/libc/sys/closefrom.2 @@ -0,0 +1,60 @@ +.\" $OpenBSD: closefrom.2,v 1.1 2004/01/12 18:27:28 tedu Exp $ +.\" +.\" Copyright (c) 2004 Ted Unangst. All rights reserved. +.\" +.\" 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. +.Dd Jan 11, 2004 +.Dt CLOSEFROM 2 +.Os +.Sh NAME +.Nm closefrom +.Nd delete many descriptors +.Sh SYNOPSIS +.Fd #include <unistd.h> +.Ft int +.Fn closefrom "int fd" +.Sh DESCRIPTION +The +.Fn closefrom +call deletes all descriptors numbered +.Fa fd +and higher from the per-process file descriptor table. +It is effectively the same as calling +.Xr close 2 +on each descriptor. +.Sh RETURN VALUES +Upon successful completion, a value of 0 is returned. +Otherwise, a value of \-1 is returned and the global integer variable +.Va errno +is set to indicate the error. +.Sh ERRORS +.Fn closefrom +will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +.Fa fd +is greater than any open file descriptor. +.It Bq Er EINTR +An interrupt was received. +.El +.Sh SEE ALSO +.Xr close 2 diff --git a/lib/libpthread/shlib_version b/lib/libpthread/shlib_version index ba5a3fee584..b363be4447c 100644 --- a/lib/libpthread/shlib_version +++ b/lib/libpthread/shlib_version @@ -1,2 +1,2 @@ major=2 -minor=2 +minor=3 |