From nobody Sun Sep 18 00:34:43 2022 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 4MVTN36D8Hz4cKmL; Sun, 18 Sep 2022 00:34:43 +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 4MVTN35b0Dz4Jgj; Sun, 18 Sep 2022 00:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663461283; 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=Me0nas9C/de38YmKtx1iQ5TrejgBLwm+MarmkKnlZPU=; b=ClA1EzMW15/OY2XtDzvz4fkzR6LVFcM+A0UeKZxmneL/IdaU6nqwCTt8kOVWJ9eZlL4lYr Gc3FUn19SKb3PkR+4WPsmVcQ9+/vL47CU0gpR8MK+jzyMKDsvsaaMMPkIQWRKapm2LWzbF vLOBDAxuhR9FswyHc4MfIxLOM7dEWzY3I7mkAzJwA3B5OhjG5psffLLCHfI2W2Ar94WqCJ 0kRhdSfZn1CSsirKATkJoUjZeso2PQEBQEqTz1KtbANPaUlhYfz31gjT+yXSuPK+9a2BLG xnewyY8yxk6gNugDVJ7ERfPzex9r8uO7k+reDPzTIujg5m8wevP4SAJ5FPJK3Q== 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 4MVTN34HWlzsNH; Sun, 18 Sep 2022 00:34:43 +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 28I0Yh1w033447; Sun, 18 Sep 2022 00:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28I0Yhtk033446; Sun, 18 Sep 2022 00:34:43 GMT (envelope-from git) Date: Sun, 18 Sep 2022 00:34:43 GMT Message-Id: <202209180034.28I0Yhtk033446@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: b09c2d924fdb - stable/13 - rtld: style the rest of rtld_lock.c 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: b09c2d924fdbe956e0eb260e5ce73af4683185fe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663461283; 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=Me0nas9C/de38YmKtx1iQ5TrejgBLwm+MarmkKnlZPU=; b=MeWOzd5cQTY93pkn8dgZKhVGnnK/wEIZ/dD1480pm7Blmln5Pmt+FrixVqmJRPDtxwLQgh 9zy4IaLysL3Y2+59lcman9+kYduvS/0XXEkgi80cHuxFMgiR5kdvmSuhHCLEkHP//NiI/j qUqGfi8pUC/m4xfaSpzLzxlDs7I7dXRR2goATfQPPMsU6/4eEIqJvYNd+HNVo+pl3Sq6Jp gt2+YFczFe51WGlt6cXcblR8T1DiMUaS3e2Zo79olgb+RaXBLZexADd6bHNW6vtaIYBJet //RkbJuo1Yi+wgizocm7O8CmdDFO8aojfgm5bOkZ7EEe2Y3U9phIs0IGGSNuUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663461283; a=rsa-sha256; cv=none; b=O3kNTl++wMQodCmFNSZY5sm4cn8iVedj5e/W+UCJpdMsM/zvjpo7UWlFkbOl1KC3VrtsYL JuzVvc1yDFxwj/tC967e1vNhA9AFGXAZfrdA1Br5OrZNKVGRGlbbcBnqrStrUBZNnVCCTq koF1Qhid6cwJkzFN5P7LmTexq2BdhFghR1gRQDWi2FyI+amJPoSwa245j/HkRFcfGn6zpf /fGQVY+092LOIVb8M62pWvhQByQiB98ouM402VVTmnybIedyaZl2LHO4fe1kaSUkzEOY4e nl0KMAX2pusfQVzrLK5f9RHAPPmyuStoKae0dGJAN0GDef6YRrEQAqtZavOczA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b09c2d924fdbe956e0eb260e5ce73af4683185fe commit b09c2d924fdbe956e0eb260e5ce73af4683185fe Author: Konstantin Belousov AuthorDate: 2022-08-30 12:49:15 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-18 00:33:45 +0000 rtld: style the rest of rtld_lock.c (cherry picked from commit 7444f54bd326780ffafc0fec8ef49cad3e13baef) --- 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