Skip to content

DaGenix/closefds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

closefds

closefds is a library that provides support for setting the FD_CLOEXEC flag on all open file descriptors after fork() and before exec() on UNIX-like systems.

Any file descriptors that aren't marked with this flag will stay open after exec() which can cause resources to leak and can lead to deadlocks. Ideally, whenever a file descriptor is created, it will be created with the FD_CLOEXEC flag already set. However, this may not be possible in some circumstances - such as when using an external library or a system call that does not support the FD_CLOEXEC flag, such as pipe().

The function close_fds_on_exec() will create a closure that can be passed as a pre_exec() function when spawning a child process via the Command interface and will set the FD_CLOEXEC flag as appropriate on open file descriptors.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages