aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-25 11:27:46 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:40 -0300
commit8bf73ae7780e92f2898e04c8815bed15c513ff53 (patch)
treef5ca3b58d7f42a429421b3e6456a3afbc251ce52 /sysdeps/unix
parent0fe003b0235263f296e5c7463deadc9a7b797970 (diff)
downloadglibc-8bf73ae7780e92f2898e04c8815bed15c513ff53.zip
glibc-8bf73ae7780e92f2898e04c8815bed15c513ff53.tar.gz
glibc-8bf73ae7780e92f2898e04c8815bed15c513ff53.tar.bz2
linux: Adequate tst-clone3 to c11 atomics
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/tst-clone3-internal.c8
-rw-r--r--sysdeps/unix/sysv/linux/tst-clone3.c8
2 files changed, 6 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-clone3-internal.c b/sysdeps/unix/sysv/linux/tst-clone3-internal.c
index 2f0b200..459f381 100644
--- a/sysdeps/unix/sysv/linux/tst-clone3-internal.c
+++ b/sysdeps/unix/sysv/linux/tst-clone3-internal.c
@@ -45,16 +45,14 @@ f (void *a)
implementation. */
#define wait_tid(ctid_ptr, ctid_val) \
do { \
- __typeof (*(ctid_ptr)) __tid; \
/* We need acquire MO here so that we synchronize with the \
kernel's store to 0 when the clone terminates. */ \
- while ((__tid = atomic_load_explicit (ctid_ptr, \
- memory_order_acquire)) != 0) \
+ while (atomic_load_explicit (ctid_ptr, memory_order_acquire) != 0) \
futex_wait (ctid_ptr, ctid_val); \
} while (0)
static inline int
-futex_wait (int *futexp, int val)
+futex_wait (_Atomic pid_t *futexp, int val)
{
#ifdef __NR_futex
return syscall (__NR_futex, futexp, FUTEX_WAIT, val);
@@ -75,7 +73,7 @@ do_test (void)
/* Initialize with a known value. ctid is set to zero by the kernel after the
cloned thread has exited. */
#define CTID_INIT_VAL 1
- pid_t ctid = CTID_INIT_VAL;
+ _Atomic pid_t ctid = CTID_INIT_VAL;
pid_t tid;
struct clone_args clone_args =
diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c
index 77b8731..451ea12 100644
--- a/sysdeps/unix/sysv/linux/tst-clone3.c
+++ b/sysdeps/unix/sysv/linux/tst-clone3.c
@@ -45,16 +45,14 @@ f (void *a)
implementation. */
#define wait_tid(ctid_ptr, ctid_val) \
do { \
- __typeof (*(ctid_ptr)) __tid; \
/* We need acquire MO here so that we synchronize with the \
kernel's store to 0 when the clone terminates. */ \
- while ((__tid = atomic_load_explicit (ctid_ptr, \
- memory_order_acquire)) != 0) \
+ while (atomic_load_explicit (ctid_ptr, memory_order_acquire) != 0) \
futex_wait (ctid_ptr, ctid_val); \
} while (0)
static inline int
-futex_wait (int *futexp, int val)
+futex_wait (_Atomic pid_t *futexp, int val)
{
#ifdef __NR_futex
return syscall (__NR_futex, futexp, FUTEX_WAIT, val);
@@ -75,7 +73,7 @@ do_test (void)
/* Initialize with a known value. ctid is set to zero by the kernel after the
cloned thread has exited. */
#define CTID_INIT_VAL 1
- pid_t ctid = CTID_INIT_VAL;
+ _Atomic pid_t ctid = CTID_INIT_VAL;
pid_t tid;
#if _STACK_GROWS_DOWN