closefrom2
Delete open file descriptors
Usage
#include <unistd.h>
void
closefrom(int lowfd);
int
close_range(u_int lowfd, u_int highfd, int flags);
Library
Standard C Library (libc, -lc)
Overview
The closefrom() system call deletes all open file descriptors greater than or equal to lowfd from the per-process object reference table. Any errors encountered while closing file descriptors are ignored.
The close_range() system call deletes all open file descriptors between lowfd and highfd inclusive, clamped to the range of open file descriptors. Any errors encountered while closing file descriptors are ignored. Supported flags:
- CLOSE_RANGE_CLOEXEC
-
Set the close-on-exec flag on descriptors in the range instead of closing them.
- CLOSE_RANGE_CLOFORK
-
Set the close-on-fork flag on descriptors in the range instead of closing them.
Return values
Upon successful completion, close_range() returns a value of 0. Otherwise, a value of -1 is returned and the global variable errno is set to indicate the error.
Errors
The close_range() system call will fail if:
- [EINVAL]
-
The highfd argument is lower than the lowfd argument.
- [EINVAL]
-
An invalid flag was set.
Releases
41 releases since FreeBSD 7.3-RELEASE; the text changed 29 times.