1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

Kernel+LibC: Support passing O_CLOEXEC to pipe()

In the userspace, this mimics the Linux pipe2() syscall;
in the kernel, the Process::sys$pipe() now always accepts
a flags argument, the no-argument pipe() syscall is now a
userspace wrapper over pipe2().
This commit is contained in:
Sergey Bugaev 2019-08-05 15:29:05 +03:00 committed by Andreas Kling
parent 55d7810fab
commit 9c3b1ca0c6
5 changed files with 17 additions and 6 deletions

View file

@ -366,7 +366,12 @@ int getgroups(int size, gid_t list[])
int pipe(int pipefd[2])
{
int rc = syscall(SC_pipe, pipefd);
return pipe2(pipefd, 0);
}
int pipe2(int pipefd[2], int flags)
{
int rc = syscall(SC_pipe, pipefd, flags);
__RETURN_WITH_ERRNO(rc, rc, -1);
}

View file

@ -86,6 +86,7 @@ int getdtablesize();
int dup(int old_fd);
int dup2(int old_fd, int new_fd);
int pipe(int pipefd[2]);
int pipe2(int pipefd[2], int flags);
unsigned int alarm(unsigned int seconds);
int access(const char* pathname, int mode);
int isatty(int fd);