git: 1b2f03fe94ef - main - pipe2(2): add kern_pipe2
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Nov 2026 13:20:59 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=1b2f03fe94ef4a1680a77db825b4471e9181b43b
commit 1b2f03fe94ef4a1680a77db825b4471e9181b43b
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-11-24 17:53:30 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-11 13:14:42 +0000
pipe2(2): add kern_pipe2
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/kern/sys_pipe.c | 12 +++++++++---
sys/sys/syscallsubr.h | 1 +
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index e928de1cd776..d89773cb8631 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -540,15 +540,21 @@ freebsd10_pipe(struct thread *td, struct freebsd10_pipe_args *uap __unused)
int
sys_pipe2(struct thread *td, struct pipe2_args *uap)
+{
+ return (kern_pipe2(td, uap->fildes, uap->flags));
+}
+
+int
+kern_pipe2(struct thread *td, int *ufildes, int flags)
{
int error, fildes[2];
- if ((uap->flags & ~(O_CLOEXEC | O_CLOFORK | O_NONBLOCK)) != 0)
+ if ((flags & ~(O_CLOEXEC | O_CLOFORK | O_NONBLOCK)) != 0)
return (EINVAL);
- error = kern_pipe(td, fildes, uap->flags, NULL, NULL);
+ error = kern_pipe(td, fildes, flags, NULL, NULL);
if (error)
return (error);
- error = copyout(fildes, uap->fildes, 2 * sizeof(int));
+ error = copyout(fildes, ufildes, 2 * sizeof(int));
if (error) {
(void)kern_close(td, fildes[0]);
(void)kern_close(td, fildes[1]);
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 674a864449ab..084f48f75b26 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -378,6 +378,7 @@ int kern_pathconf(struct thread *td, const char *path,
int kern_pdfork(struct thread *td, int *fdp, int flags);
int kern_pipe(struct thread *td, int fildes[2], int flags,
struct filecaps *fcaps1, struct filecaps *fcaps2);
+int kern_pipe2(struct thread *td, int *ufildes, int flags);
int kern_poll(struct thread *td, struct pollfd *fds, u_int nfds,
struct timespec *tsp, sigset_t *uset);
int kern_poll_kfds(struct thread *td, struct pollfd *fds, u_int nfds,