CLOSEFROM(2) | System Calls Manual | CLOSEFROM(2)

# NAME

`closefrom` — delete many descriptors

# SYNOPSIS

`#include <unistd.h>`

int
`closefrom`(int fd);

# DESCRIPTION

The `closefrom`() call deletes all descriptors numbered fd and higher from the per-process file descriptor table. It is effectively the same as calling close(2) on each descriptor.

# RETURN VALUES

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

# ERRORS

`closefrom`() will fail if:

[`EBADF`]
  fd is greater than all open file descriptors.
[`EINTR`]
  An interrupt was received.

# SEE ALSO

close(2)

# STANDARDS

`closefrom`() is a BSD and Solaris extension.

# HISTORY

The `closefrom`() function first appeared in Solaris 9 and has been available since OpenBSD 3.5.

May 31, 2019 | Debian