libbsd: add closefrom() and close_range()

Change-Id: I9c88948d6c4d5a32e3aa06cd696e2ce24c2d298f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9334
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Jérôme Duval
2025-06-09 16:26:13 +00:00
committed by waddlesplash
parent 396ebbc16f
commit 23f923bcaf
8 changed files with 86 additions and 0 deletions
+3
View File
@@ -28,6 +28,9 @@ char *getusershell(void);
int issetugid(void);
void setusershell(void);
int closefrom(int lowFd);
int close_range(u_int minFd, u_int maxFd, int flags);
#ifdef __cplusplus
}
#endif
+2
View File
@@ -327,6 +327,8 @@
# define SEEK_HOLE 4
#endif
#define CLOSE_RANGE_CLOEXEC 0x4
#ifdef __cplusplus
extern "C" {
+1
View File
@@ -255,6 +255,7 @@ int _user_dup2(int ofd, int nfd, int flags);
status_t _user_lock_node(int fd);
status_t _user_unlock_node(int fd);
status_t _user_preallocate(int fd, off_t offset, off_t length);
status_t _user_close_range(u_int minFd, u_int maxFd, int flags);
/* socket user prototypes (implementation in socket.cpp) */
int _user_socket(int family, int type, int protocol);
+1
View File
@@ -355,6 +355,7 @@ extern status_t _kern_unlock_node(int fd);
extern status_t _kern_get_next_fd_info(team_id team, uint32 *_cookie,
struct fd_info *info, size_t infoSize);
extern status_t _kern_preallocate(int fd, off_t offset, off_t length);
extern status_t _kern_close_range(u_int minFd, u_int maxFd, int flags);
// socket functions
extern int _kern_socket(int family, int type, int protocol);