From patchwork Tue May 5 19:06:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 134507 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9E8274BAD14D for ; Tue, 5 May 2026 19:10:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E8274BAD14D 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=GdU7/K9k X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com [IPv6:2607:f8b0:4864:20::e33]) by sourceware.org (Postfix) with ESMTPS id E2C1F4BA799C for ; Tue, 5 May 2026 19:08:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2C1F4BA799C 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 E2C1F4BA799C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::e33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778008099; cv=none; b=a38UC3NfE+uO+bjiyU7iFn9Pm7vJv8E4R0Lxz/K1jJ3xJYKbefCEB2J7Q8um9x3hIeBAZWoS84Qb2/GSSPx0dGuIBbkIQ5CRgmt/atgsKos7cq80MFHrGs7k5R6BtevjTi6iXTTAGNXNByl5KDdk85r5wB/Gwvl4nHyB1cBayrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778008099; c=relaxed/simple; bh=+SSVsmE6kVKSB8EXvdJTwTvgbRtC55Je9txgMQ+gqcQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kmdURJXjP/ObQGFVVznfqt/gGrG31C5tZRovK+OhKdYYD+kJqkvSD08joLMuASWxZ93LPik0GxDebLMNSECcAam2KWumGnzFMySnh6Qbo/DqSM9Jr3dEiXlyZewi+PBGg3L4S/QJCu4wOzF6atWOuW6b5Hdi/Bi1gh34QO31lEw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2C1F4BA799C Received: by mail-vs1-xe33.google.com with SMTP id ada2fe7eead31-610f4cf6ddcso159285137.1 for ; Tue, 05 May 2026 12:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778008098; x=1778612898; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dDn68h72jIjI8U4hEHDseM+LUdAGP1zBrJx+1FVvZfc=; b=GdU7/K9kQKHlC9xOnaZfDfOKm0K3kKFoBsQCFk/skGV46vAf80wJNOlzhYNAAq09bH +mis5ETv+Z4MuOtjpwSP0WEDW5vh2y56Yr+JDbXCBpHc0JNolFsZKQmxTQWvDiIop+UV +nspth1uAOYMwx+dIF6Bz/8XHmu9hjYPOM6TZ4LayTao4Op7PP5LLuUZ+oIz/Fvgoogi wqvCipfxVZCdwWjvKJrzEHDDR6xAsWFqFIrJTsB9voSq1i6d7NYJigJ2JC5BBtF0ijKg P4XxG+XPaR2JsbNrziviKpXz6gkDgJMz9Kg4Il2ZupnFLgaRJksWXJtsrU6C1qbt8uyA VQLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778008098; x=1778612898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-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 with SMTP id ada2fe7eead31-62f55a492fdmr2718782137.20.1778008097810; Tue, 05 May 2026 12:08:17 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:364:abee:44ff:b045:5a7]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-95ce08f4a7asm7504046241.5.2026.05.05.12.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 12:08:17 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Florian Weimer Subject: [PATCH v2 1/3] support: Add support_process_shared_robust_mutex Date: Tue, 5 May 2026 16:06:50 -0300 Message-ID: <20260505190809.3898686-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260505190809.3898686-1-adhemerval.zanella@linaro.org> References: <20260505190809.3898686-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 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 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 3f19a98bdc4..4facaaead6b 100644 --- a/support/Makefile +++ b/support/Makefile @@ -87,6 +87,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..2957aca230d --- /dev/null +++ b/support/support_mutex_robust.c @@ -0,0 +1,34 @@ +/* Returns whether process-shared robust mutexes are supported. + Copyright (C) 2025 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 d585bd0c3c6..7afd96dd3b9 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