From nobody Sun Jul 23 11:45:29 2023 X-Original-To: dev-commits-src-branches@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 4R81gt4hk3z4p7M3; Sun, 23 Jul 2023 11:45:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R81gt2j2Tz4D2J; Sun, 23 Jul 2023 11:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690112730; 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=HU0Om8ZCyfmW6bO4c4rTAVk1EpLpAGfYa88Y+ScCKRE=; b=fAAd8ONdBCX0D3OhwE7PAuZl0Sg1d9wD5RXhcQWEFpCet+JA9/0B6Yu6S/DUwIyPZeXV2G DokTko0gJ3Iekg4Vcd3zec0eGSzvYFODPEQcE23wwnn5kGewHcL1xGHOvHk0+HWJHRgv8G jcd2KjM5s88wIQ9eKlcc5QxLXnP7lbapk+gtyuMjx3lPZcM+XD7KdW1h9WTSNQ4DmPRd7a 0zG9JzY2wgTXOaDYO40yQ9LzFEIFe7oMNg16gsvdHH74wcg8h/ASmnRmkm/d38bCkKnFYm m5HiMblMATRFffNNJTizsn8caeJVqHwMbAqymDeR68hryXLYXGZu8y/IwxFf6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690112730; 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=HU0Om8ZCyfmW6bO4c4rTAVk1EpLpAGfYa88Y+ScCKRE=; b=OdBBaqFojaDUZaV2+bistzwFCfx8/3E2izvqK+jJghPwq+gx5vr58PAiZ88dqbj2267LKD kbtoPkID4dD1ZajvY5/iP9J5aVGpOuLtVWUVkiJIuDijb5THYRymOX39vTi52mxuH0BlHR Dwtu+hl+wU74uDU0txAdVZXFmWjoeBBaMcOlqBQayvFlzrJkavBNRA2YZCa0ClSBqwBhQY Y4669lDyTBbFWjSzDwN0wAV2VID16D4LoDyrG9QECvclXY06gKz1T4cWp6LIekyvYZoFiA Er61gLeWiZXqVAYz4M9axoBVyQByK4ZS6BqKS6cWyQ+GJXvMhIogUjvLNaBIQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690112730; a=rsa-sha256; cv=none; b=cG3kLb7XalC/lB5LPPSIspm4ucMlHYp2cAeCFLQFQSO48pqX2HyXaL/LHCXdPy0+X8/ne5 nkn7Ngpvc9ueyU9qLYj+tNPCodMK+2jFAIEXksvUZi9iEljK4DOYzm2TzXK0pfNVnJzLyy UXSDGepwGHC4TW3PqelXDvJuCJI60iBFahf1KqsvUvAzaJwJyQSifcS6qZvtSKlV7/9GZv g8aUmrAK/BnMxDvMdqlF+PZp/PGVkR1IzFNN8e7ywYM0U54dBZzzqUJakPePETkDBOvINN 795pPx6tKI5cP2Z7Zu5yA/MGnxvskuDV5d688oCPtedXtIzH1NMMJkr9OkUb3w== 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 4R81gt09BhzbTN; Sun, 23 Jul 2023 11:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36NBjTvX096132; Sun, 23 Jul 2023 11:45:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36NBjTHK096131; Sun, 23 Jul 2023 11:45:29 GMT (envelope-from git) Date: Sun, 23 Jul 2023 11:45:29 GMT Message-Id: <202307231145.36NBjTHK096131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b1be52209c42 - stable/13 - libthr: trigger library initialization on rwlock calls List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: b1be52209c4237140d0755e1d7d3263ffc3543d2 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b1be52209c4237140d0755e1d7d3263ffc3543d2 commit b1be52209c4237140d0755e1d7d3263ffc3543d2 Author: Konstantin Belousov AuthorDate: 2023-07-13 15:56:11 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-23 11:44:24 +0000 libthr: trigger library initialization on rwlock calls (cherry picked from commit ad056b5d35d9957b1bd023abeb6461601449b725) --- lib/libthr/thread/thr_rwlock.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c index ab10431b9d41..a61eb35cbd31 100644 --- a/lib/libthr/thread/thr_rwlock.c +++ b/lib/libthr/thread/thr_rwlock.c @@ -163,6 +163,7 @@ int _thr_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { + _thr_check_init(); *rwlock = NULL; return (rwlock_init(rwlock, attr)); } @@ -231,6 +232,7 @@ rwlock_rdlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime) int _Tthr_rwlock_rdlock(pthread_rwlock_t *rwlock) { + _thr_check_init(); return (rwlock_rdlock_common(rwlock, NULL)); } @@ -238,21 +240,24 @@ int _pthread_rwlock_timedrdlock(pthread_rwlock_t * __restrict rwlock, const struct timespec * __restrict abstime) { + _thr_check_init(); return (rwlock_rdlock_common(rwlock, abstime)); } int _Tthr_rwlock_tryrdlock(pthread_rwlock_t *rwlock) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; pthread_rwlock_t prwlock; int flags; int ret; + _thr_check_init(); ret = check_and_init_rwlock(rwlock, &prwlock); if (ret != 0) return (ret); + curthread = _get_curthread(); if (curthread->rdlock_count) { /* * To avoid having to track all the rdlocks held by @@ -280,14 +285,16 @@ _Tthr_rwlock_tryrdlock(pthread_rwlock_t *rwlock) int _Tthr_rwlock_trywrlock(pthread_rwlock_t *rwlock) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; pthread_rwlock_t prwlock; int ret; + _thr_check_init(); ret = check_and_init_rwlock(rwlock, &prwlock); if (ret != 0) return (ret); + curthread = _get_curthread(); ret = _thr_rwlock_trywrlock(&prwlock->lock); if (ret == 0) prwlock->owner = TID(curthread); @@ -343,6 +350,7 @@ rwlock_wrlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime) int _Tthr_rwlock_wrlock(pthread_rwlock_t *rwlock) { + _thr_check_init(); return (rwlock_wrlock_common(rwlock, NULL)); } @@ -350,6 +358,7 @@ int _pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict rwlock, const struct timespec * __restrict abstime) { + _thr_check_init(); return (rwlock_wrlock_common(rwlock, abstime)); }