From cf58d2cc93ed8fae32c8a3fa4d54102473425a16 Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 26 Oct 2022 23:16:24 +0000 Subject: [PATCH] Add waitid(2) syscall stub. Minor bump to both libc and libpthread: make sure you install a new kernel! ok millert@, deraadt@ --- lib/libc/Symbols.list | 2 ++ lib/libc/hidden/sys/wait.h | 3 ++- lib/libc/shlib_version | 2 +- lib/libc/sys/Makefile.inc | 4 ++-- lib/libc/sys/w_waitid.c | 31 +++++++++++++++++++++++++++++++ lib/librthread/shlib_version | 2 +- 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 lib/libc/sys/w_waitid.c diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list index d95c3f5c769..58c747697a9 100644 --- a/lib/libc/Symbols.list +++ b/lib/libc/Symbols.list @@ -240,6 +240,7 @@ _thread_sys_utimes _thread_sys_utrace _thread_sys_vfork _thread_sys_wait4 +_thread_sys_waitid _thread_sys_write _thread_sys_writev accept4 @@ -448,6 +449,7 @@ utimes utrace vfork wait4 +waitid write writev diff --git a/lib/libc/hidden/sys/wait.h b/lib/libc/hidden/sys/wait.h index b73d383220b..a8323d3c227 100644 --- a/lib/libc/hidden/sys/wait.h +++ b/lib/libc/hidden/sys/wait.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wait.h,v 1.2 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: wait.h,v 1.3 2022/10/26 23:16:24 kettenis Exp $ */ /* * Copyright (c) 2015 Philip Guenther * @@ -24,5 +24,6 @@ PROTO_DEPRECATED(wait); PROTO_NORMAL(waitpid); PROTO_DEPRECATED(wait3); PROTO_CANCEL(wait4); +PROTO_CANCEL(waitid); #endif /* !_LIBC_SYS_WAIT_H_ */ diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version index 7a1bc8e113e..9da1fafdd94 100644 --- a/lib/libc/shlib_version +++ b/lib/libc/shlib_version @@ -1,4 +1,4 @@ major=96 -minor=3 +minor=4 # note: If changes were made to include/thread_private.h or if system calls # were added/changed then librthread/shlib_version must also be updated. diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 16817039ee6..3a7faf2bda0 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.165 2022/10/07 15:21:04 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.166 2022/10/26 23:16:24 kettenis Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -36,7 +36,7 @@ CANCEL= accept accept4 \ poll ppoll pread preadv pselect pwrite pwritev \ read readv recvfrom recvmmsg recvmsg \ select sendmmsg sendmsg sendto \ - wait4 write writev + wait4 waitid write writev SRCS+= ${CANCEL:%=w_%.c} # modules with default implementations on all architectures, unless overridden diff --git a/lib/libc/sys/w_waitid.c b/lib/libc/sys/w_waitid.c new file mode 100644 index 00000000000..5aebd3ff36d --- /dev/null +++ b/lib/libc/sys/w_waitid.c @@ -0,0 +1,31 @@ +/* $OpenBSD: w_waitid.c,v 1.1 2022/10/26 23:16:24 kettenis Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include "cancel.h" + +int +waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) +{ + int ret; + + ENTER_CANCEL_POINT(1); + ret = HIDDEN(waitid)(idtype, id, info, options); + LEAVE_CANCEL_POINT(ret <= 0); + return (ret); +} +DEF_CANCEL(waitid); diff --git a/lib/librthread/shlib_version b/lib/librthread/shlib_version index 34aa186fe47..68cb9e8a964 100644 --- a/lib/librthread/shlib_version +++ b/lib/librthread/shlib_version @@ -1,2 +1,2 @@ major=26 -minor=2 +minor=3 -- 2.20.1