[Glibc-bsd-commits] r1989 - in trunk/glibc-ports/kfreebsd: . linuxthreads
aurel32 at alioth.debian.org
aurel32 at alioth.debian.org
Sun Jul 29 14:09:15 UTC 2007
Author: aurel32
Date: 2007-07-29 14:09:14 +0000 (Sun, 29 Jul 2007)
New Revision: 1989
Added:
trunk/glibc-ports/kfreebsd/linuxthreads/lowlevellock.h
Modified:
trunk/glibc-ports/kfreebsd/rtld-lowlevel.h
Log:
Move futexes stuff from rtld-lowlevel.h to linuxthreads/lowlevellock.h
Added: trunk/glibc-ports/kfreebsd/linuxthreads/lowlevellock.h
===================================================================
--- trunk/glibc-ports/kfreebsd/linuxthreads/lowlevellock.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/linuxthreads/lowlevellock.h 2007-07-29 14:09:14 UTC (rev 1989)
@@ -0,0 +1,49 @@
+/* Copyright (C) 2007 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _LOWLEVELLOCK_H
+#define _LOWLEVELLOCK_H 1
+
+#include <atomic.h>
+
+typedef union
+{
+ volatile void * uv; /* in fact struct umtx from <sys/umtx.h> */
+ volatile int iv;
+ volatile long lv;
+
+} __rtld_mrlock_t;
+
+#define UMTX_OP_WAIT 2 /* <sys/umtx.h> */
+#define UMTX_OP_WAKE 3 /* <sys/umtx.h> */
+
+extern int __syscall__umtx_op(void *, int, long, void*, void*);
+
+#define lll_futex_wake(futexp, nr) \
+ ({ \
+ __syscall__umtx_op(futexp, UMTX_OP_WAKE, \
+ (long) nr, NULL, NULL); \
+ })
+
+#define lll_futex_wait(futexp, val) \
+ ({ \
+ __syscall__umtx_op(futexp, UMTX_OP_WAIT, \
+ (long) val, NULL, NULL); \
+ })
+
+#endif /* lowlevellock.h */
Modified: trunk/glibc-ports/kfreebsd/rtld-lowlevel.h
===================================================================
--- trunk/glibc-ports/kfreebsd/rtld-lowlevel.h 2007-07-18 12:39:27 UTC (rev 1988)
+++ trunk/glibc-ports/kfreebsd/rtld-lowlevel.h 2007-07-29 14:09:14 UTC (rev 1989)
@@ -21,30 +21,8 @@
#define _RTLD_LOWLEVEL_H 1
#include <atomic.h>
+#include <lowlevellock.h>
-typedef union
-{
- volatile void * uv; /* in fact struct umtx from <sys/umtx.h> */
- volatile int iv;
- volatile long lv;
-
-} __rtld_mrlock_t;
-
-#define UMTX_OP_WAIT 2 /* <sys/umtx.h> */
-#define UMTX_OP_WAKE 3 /* <sys/umtx.h> */
-
-extern int __syscall__umtx_op(void *, int, long, void*, void*);
-
-static inline void lll_rtld_wake(__rtld_mrlock_t *umtx, int nr_wakeup)
-{
- __syscall__umtx_op(umtx, UMTX_OP_WAKE, (long) nr_wakeup, NULL, NULL);
-};
-
-static inline void lll_rtld_wait(__rtld_mrlock_t *umtx, int old_val)
-{
- __syscall__umtx_op(umtx, UMTX_OP_WAIT, (long) old_val, NULL, NULL);
-};
-
/* Special multi-reader lock used in ld.so. */
#define __RTLD_MRLOCK_WRITER 1
#define __RTLD_MRLOCK_RWAIT 2
@@ -93,7 +71,7 @@
atomic_or (&(lock.iv), __RTLD_MRLOCK_RWAIT); \
oldval |= __RTLD_MRLOCK_RWAIT; \
} \
- lll_rtld_wait (&(lock), oldval); \
+ lll_futex_wait (&(lock), oldval); \
} \
out:; \
} while (0)
@@ -107,7 +85,7 @@
== (__RTLD_MRLOCK_INC | __RTLD_MRLOCK_WWAIT), 0)) \
/* We have to wake all threads since there might be some queued \
readers already. */ \
- lll_rtld_wake (&(lock), 0x7fffffff); \
+ lll_futex_wake (&(lock), 0x7fffffff); \
} while (0)
@@ -136,7 +114,7 @@
} \
atomic_or (&(lock.iv), __RTLD_MRLOCK_WWAIT); \
oldval |= __RTLD_MRLOCK_WWAIT; \
- lll_rtld_wait (&(lock), oldval); \
+ lll_futex_wait (&(lock), oldval); \
} \
out:; \
} while (0)
@@ -146,7 +124,7 @@
do { \
int oldval = atomic_exchange_and_add (&(lock.iv), -__RTLD_MRLOCK_WRITER); \
if (__builtin_expect ((oldval & __RTLD_MRLOCK_RWAIT) != 0, 0)) \
- lll_rtld_wake (&(lock), 0x7fffffff); \
+ lll_futex_wake (&(lock), 0x7fffffff); \
} while (0)
More information about the Glibc-bsd-commits
mailing list