From nobody Sun Sep 04 05:10:56 2022 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 4ML09D5kD1z4bSsZ; Sun, 4 Sep 2022 05:10:56 +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 4ML09D597Zz3lGY; Sun, 4 Sep 2022 05:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662268256; 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=/LnnAYnDAGvrRDkAjR6RFCXSq7S1OvKKy0ojObOI0BI=; b=JTj5HKcq7qTkIgRDvi1YzjvD1WLT+euJ7Z58JJo2p0ZYOsade44NU8NvFIHNEo2WWjVX4y jmtZmCbVNY60VU2EQg7wnQeRrEtMx0KHLZCfDqWRciFyhai53EvS/0hzTCf2rEtbrLcMmc mXD3wHLrGJ/PfwO3mYF6yEbR2cGSpsve/Hrco+8i0nZnD65Dm7Ds3kspCU4BkiUsK8S9DS 3De2o1RB39t0bJ82h7ZiS1zbZPqndtR7MPTCAq1aAaYgmKNEIya8QztB5pibKcRsrIZXfa 1huuFNx/mMkYEILfTpQOcc7t+yETXcQXxtEVvSQ3QCGsJXv5PZU0ezyQEHz7Jw== 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 4ML09D49hmzNlc; Sun, 4 Sep 2022 05:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2845AuXd082367; Sun, 4 Sep 2022 05:10:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2845AuMs082366; Sun, 4 Sep 2022 05:10:56 GMT (envelope-from git) Date: Sun, 4 Sep 2022 05:10:56 GMT Message-Id: <202209040510.2845AuMs082366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7444f54bd326 - main - rtld: style the rest of rtld_lock.c 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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: 7444f54bd326780ffafc0fec8ef49cad3e13baef Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662268256; 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=/LnnAYnDAGvrRDkAjR6RFCXSq7S1OvKKy0ojObOI0BI=; b=CJt80VhKTs/n5Amkmt4Hi9Wrn06BJQcOl//39d5+MYSs3Jr865upQapCBavhdSksDAZqqY hv8YpDR1YF2lJO1Rbsj20+vOzQC5i/jH0CTXBxGAVb3MXgyMNJqKHRmDtvfMXV1VID+NpQ 10aRGiXXdFaJ5it+WGYCGQztEjQm2cEblx2EwkGDS2oMwGT6kjFdjgHEsQHQffsAuMhsIU qntfJGFGoGclmRN22K9TXFfSX6p9g9CqBFbR5fUO0r+Ej6BEd5TWZlmi9/4Sn5EhwmZSHk z2vXDqK86uuJrcTd6xcOhcIJ13Z3+e5thiqIT222dUZJB/8p649NZGEc3WT6Cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662268256; a=rsa-sha256; cv=none; b=QRDinqhjH1ttyQ3k+Iy8OkQ6tKvVg9DPlLBzc4tDbipVydNqsigfhzFL1XQb198BD3AOg+ ZV+sIYfyORJ9pv0+Oc/7JxJDydqjITu/5mkdeXZ8zcw0HI4DwguIzQvsy14iFfQIWyrD5y XpW6i+gKwXE6uyJNSpnczeiwQ0QP5Feq7U2/uVCoLEPtt1KyGkgfCBfv/p/+Z8iKHxIeKs aXYUXT6S2kaAOPvO28Q24VoPUZ96D5JcvGpYaGdBMXMItR73NKK0/PPx/KDILetXWPwdi3 +r0jUTfDuAJ7wnN+NntnpOUiPMiBHx9lkBGh5pnlb1mVgnFNPC4Ala1/DO2puQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7444f54bd326780ffafc0fec8ef49cad3e13baef commit 7444f54bd326780ffafc0fec8ef49cad3e13baef Author: Konstantin Belousov AuthorDate: 2022-08-30 12:49:15 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-04 04:28:02 +0000 rtld: style the rest of rtld_lock.c Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36396 --- libexec/rtld-elf/rtld_lock.c | 61 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index 8b9a6a51e061..9da8a8daccf9 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -89,39 +89,39 @@ static uint32_t fsigblock; static void * def_lock_create(void) { - void *base; - char *p; - uintptr_t r; - Lock *l; - - /* - * Arrange for the lock to occupy its own cache line. First, we - * optimistically allocate just a cache line, hoping that malloc - * will give us a well-aligned block of memory. If that doesn't - * work, we allocate a larger block and take a well-aligned cache - * line from it. - */ - base = xmalloc(CACHE_LINE_SIZE); - p = (char *)base; - if ((uintptr_t)p % CACHE_LINE_SIZE != 0) { - free(base); - base = xmalloc(2 * CACHE_LINE_SIZE); - p = (char *)base; - if ((r = (uintptr_t)p % CACHE_LINE_SIZE) != 0) - p += CACHE_LINE_SIZE - r; - } - l = (Lock *)p; - l->base = base; - l->lock = 0; - return l; + void *base; + char *p; + uintptr_t r; + Lock *l; + + /* + * Arrange for the lock to occupy its own cache line. First, we + * optimistically allocate just a cache line, hoping that malloc + * will give us a well-aligned block of memory. If that doesn't + * work, we allocate a larger block and take a well-aligned cache + * line from it. + */ + base = xmalloc(CACHE_LINE_SIZE); + p = base; + if ((uintptr_t)p % CACHE_LINE_SIZE != 0) { + free(base); + base = xmalloc(2 * CACHE_LINE_SIZE); + p = base; + if ((r = (uintptr_t)p % CACHE_LINE_SIZE) != 0) + p += CACHE_LINE_SIZE - r; + } + l = (Lock *)p; + l->base = base; + l->lock = 0; + return (l); } static void def_lock_destroy(void *lock) { - Lock *l = (Lock *)lock; + Lock *l = lock; - free(l->base); + free(l->base); } static void @@ -189,9 +189,8 @@ def_wlock_acquire(void *lock) static void def_lock_release(void *lock) { - Lock *l; + Lock *l = lock; - l = (Lock *)lock; atomic_add_rel_int(&l->lock, -((l->lock & WAFLAG) == 0 ? RC_INCR : WAFLAG)); if (ld_fast_sigblock) @@ -204,6 +203,7 @@ static int def_thread_set_flag(int mask) { int old_val = thread_flag; + thread_flag |= mask; return (old_val); } @@ -212,6 +212,7 @@ static int def_thread_clr_flag(int mask) { int old_val = thread_flag; + thread_flag &= ~mask; return (old_val); } @@ -225,7 +226,7 @@ static struct RtldLockInfo deflockinfo; static __inline int thread_mask_set(int mask) { - return lockinfo.thread_set_flag(mask); + return (lockinfo.thread_set_flag(mask)); } static __inline void