Date: Sun, 01 Feb 2026 21:40:54 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7659f33149d6 - stable/15 - kern/kern_exit.c: define the exterror category for exit/wait Message-ID: <697fc866.3d93f.1f03f561@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7659f33149d60c34dc579c01e781d09dc14ed814 commit 7659f33149d60c34dc579c01e781d09dc14ed814 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-01-08 04:03:51 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-02-01 21:38:48 +0000 kern/kern_exit.c: define the exterror category for exit/wait (cherry picked from commit 109b9f48ec4e26e12ab5765747f3d5156aa62406) --- sys/kern/kern_exit.c | 39 +++++++++++++++++++++++++-------------- sys/sys/exterr_cat.h | 1 + 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 5398eaca2a80..60e7a9da9f8b 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -37,10 +37,12 @@ #include "opt_ddb.h" #include "opt_ktrace.h" +#define EXTERR_CATEGORY EXTERR_CAT_PROCEXIT #include <sys/systm.h> #include <sys/acct.h> /* for acct_process() function prototype */ #include <sys/capsicum.h> #include <sys/eventhandler.h> +#include <sys/exterrvar.h> #include <sys/filedesc.h> #include <sys/jail.h> #include <sys/kernel.h> @@ -1269,6 +1271,26 @@ report_alive_proc(struct thread *td, struct proc *p, siginfo_t *siginfo, PROC_UNLOCK(p); } +static int +wait6_checkopt(int options) +{ + /* If we don't know the option, just return. */ + if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT | + WEXITED | WTRAPPED | WLINUXCLONE)) != 0) + return (EXTERROR(EINVAL, "Unknown options %#jx", options)); + if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) { + /* + * We will be unable to find any matching processes, + * because there are no known events to look for. + * Prefer to return error instead of blocking + * indefinitely. + */ + return (EXTERROR(EINVAL, + "Cannot match processes %#jx", options)); + } + return (0); +} + int kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *siginfo) @@ -1291,20 +1313,9 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status, idtype = P_PGID; } - /* If we don't know the option, just return. */ - if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT | - WEXITED | WTRAPPED | WLINUXCLONE)) != 0) - return (EINVAL); - if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) { - /* - * We will be unable to find any matching processes, - * because there are no known events to look for. - * Prefer to return error instead of blocking - * indefinitely. - */ - return (EINVAL); - } - + error = wait6_checkopt(options); + if (error != 0) + return (error); loop: if (q->p_flag & P_STATCHILD) { PROC_LOCK(q); diff --git a/sys/sys/exterr_cat.h b/sys/sys/exterr_cat.h index daf0419754b7..015eb6a1ae76 100644 --- a/sys/sys/exterr_cat.h +++ b/sys/sys/exterr_cat.h @@ -38,6 +38,7 @@ #define EXTERR_CAT_FUSE_VFS 13 #define EXTERR_CAT_FUSE_DEVICE 14 #define EXTERR_CAT_FORK 15 +#define EXTERR_CAT_PROCEXIT 16 #endifhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?697fc866.3d93f.1f03f561>
