descriptor with the close-on-fork flag set will be
closed in the process that calls execve(2).
Co-developed-by: Changli Gao
Signed-off-by: Changli Gao
Signed-off-by: Nate Karstens
---
fs/fcntl.c | 4 +-
fs/file.c | 64
Implement functionality for duplicating a file descriptor
and having the close-on-fork flag automatically set in the
new file descriptor.
Signed-off-by: Nate Karstens
---
fs/fcntl.c | 4
include/uapi/linux/fcntl.h | 3 +++
tools/include/uapi/linux/fcntl.h | 3
Series of 4 patches to implement close-on-fork. Tests have been
published to https://github.com/nkarstens/ltp/tree/close-on-fork
and cover close-on-fork functionality in the following syscalls:
* accept(4)
* dup3(2)
* fcntl(2)
* open(2)
* socket(2)
* socketpair(2)
* unshare(2)
Addresses
Implements a new socket flag that automatically sets the
close-on-fork flag for sockets created using socket(2),
socketpair(2), and accept4(2).
Signed-off-by: Nate Karstens
---
include/linux/net.h | 3 ++-
net/socket.c| 14 --
2 files changed, 10 insertions(+), 7 deletions
Add the O_CLOFORK flag to open(2) and dup3(2) to automatically
set the close-on-fork flag in the new file descriptor, saving
a separate call to fcntl(2).
Co-developed-by: Changli Gao
Signed-off-by: Changli Gao
Signed-off-by: Nate Karstens
---
arch/alpha/include/uapi/asm/fcntl.h| 2