POSIX-2024: support for O_CLOFORK, SO_CLOFORK

Change-Id: I4f3a961947eefdeafd5a249499899cc92d67c2d1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9330
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2025-06-09 16:26:13 +00:00
committed by waddlesplash
parent ba28b6f5f7
commit 904fd2abf0
10 changed files with 68 additions and 11 deletions
+3
View File
@@ -21,6 +21,7 @@
#define F_SETLK 0x0080 /* set locking information */
#define F_SETLKW 0x0100 /* as above, but waits if blocked */
#define F_DUPFD_CLOEXEC 0x0200 /* duplicate fd with close on exec set */
#define F_DUPFD_CLOFORK 0x0400 /* duplicate fd with close on fork set */
/* advisory locking types */
#define F_RDLCK 0x0040 /* read or shared lock */
@@ -29,6 +30,7 @@
/* file descriptor flags for fcntl() */
#define FD_CLOEXEC 1 /* close on exec */
#define FD_CLOFORK 2 /* close on fork */
/* file access modes for open() */
#define O_RDONLY 0x0000 /* read only */
@@ -57,6 +59,7 @@
/* possible */
#define O_NOCACHE O_DIRECT
#define O_DIRECTORY 0x00200000 /* fail if not a directory */
#define O_CLOFORK 0x00400000 /* close on fork */
/* flags for the *at() functions */
#define AT_FDCWD (-100) /* CWD FD for the *at() functions */
+1
View File
@@ -49,6 +49,7 @@ typedef uint8_t sa_family_t;
#define SOCK_NONBLOCK 0x00040000
#define SOCK_CLOEXEC 0x00080000
#define SOCK_CLOFORK 0x00100000
/* Socket options for SOL_SOCKET level */
#define SOL_SOCKET -1
+3
View File
@@ -94,6 +94,9 @@ extern bool fd_is_file(struct file_descriptor* descriptor);
extern bool fd_close_on_exec(const struct io_context *context, int fd);
extern void fd_set_close_on_exec(struct io_context *context, int fd,
bool closeFD);
extern bool fd_close_on_fork(const struct io_context *context, int fd);
extern void fd_set_close_on_fork(struct io_context *context, int fd,
bool closeFD);
static struct io_context *get_current_io_context(bool kernel);
+1
View File
@@ -56,6 +56,7 @@ typedef struct io_context {
struct file_descriptor **fds;
struct select_info **select_infos;
uint8 *fds_close_on_exec;
uint8 *fds_close_on_fork;
struct list node_monitors;
uint32 num_monitors;
uint32 max_monitors;