about summary refs log tree commit diff
path: root/nptl/sem_open.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-13 15:18:16 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-16 14:27:24 +0100
commita28296e778ad464d2ba6289446668c3d0dcf1236 (patch)
tree2d3ae8a874d0861f1b5247b02c2cabd390ecf740 /nptl/sem_open.c
parent3c1fe20a9f4f6e12a3677ca8a5921ac03976da3b (diff)
downloadglibc-a28296e778ad464d2ba6289446668c3d0dcf1236.tar.gz
glibc-a28296e778ad464d2ba6289446668c3d0dcf1236.tar.xz
glibc-a28296e778ad464d2ba6289446668c3d0dcf1236.zip
pthread: Move semaphore initialization for open to semaphoreP.h
This allows to easily reuse all of the sem_open/sem_close/sem_unlink
implementations in the various ports.
Diffstat (limited to 'nptl/sem_open.c')
-rw-r--r--nptl/sem_open.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index 05e286002b..634bdf7425 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -211,17 +211,7 @@ sem_open (const char *name, int oflag, ...)
 	struct new_sem newsem;
       } sem;
 
-#if __HAVE_64B_ATOMICS
-      sem.newsem.data = value;
-#else
-      sem.newsem.value = value << SEM_VALUE_SHIFT;
-      sem.newsem.nwaiters = 0;
-#endif
-      /* pad is used as a mutex on pre-v9 sparc and ignored otherwise.  */
-      sem.newsem.pad = 0;
-
-      /* This always is a shared semaphore.  */
-      sem.newsem.private = FUTEX_SHARED;
+      __new_sem_open_init (&sem.newsem, value);
 
       /* Initialize the remaining bytes as well.  */
       memset ((char *) &sem.initsem + sizeof (struct new_sem), '\0',