From patchwork Wed Jul 29 17:46:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 140184 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 105A04BB58E7 for ; Wed, 29 Jul 2026 17:50:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 105A04BB58E7 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=s6YUOuzB X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id CBF884BB24F9 for ; Wed, 29 Jul 2026 17:49:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBF884BB24F9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBF884BB24F9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785347362; cv=none; b=ZIXMIGDYVwYHmIbih4E2/MpujUS0cBtCt1H4kS4fvHRb5Blg9LdMHNLzChrW63YjW5+DY3kJ+Szq3ePE3ZH/wIber9npZxyWQVbsg6iOD8SjAML4+AZ1bUEl9RqMdBZYXgOGv40Bj1IlbWb+95LSEcSPYz7NgzKv5/iBgAQDDck= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785347362; c=relaxed/simple; bh=t3vfDl+Ie8+Pf6MW0VFjQmYe0v7KdGJiLkybN0h6J4k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=h6c/W/NhmART0AcQ9pyOm3H2o4gPnn2aLzwGED0abw06kq7W8mvxPuG/sdP1ltvcSnuhozGPErzJdY0m+qB/l86gfnuS8tFlEdv17nj3/noqGzwZoYHHDzgdxbd44bS6gpTFzQfm6TNCBb9mOkT6iFWGh5egHblHXD04s7JG+Wg= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=s6YUOuzB DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBF884BB24F9 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2caed617615so15718885ad.3 for ; Wed, 29 Jul 2026 10:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785347361; x=1785952161; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=RfflKnJN9Oglq4oX/oR+siE9mPDPuSAEbDB9IGy4f8I=; b=s6YUOuzBwYNLG6z86Gct7X2uu3Q696fz3QyHg6zwXORsWqqSc3GVL3yh4MYFOBZ5LF 5dR6QFKMZpp4bhg4JYhEjqfxRpoS1773YC5YuhIGj6devxm9sw7m777EqmV0hODNjLTJ o6Hv7J3IHt1cb5aZ+uT4gZaKVi2yOgPDyfoT4gyMX75Y9xnbiTwzM1iiYOsKR06J0LR8 eeBjSdkIufSasBa5sEIeixcQFnoJB6qGlLPnSPgRFYFCFJt0J/xjA9IVgW+e8N2aS7iC kIKwk/+8uK+OX0yj65VfV/6fiUMEZzvUoqZk6V7Pkhm7FUJBGYOIBliEHmVzeZMrNnU3 qYVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785347361; x=1785952161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=RfflKnJN9Oglq4oX/oR+siE9mPDPuSAEbDB9IGy4f8I=; b=R8cnK1e1xbhIM23RzjnrudSYRP8YODhOKvRbPyYLq9nxVkGENUzIV4X/cGpZJ4iebY a1Ens0a/ojg1/SYxdMt1EiyIxn8LLvJcSsQEMl6nktqs7m5NlFPr/XjoTjyYdcGQOZg1 NqxufIT5CcD0UCwdN2ZlHXnoWWSTcohoPdEGTwRnDiNWdgq70HRAgoXOQUQBjWIk5sDX /Hoxv7zVOLH8Bq6iDQFiIgKBA7ZmYcisyP2Pt6yO2PHhFb9aRR1s8eP1+eSKb0JwvBKU 5F2SAxLSRPbYbHvhCGuxCMTth0ON3nd6v92weL47SwzVlMvPGiKvPe6h9tjSQL5FgQAE 0xjw== X-Gm-Message-State: AOJu0YyU2HVGH3DCrhnlKakrmvvCDgXFdRMUa0ooJDIWxX9lMsFZn3ok H0DslCVDkVDx2ihLZGROZstwnML4fuuCi5H7BBrWP+qRL6RtPkev6xOwRji3NE5oaTdPlkF225J nNtM7 X-Gm-Gg: AR+sD13PV14ryMGnFnmDIPguE+YfolUs2T81FY5c21V+8xhb8okGzRvtXNcg8xccBI/ Y22a6jOdrIr/aqnNE5jLfoxKkBP7++8lIYG9jY0mC6EQZCBon1t9PS/UlKjbO9hmoPR7CM6rRuU /u5OB8uWsGTo5JpU8QE1tn7MUMbAAbdfhByK5qEY6N04aArjh5g3uK4uwHk6haXdmZ70Y3KCYFZ bbsQemZawn6MWQsglkO1pyN/iuAO3IfyVu/D4QoeMnjgCqP1p0cGCbZmAj2Cd5c+qPmGI8kUIkn 20wKokerWUtkHRnv1YjjYj6EdX45zYLbxmapt5KfWOgISpofJBu8nrUUd+iu/EiYhNM0UpppiJA qz2iCE+JHHmX87zPMHTyOJmgvbNSpPQh9TWjgBUnor1i6UC+BvqquL/4vPVDGXwahzxrTJ/sii/ /Uk+qIfnD7mUphXW2Ez1EVll6AksSx46PnW4RP4EhurZXR00W9/V/L1UgNrpEJYHg7DS4U0Q== X-Received: by 2002:a17:903:230f:b0:2cc:89ce:2ef8 with SMTP id d9443c01a7336-2d015d983b3mr90129615ad.40.1785347360665; Wed, 29 Jul 2026 10:49:20 -0700 (PDT) Received: from mandiga ([2804:1b3:a7c0:11bd:a7a:802d:593d:3a74]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504cc63fesm11058104eec.15.2026.07.29.10.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 10:49:20 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 1/3] support: Add support_process_shared_robust_mutex Date: Wed, 29 Jul 2026 14:46:36 -0300 Message-ID: <20260729174915.2819065-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260729174915.2819065-1-adhemerval.zanella@linaro.org> References: <20260729174915.2819065-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Returns whether process-shared robust mutexes are supported. --- support/Makefile | 1 + support/support_mutex_robust.c | 34 ++++++++++++++++++++++++++++++++++ support/xthread.h | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 support/support_mutex_robust.c diff --git a/support/Makefile b/support/Makefile index 87eeb8199f6..159b21a329f 100644 --- a/support/Makefile +++ b/support/Makefile @@ -88,6 +88,7 @@ libsupport-routines = \ support_isolate_in_subprocess \ support_mem_access \ support_mutex_pi_monotonic \ + support_mutex_robust \ support_need_proc \ support_nscd \ support_open_and_compare_file_bytes \ diff --git a/support/support_mutex_robust.c b/support/support_mutex_robust.c new file mode 100644 index 00000000000..37fd0f6ce80 --- /dev/null +++ b/support/support_mutex_robust.c @@ -0,0 +1,34 @@ +/* Returns whether process-shared robust mutexes are supported. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +bool +support_process_shared_robust_mutex (void) +{ +#ifdef __linux__ + void *head; + size_t len; + int r = syscall (__NR_get_robust_list, 0, &head, &len); + return r == 0; +#else + return true; +#endif +} diff --git a/support/xthread.h b/support/xthread.h index 3bdc6907aab..0bbaa0f074a 100644 --- a/support/xthread.h +++ b/support/xthread.h @@ -36,6 +36,9 @@ void delayed__exit (int seconds); /* Returns true if Priority Inheritance support CLOCK_MONOTONIC. */ bool support_mutex_pi_monotonic (void); +/* Returns true if process-shared robust mutexes are supported. */ +bool support_process_shared_robust_mutex (void); + /* Terminate the process (with exit status 1) if VALUE is not zero. In that case, print a failure message to standard output mentioning FUNCTION. The process is terminated with the exit function, so