diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2020-04-12 21:23:19 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2020-04-12 21:23:19 +0000 |
commit | 472ced39efb537374068f06b348fe5dac389c45a (patch) | |
tree | 30f4cf81fcfd1a7f955265b34c52d3265a977d9a /lib | |
parent | 1d3500e0658360e7475fbf0e3bdf9fe499c2c18a (diff) | |
download | src-472ced39efb537374068f06b348fe5dac389c45a.tar.gz src-472ced39efb537374068f06b348fe5dac389c45a.zip |
Notes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/sys/Symbol.map | 1 | ||||
-rw-r--r-- | lib/libc/sys/closefrom.2 | 41 |
3 files changed, 41 insertions, 2 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index cc882e21a607..913fe56eefbe 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -371,6 +371,7 @@ MLINKS+=chown.2 fchown.2 \ chown.2 lchown.2 MLINKS+=clock_gettime.2 clock_getres.2 \ clock_gettime.2 clock_settime.2 +MLINKS+=closefrom.2 close_range.2 MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index aa60da2a6789..4d3bd5115af3 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -403,6 +403,7 @@ FBSD_1.5 { FBSD_1.6 { __sysctlbyname; + close_range; copy_file_range; fhlink; fhlinkat; diff --git a/lib/libc/sys/closefrom.2 b/lib/libc/sys/closefrom.2 index a0b5fc218666..db41c617dc7f 100644 --- a/lib/libc/sys/closefrom.2 +++ b/lib/libc/sys/closefrom.2 @@ -25,11 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2009 +.Dd April 12, 2020 .Dt CLOSEFROM 2 .Os .Sh NAME -.Nm closefrom +.Nm closefrom , +.Nm close_range .Nd delete open file descriptors .Sh LIBRARY .Lb libc @@ -37,6 +38,8 @@ .In unistd.h .Ft void .Fn closefrom "int lowfd" +.Ft int +.Fn close_range "u_int lowfd" "u_int highfd" "int flags" .Sh DESCRIPTION The .Fn closefrom @@ -44,6 +47,40 @@ system call deletes all open file descriptors greater than or equal to .Fa lowfd from the per-process object reference table. Any errors encountered while closing file descriptors are ignored. +.Pp +The +.Fn close_range +system call deletes all open file descriptors between +.Fa lowfd +and +.Fa highfd +inclusive, clamped to the range of open file descriptors. +Any errors encountered while closing file descriptors are ignored. +There are currently no defined +.Fa flags . +.Sh RETURN VALUES +Upon successful completion, +.Fn close_range +returns a value +of 0. +Otherwise, a value of -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn close_range +system call +will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa highfd +argument is lower than the +.Fa lowfd +argument. +.It Bq Er EINVAL +An invalid flag was set. +.El .Sh SEE ALSO .Xr close 2 .Sh HISTORY |