mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
Kernel+Userland: Give sys$recvfd() an options argument for O_CLOEXEC
@bugaevc pointed out that we shouldn't be setting this flag in userspace, and he's right of course.
This commit is contained in:
parent
09b1b09c19
commit
781d29a337
7 changed files with 15 additions and 15 deletions
|
@ -347,7 +347,7 @@ public:
|
|||
int sys$get_stack_bounds(FlatPtr* stack_base, size_t* stack_size);
|
||||
int sys$ptrace(Userspace<const Syscall::SC_ptrace_params*>);
|
||||
int sys$sendfd(int sockfd, int fd);
|
||||
int sys$recvfd(int sockfd);
|
||||
int sys$recvfd(int sockfd, int options);
|
||||
long sys$sysconf(int name);
|
||||
int sys$disown(ProcessID);
|
||||
void* sys$allocate_tls(size_t);
|
||||
|
|
|
@ -52,7 +52,7 @@ int Process::sys$sendfd(int sockfd, int fd)
|
|||
return local_socket.sendfd(*socket_description, *passing_descriptor);
|
||||
}
|
||||
|
||||
int Process::sys$recvfd(int sockfd)
|
||||
int Process::sys$recvfd(int sockfd, int options)
|
||||
{
|
||||
REQUIRE_PROMISE(recvfd);
|
||||
auto socket_description = file_description(sockfd);
|
||||
|
@ -74,7 +74,11 @@ int Process::sys$recvfd(int sockfd)
|
|||
if (received_descriptor_or_error.is_error())
|
||||
return received_descriptor_or_error.error();
|
||||
|
||||
m_fds[new_fd].set(*received_descriptor_or_error.value(), 0);
|
||||
u32 fd_flags = 0;
|
||||
if (options & O_CLOEXEC)
|
||||
fd_flags |= FD_CLOEXEC;
|
||||
|
||||
m_fds[new_fd].set(*received_descriptor_or_error.value(), fd_flags);
|
||||
return new_fd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue