[v2,1/3] support: Add support_process_shared_robust_mutex
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
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
@@ -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 \
new file mode 100644
@@ -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
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xthread.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+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
+}
@@ -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