From nobody Sun Jan 25 15:56:59 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dzbrr19d9z6PjVH for ; Sun, 25 Jan 2026 15:57:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dzbrq5ZNlz48Tr for ; Sun, 25 Jan 2026 15:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769356619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Y50ss/fxiDpsc5ATOUMNI8cfT2hnhCXul1FLuVORkc=; b=femAo4ZOtT8g9Nc8+L/csHIHmkD0ka4k+ui07I43puAkNc/bIeLy2FgQWrSGnT/dPxkyxV rp6o7C6pxsxT3quYH7t3Sk3bZw5aMOOqzS/nhlL2vFBW1ooUNF051FibjQEQNIEaxIlQVr NLV/Ul6zzcXwWWjIlCZR/8dkHGLPQo2bAQ2m8VF2wF8dYpMnwXpV4y3pzjoRpm/k2AM73L 3ffJVuVkPsxJi/fjYwVgeaR+1nWIBF2j+5OU+plbjW4AIewxtn98u8p9E4XxyDdebkuJ00 w7G/hm9O5MqTFSu4RzDPZufHzgJxoRPWhPcPghU3ggORii2A7djio8ARZ2Myow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769356619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Y50ss/fxiDpsc5ATOUMNI8cfT2hnhCXul1FLuVORkc=; b=HgItj7g9PyAp6j4LmL42DlYQeUHv7UmLcFBRRfXeGr+v7Oq1bSD+/bEw7T+km8wcmDTcDA Yqi/kNtCscBDNhuM2KHpsqzdluTjmv/MmU3m5I3ysePzx3H5QB8Ys5CDWquH8K6CszKWxf fjkduJOJLZKla6oA59JHK9dgdm5fk0r+/u0l2gvqq4eXC2Dn4y7OqXd+B390ZLUPMG7n3r kR9ueyH+uPPDy9MyYAvx525qWW656q3NOFF1aL9TU8AoLfPM910Hpc6x6TapvUNi0tSlWs 7nx0xBP57xr8Cko/X55YJXho5DxSJ3Ka2Fl0AoG1LraZ2YzCjoeLUKBwWlqgTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1769356619; a=rsa-sha256; cv=none; b=kPfM/y5WhYEBsbsFSxN5RQa8oT4i1+UB1WoDB+zOaVdLmoD5dWS+urM+Et/3t74FJyOb4o YXTjmQY4mxB9CeZ3rpz2G76T7Fvk68EY+RlBHu2NE71p0RvNvQPu5EO4n8U0lmPmXOe8uY M3G1mGnfb47n9+IZbcqGY6T7+YwYoXvEDRCDCvVf66/zf8YOmQkatYGZhVuZac+iViJlcW 3+HQeI5J+F4t0ek798rLWL5+jdPCwMRp9q1MgmxkpPWU08hCCDuzPsg3figVuXRhPikaVr zvdzk6A3qSX2/mKCTSH6fsuhnjvXFvuNw8X23mERqlsx40Avx1KEjTQe6EA7WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dzbrq56NPzh3V for ; Sun, 25 Jan 2026 15:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32d4a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 25 Jan 2026 15:56:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2d555ec85a71 - main - lib/libsys, lib/libc: export pdwait List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d555ec85a716e016be587b2a1606ca69267f870 Auto-Submitted: auto-generated Date: Sun, 25 Jan 2026 15:56:59 +0000 Message-Id: <69763d4b.32d4a.643cc800@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2d555ec85a716e016be587b2a1606ca69267f870 commit 2d555ec85a716e016be587b2a1606ca69267f870 Author: Konstantin Belousov AuthorDate: 2026-01-08 03:49:33 +0000 Commit: Konstantin Belousov CommitDate: 2026-01-25 15:54:08 +0000 lib/libsys, lib/libc: export pdwait Make pdwait(2) cancellable, same as all other wait*(2) syscalls wrappers. Reviewed by: asomers, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54592 --- lib/libc/include/libc_private.h | 1 + lib/libc/sys/Symbol.map | 4 ++++ lib/libc/sys/pdwait.c | 20 ++++++++++++++++++++ lib/libsys/Makefile.sys | 1 + lib/libsys/interposing_table.c | 1 + lib/libthr/thread/thr_syscalls.c | 15 +++++++++++++++ sys/sys/procdesc.h | 4 ++++ 7 files changed, 46 insertions(+) diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index db4cbc32be35..299629fce2ad 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -252,6 +252,7 @@ enum { INTERPOS__reserved0, /* was distribute_static_tls */ INTERPOS_pdfork, INTERPOS_uexterr_gettext, + INTERPOS_pdwait, INTERPOS_MAX }; diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 32b1b0ecee05..8acffcfd714e 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -71,3 +71,7 @@ FBSD_1.6 { FBSD_1.7 { _Fork; }; + +FBSD_1.9 { + pdwait; +}; diff --git a/lib/libc/sys/pdwait.c b/lib/libc/sys/pdwait.c new file mode 100644 index 000000000000..89d43b7fca2e --- /dev/null +++ b/lib/libc/sys/pdwait.c @@ -0,0 +1,20 @@ +/* + * Copyright 2026 The FreeBSD Foundation. + * + * SPDX-License-Identifier: BSD-2-Clause + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + */ + +#include +#include +#include "libc_private.h" + +#pragma weak pdwait +int +pdwait(int fd, int *status, int options, struct __wrusage *ru, + struct __siginfo *infop) +{ + return (INTERPOS_SYS(pdwait, fd, status, options, ru, infop)); +} diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index 5f149170b974..4e70faec1167 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -73,6 +73,7 @@ INTERPOSED = \ open \ openat \ pdfork \ + pdwait \ poll \ ppoll \ pselect \ diff --git a/lib/libsys/interposing_table.c b/lib/libsys/interposing_table.c index 31cdb1511ab8..0151364f89d2 100644 --- a/lib/libsys/interposing_table.c +++ b/lib/libsys/interposing_table.c @@ -72,6 +72,7 @@ static interpos_func_t __libsys_interposing[INTERPOS_MAX] = { SLOT(fdatasync, __sys_fdatasync), SLOT(clock_nanosleep, __sys_clock_nanosleep), SLOT(pdfork, __sys_pdfork), + SLOT(pdwait, __sys_pdwait), }; #undef SLOT diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index 188374a30070..bff2d0624aee 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -584,6 +584,20 @@ __thr_wait6(idtype_t idtype, id_t id, int *status, int options, return (ret); } +static pid_t +__thr_pdwait(int fd, int *status, int options, struct __wrusage *ru, + siginfo_t *infop) +{ + struct pthread *curthread; + pid_t ret; + + curthread = _get_curthread(); + _thr_cancel_enter(curthread); + ret = __sys_pdwait(fd, status, options, ru, infop); + _thr_cancel_leave(curthread, ret == -1); + return (ret); +} + /* * Cancellation behavior: * Thread may be canceled at start, but if the thread wrote some data, @@ -685,6 +699,7 @@ __thr_interpose_libc(void) SLOT(clock_nanosleep); SLOT(pdfork); SLOT(uexterr_gettext); + SLOT(pdwait); #undef SLOT *(__libc_interposing_slot( INTERPOS__pthread_mutex_init_calloc_cb)) = diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index 6ce6c9f81de1..6a9168b04a68 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -122,10 +122,14 @@ struct rusage; * Process descriptor system calls. */ __BEGIN_DECLS +struct __wrusage; +struct __siginfo; + pid_t pdfork(int *, int); pid_t pdrfork(int *, int, int); int pdkill(int, int); int pdgetpid(int, pid_t *); +int pdwait(int, int *, int, struct __wrusage *, struct __siginfo *); __END_DECLS #endif /* _KERNEL */