aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/sem_post.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 13:29:44 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 13:29:44 +0000
commit13a4ee0bb4ccb6691729bde67233f5ca66209c7c (patch)
tree72d62fed4d091a1f38c021d9c3eab5e50044e8c4 /nptl/sysdeps/unix/sysv/linux/sem_post.c
parent0923a2c896f09795cca4a6d800a336a56b0ee42c (diff)
downloadglibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar.gz
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.tar.bz2
glibc-13a4ee0bb4ccb6691729bde67233f5ca66209c7c.zip
[BZ #4745]
[BZ #4586] [BZ #4702] [BZ #4525] [BZ #4514] [BZ #4512] Merge selected bugfixes from the trunk.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/sem_post.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_post.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sem_post.c
index 7f90325585..671b43f7f7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_post.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -1,5 +1,5 @@
/* sem_post -- post to a POSIX semaphore. Generic futex-using version.
- Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -29,36 +29,10 @@
int
__new_sem_post (sem_t *sem)
{
- struct new_sem *isem = (struct new_sem *) sem;
-
- int nr = atomic_increment_val (&isem->value);
- atomic_full_barrier ();
- if (isem->nwaiters > 0)
- {
- int err = lll_futex_wake (&isem->value, 1,
- // XYZ check mutex flag
- LLL_SHARED);
- if (__builtin_expect (err, 0) < 0)
- {
- __set_errno (-err);
- return -1;
- }
- }
- return 0;
-}
-versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1);
-
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
-int
-attribute_compat_text_section
-__old_sem_post (sem_t *sem)
-{
int *futex = (int *) sem;
int nr = atomic_increment_val (futex);
- /* We always have to assume it is a shared semaphore. */
- int err = lll_futex_wake (futex, 1, LLL_SHARED);
+ int err = lll_futex_wake (futex, nr);
if (__builtin_expect (err, 0) < 0)
{
__set_errno (-err);
@@ -66,5 +40,8 @@ __old_sem_post (sem_t *sem)
}
return 0;
}
+versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_post, __old_sem_post)
compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
#endif