From nobody Thu Nov 14 02:49:14 2024 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 4Xpl3Z2xzyz5cxnG; Thu, 14 Nov 2024 02:49:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xpl3Z2SCWz4Clp; Thu, 14 Nov 2024 02:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731552554; 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=pQBNGmwxDpCgqsoQ1m/ijgMBqD1Susbri0gV0fSZH0g=; b=xpWNIMs9tMeNhJtQOCIkwEj36r3UNTLZde3CLp0gYmdQF7bbHhu4GEdif/o47NB0D8N9eQ 8m+oUHo259x4it9b3oOeBm1wo2a+5ZS+zHpzbgEoAD/77dh4BwSwxLxRMEbTgUyoj6+Zqp +9St5sq546mBu6R/fT5Jy5rz1Rg18uxu47h+4osWRIfNi49G6B6FBsj2qnTeozoZmWsEeU VBhkZgszyPbPfAFzJu3QnnSSXrI1g4v2rIBgeWeIKtiof4IT01HE3DnfwXoWdEBNVb/LVQ u+PVd6lIimtoPGMk9wvaszw7Ao21GwDcynqWM2FIX2zE4gapz6QzYC0XQM3H7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731552554; 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=pQBNGmwxDpCgqsoQ1m/ijgMBqD1Susbri0gV0fSZH0g=; b=n6sW4qbD2AcXp8b6HiKt3bGIGNp+h1WPsdLIzUlz6EnZmjkdFE1URU9qQ4ktgvrHVbRRnB YaKG9lvYei+vJItntQL/pVB+SZuaPVRFfZ7DB0DcM6h046R4ZX2ZZlXBheZXe6IVAra/Pn A7TUo70IGUeNF4dCwwMTvzmCQaypPcqnkoE9KySUXnxU2BKjTsIMUQeBt8rjQ9vbkVzKBD RigHbD/ALzbfgwY73XJnEl1Hftc97uyrlBYE6YngjIEU2hWE0EZugKJV1SHeXEzT9gmjVb ImB8H0ECfP4VwooGKURogKweaHfgE0iSKXHzNuDUc732XqoUq7FzqeZd2VL01Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731552554; a=rsa-sha256; cv=none; b=dP8hgiI0f3bxrX2VFio1e159wSSAtrYsW9YSeg++bVSGlvLC+QrAMGQej0FzNg5jt/9hxF we9Xgd8ZNAHX1LDRg2J13uu+aiL6Rz7CoXx8b81BG7ZiBwY6UfoYM7136uAtw6cvXh08dy Ml8cJeAyiQgtLyLMYGfsGWYx+QQ6Qp8NwJ1pyeT4CiDZcMm4ryb2xRHKQgjj2xEKPJAwUa /ZqMXrBjRG00xjAy7ROj47XeEQbT/wkK3Z2c/hEg/h/HsGuTyo9qQiLA4BXqqdPgRFz3Jj dOKxeVlo4oSgocBLQj33jT6eTdq3iP/2m2c1H2RE33SMQxVOHW6KPdivGfToKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xpl3Z1lBKzLXW; Thu, 14 Nov 2024 02:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AE2nEVs049811; Thu, 14 Nov 2024 02:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AE2nE1I049808; Thu, 14 Nov 2024 02:49:14 GMT (envelope-from git) Date: Thu, 14 Nov 2024 02:49:14 GMT Message-Id: <202411140249.4AE2nE1I049808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 83aafcdc8892 - main - libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83aafcdc88928c99e80b04ead23a156e235f9af4 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=83aafcdc88928c99e80b04ead23a156e235f9af4 commit 83aafcdc88928c99e80b04ead23a156e235f9af4 Author: Kyle Evans AuthorDate: 2024-11-14 02:48:02 +0000 Commit: Kyle Evans CommitDate: 2024-11-14 02:48:05 +0000 libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np If libthr isn't linked into the process, then we don't have any pthreads to worry about and our stubs can just return success -- there are none to suspend/resume. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D47350 --- lib/libc/gen/Symbol.map | 2 ++ lib/libc/gen/_pthread_stubs.c | 4 ++++ lib/libc/include/libc_private.h | 2 ++ lib/libthr/thread/thr_init.c | 2 ++ lib/libthr/thread/thr_private.h | 2 ++ lib/libthr/thread/thr_resume_np.c | 5 +++-- lib/libthr/thread/thr_suspend_np.c | 5 +++-- 7 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 4f77023dad72..ca3974e6b747 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -47,6 +47,7 @@ FBSD_1.0 { pthread_mutexattr_init; pthread_mutexattr_settype; pthread_once; + pthread_resume_all_np; pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock; @@ -59,6 +60,7 @@ FBSD_1.0 { pthread_setcanceltype; pthread_setspecific; pthread_sigmask; + pthread_suspend_all_np; pthread_testcancel; alarm; arc4random; diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c index a8723bbe72be..9df9ec9b8599 100644 --- a/lib/libc/gen/_pthread_stubs.c +++ b/lib/libc/gen/_pthread_stubs.c @@ -132,6 +132,8 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = { [PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)}, [PJT_ATTR_GET_NP] = {PJT_DUAL_ENTRY(stub_esrch)}, [PJT_GETNAME_NP] = {PJT_DUAL_ENTRY(stub_getname_np)}, + [PJT_SUSPEND_ALL_NP] = {PJT_DUAL_ENTRY(stub_null)}, + [PJT_RESUME_ALL_NP] = {PJT_DUAL_ENTRY(stub_null)}, }; /* @@ -291,6 +293,8 @@ STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) STUB_FUNC2(pthread_attr_get_np, PJT_ATTR_GET_NP, int, pthread_t, pthread_attr_t *) STUB_FUNC3(pthread_getname_np, PJT_GETNAME_NP, int, pthread_t, char *, size_t) +STUB_FUNC(pthread_suspend_all_np, PJT_SUSPEND_ALL_NP, void); +STUB_FUNC(pthread_resume_all_np, PJT_RESUME_ALL_NP, void); static int stub_zero(void) diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 4d4779647f50..4c244f962b2b 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -187,6 +187,8 @@ typedef enum { PJT_GETTHREADID_NP, PJT_ATTR_GET_NP, PJT_GETNAME_NP, + PJT_SUSPEND_ALL_NP, + PJT_RESUME_ALL_NP, PJT_MAX } pjt_index_t; diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index ff59288d919e..708c425d69c1 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -271,6 +271,8 @@ static pthread_func_t jmp_table[][2] = { [PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)}, [PJT_ATTR_GET_NP] = {DUAL_ENTRY(_thr_attr_get_np)}, [PJT_GETNAME_NP] = {DUAL_ENTRY(_thr_getname_np)}, + [PJT_SUSPEND_ALL_NP] = {DUAL_ENTRY(_thr_suspend_all_np)}, + [PJT_RESUME_ALL_NP] = {DUAL_ENTRY(_thr_resume_all_np)}, }; static int init_once = 0; diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 023558100e2a..d6c12348e3ab 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -840,6 +840,8 @@ void _thr_signal_postfork(void) __hidden; void _thr_signal_postfork_child(void) __hidden; void _thr_suspend_all_lock(struct pthread *) __hidden; void _thr_suspend_all_unlock(struct pthread *) __hidden; +void _thr_suspend_all_np(void) __hidden; +void _thr_resume_all_np(void) __hidden; void _thr_try_gc(struct pthread *, struct pthread *) __hidden; int _rtp_to_schedparam(const struct rtprio *rtp, int *policy, struct sched_param *param) __hidden; diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c index 1e69bfa7358b..c5669fd4f0ff 100644 --- a/lib/libthr/thread/thr_resume_np.c +++ b/lib/libthr/thread/thr_resume_np.c @@ -38,7 +38,8 @@ #include "thr_private.h" __weak_reference(_pthread_resume_np, pthread_resume_np); -__weak_reference(_pthread_resume_all_np, pthread_resume_all_np); +__weak_reference(_thr_resume_all_np, pthread_resume_all_np); +__weak_reference(_thr_resume_all_np, _pthread_resume_all_np); static void resume_common(struct pthread *thread); @@ -59,7 +60,7 @@ _pthread_resume_np(pthread_t thread) } void -_pthread_resume_all_np(void) +_thr_resume_all_np(void) { struct pthread *curthread = _get_curthread(); struct pthread *thread; diff --git a/lib/libthr/thread/thr_suspend_np.c b/lib/libthr/thread/thr_suspend_np.c index b272c7b2a169..cf4e9e8a96b1 100644 --- a/lib/libthr/thread/thr_suspend_np.c +++ b/lib/libthr/thread/thr_suspend_np.c @@ -41,7 +41,8 @@ static int suspend_common(struct pthread *, struct pthread *, int); __weak_reference(_pthread_suspend_np, pthread_suspend_np); -__weak_reference(_pthread_suspend_all_np, pthread_suspend_all_np); +__weak_reference(_thr_suspend_all_np, pthread_suspend_all_np); +__weak_reference(_thr_suspend_all_np, _pthread_suspend_all_np); /* Suspend a thread: */ int @@ -101,7 +102,7 @@ _thr_suspend_all_unlock(struct pthread *curthread) } void -_pthread_suspend_all_np(void) +_thr_suspend_all_np(void) { struct pthread *curthread = _get_curthread(); struct pthread *thread;