git: 30d759067be9 - main - pdwait(2): add user_pdwait
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 11:01:55 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=30d759067be91e3f74b98f537512eb5030c89e57
commit 30d759067be91e3f74b98f537512eb5030c89e57
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-12 11:01:30 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-12 11:01:30 +0000
pdwait(2): add user_pdwait
Effort: CHERI upstreaming
Sponsored by: DARPA, AFRL
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/kern/kern_exit.c | 32 +++++++++++++++++++++-----------
sys/sys/syscallsubr.h | 2 ++
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index f4d7d50c7d23..939b5fe51638 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -968,11 +968,8 @@ user_wait6(struct thread *td, idtype_t idtype, id_t id, int *statusp,
int
sys_pdwait(struct thread *td, struct pdwait_args *uap)
{
- struct __wrusage wru, *wrup;
siginfo_t si, *sip;
- int error, status;
-
- wrup = uap->wrusage != NULL ? &wru : NULL;
+ int error;
if (uap->info != NULL) {
sip = &si;
@@ -980,18 +977,31 @@ sys_pdwait(struct thread *td, struct pdwait_args *uap)
} else {
sip = NULL;
}
-
- error = kern_pdwait(td, uap->fd, &status, uap->options, wrup, sip);
-
- if (uap->status != NULL && error == 0)
- error = copyout(&status, uap->status, sizeof(status));
- if (uap->wrusage != NULL && error == 0)
- error = copyout(&wru, uap->wrusage, sizeof(wru));
+ error = user_pdwait(td, uap->fd, uap->status, uap->options,
+ uap->wrusage, sip);
if (uap->info != NULL && error == 0)
error = copyout(&si, uap->info, sizeof(si));
return (error);
}
+int
+user_pdwait(struct thread *td, int fd, int *statusp, int options,
+ struct __wrusage *wrusage, siginfo_t *sip)
+{
+ struct __wrusage wru, *wrup;
+ int error, status;
+
+ wrup = wrusage != NULL ? &wru : NULL;
+
+ error = kern_pdwait(td, fd, &status, options, wrup, sip);
+
+ if (statusp != NULL && error == 0)
+ error = copyout(&status, statusp, sizeof(status));
+ if (wrusage != NULL && error == 0)
+ error = copyout(&wru, wrusage, sizeof(wru));
+ return (error);
+}
+
/*
* Reap the remains of a zombie process and optionally return status and
* rusage. Asserts and will release both the proctree_lock and the process
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 1cda115cf738..f098ee5ed750 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -659,6 +659,8 @@ int user_jail_set(struct thread *td, struct iovec *iovp,
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f);
int user_kldload(struct thread *td, const char *file);
int user_pdgetpid(struct thread *td, int fd, pid_t *pidp);
+int user_pdwait(struct thread *td, int fd, int *statusp, int options,
+ struct __wrusage *wrusage, siginfo_t *sip);
int user_poll(struct thread *td, struct pollfd *fds, u_int nfds,
int timeout);
int user_ppoll(struct thread *td, struct pollfd *fds, u_int nfds,