Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rjbell4
glibc
glibc-2.4-pthread-mini.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File glibc-2.4-pthread-mini.diff of Package glibc
--- csu/version.c 2009-05-06 15:20:58.000000000 -0400 +++ csu/version.c 2009-05-06 15:26:02.000000000 -0400 @@ -24,16 +24,16 @@ static const char __libc_version[] = VERSION; static const char banner[] = -"GNU C Library "RELEASE" release version "VERSION" ("CVSDATE"), by Roland McGrath et al.\n\ +"GNU C Library \"RELEASE\" release version \"VERSION\" (\"CVSDATE\"), by Roland McGrath et al.\n\ Copyright (C) 2006 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ PARTICULAR PURPOSE.\n\ -Configured for "CONFHOST".\n\ -Compiled by GNU CC version "__VERSION__".\n" +Configured for \"CONFHOST\".\n\ +Compiled by GNU CC version \"__VERSION__\".\n" #include "version-info.h" #ifdef GLIBC_OLDEST_ABI -"The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n" +"The oldest ABI supported: \" GLIBC_OLDEST_ABI \".\n" #endif #ifdef USE_TLS "Thread-local storage support included.\n" --- nptl/Makefile 2009-05-06 15:21:00.000000000 -0400 +++ nptl/Makefile 2009-05-06 15:22:40.000000000 -0400 @@ -21,7 +21,7 @@ # subdir := nptl -headers := pthread.h semaphore.h bits/semaphore.h +headers := pthread.h pthread_mini.h semaphore.h bits/semaphore.h extra-libs := libpthread extra-libs-others := $(extra-libs) @@ -51,7 +51,13 @@ pthread_getattr_np \ pthread_mutex_init pthread_mutex_destroy \ pthread_mutex_lock pthread_mutex_trylock \ - pthread_mutex_timedlock pthread_mutex_unlock \ + pthread_minimutex_init pthread_minimutex_destroy \ + pthread_minicond_init pthread_minicond_destroy pthread_minicond_wait pthread_minicond_wait2 \ + pthread_minicond_wait_backend pthread_minicond_signal pthread_minicond_broadcast \ + pthread_minicond_timedwait_backend pthread_minicond_timedwait pthread_minicond_timedwait2 \ + pthread_minimutex_lock pthread_minimutex_trylock \ + pthread_minimutex_cond_lock \ + pthread_minimutex_unlock pthread_minimutex_cond_unlock pthread_mutex_timedlock pthread_mutex_unlock \ pthread_mutexattr_init pthread_mutexattr_destroy \ pthread_mutexattr_getpshared \ pthread_mutexattr_setpshared \ @@ -73,8 +79,10 @@ old_pthread_cond_wait old_pthread_cond_timedwait \ old_pthread_cond_signal old_pthread_cond_broadcast \ pthread_condattr_init pthread_condattr_destroy \ + pthread_minicondattr_init pthread_minicondattr_destroy \ pthread_condattr_getpshared pthread_condattr_setpshared \ pthread_condattr_getclock pthread_condattr_setclock \ + pthread_minicondattr_getclock pthread_minicondattr_setclock \ pthread_spin_init pthread_spin_destroy \ pthread_spin_lock pthread_spin_trylock \ pthread_spin_unlock \ --- nptl/pthread_minicondattr_destroy.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicondattr_destroy.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,30 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minicondattr_destroy( + pthread_minicondattr_t *attr) +{ + /* Nothing to be done. */ + return 0; +} +strong_alias (__pthread_minicondattr_destroy, pthread_minicondattr_destroy) --- nptl/pthread_minicondattr_getclock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicondattr_getclock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,31 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + 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. */ + +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minicondattr_getclock( + const pthread_minicondattr_t *attr, + clockid_t *clock_id) +{ + *clock_id = (((attr->__flags) >> 1) & ((1 << COND_CLOCK_BITS) - 1)); + return 0; +} +strong_alias(__pthread_minicondattr_getclock, pthread_minicondattr_getclock) --- nptl/pthread_minicondattr_init.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicondattr_init.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,32 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <string.h> +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minicondattr_init( + pthread_minicondattr_t *attr) +{ + memset (attr, '\0', sizeof (*attr)); + + return 0; +} +strong_alias (__pthread_minicondattr_init, pthread_minicondattr_init) --- nptl/pthread_minicondattr_setclock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicondattr_setclock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,51 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "pthread_mini.h" + +int +__pthread_minicondattr_setclock( + pthread_minicondattr_t *attr, + clockid_t clock_id) + +{ + /* We expect two clocks: CLOCK_REALTIME or CLOCK_MONOTONIC */ + if (clock_id == CLOCK_MONOTONIC) + { +#ifndef __ASSUME_POSIX_TIMERS +# ifdef __NR_clock_getres + struct timespec ts; + INTERNAL_SYSCALL_DECL (err); + int val; + val = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); +# endif +#endif + } + else if (clock_id != CLOCK_REALTIME) + return EINVAL; + + return 0; +} + +strong_alias(__pthread_minicondattr_setclock, pthread_minicondattr_setclock) --- nptl/pthread_minicond_broadcast.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_broadcast.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,58 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <shlib-compat.h> +#include <lowlevellock.h> +#include "pthread_mini.h" + +int +__pthread_minicond_broadcast( + pthread_minicond_t * cond) +{ +/* Make sure we are alone. */ + lll_mutex_lock(cond->__data.__lock); + +/* Are there any waiters to be woken? */ + if (cond->__data.__total_seq > cond->__data.__wakeup_seq) { + /* Yes. Mark them all as woken. */ + cond->__data.__wakeup_seq = cond->__data.__total_seq; + cond->__data.__woken_seq = cond->__data.__total_seq; + cond->__data.__futex = (unsigned int) cond->__data.__total_seq * 2; + + /* Signal that a broadcast happened. */ + ++cond->__data.__broadcast_seq; + + /* We are done. */ + lll_mutex_unlock(cond->__data.__lock); + + /* Wake everybody - simple but stupid, requires no knowledge of associated mutex. */ + lll_futex_wake(&cond->__data.__futex, INT_MAX); + + /* That's all. */ + return 0; + } + +/* We are done. */ + lll_mutex_unlock(cond->__data.__lock); + + return 0; +} + +versioned_symbol (libpthread, __pthread_minicond_broadcast, + pthread_minicond_broadcast, GLIBC_2_3_2); --- nptl/pthread_minicond_destroy.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_destroy.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,53 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ +#include <errno.h> +#include <shlib-compat.h> +#include <lowlevellock.h> +#include "pthread_mini.h" + +int +__pthread_minicond_destroy( + pthread_minicond_t * cond) +{ +/* Make sure we are alone. */ + lll_mutex_lock(cond->__data.__lock); + + if (cond->__data.__total_seq > cond->__data.__wakeup_seq) { + /* If there are still some waiters which have not been + * woken up, this is an application bug. */ + lll_mutex_unlock(cond->__data.__lock); + return EBUSY; + } + + if (cond->__data.__nwaiters >= 1) { + /* If there are waiters which have been already signalled or + * broadcasted, but still are using the pthread_minicond_t structure, + * lets keep it simple and consider this a bug. */ + lll_mutex_unlock(cond->__data.__lock); + return EBUSY; + } + +/* Mark condvar as destroyed. */ + cond->__data.__total_seq = -1ULL; + + return 0; +} +versioned_symbol (libpthread, __pthread_minicond_destroy, + pthread_minicond_destroy, GLIBC_2_3_2); + --- nptl/pthread_minicond_init.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_init.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,45 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <shlib-compat.h> +#include <lowlevellock.h> +#include "pthread_mini.h" + +int +__pthread_minicond_init( + pthread_minicond_t * cond, + pthread_minicondattr_t *cond_attr) +{ + assert(sizeof(pthread_minicond_t) <= __SIZEOF_PTHREAD_MINICOND_T); + assert(sizeof(cond->__size) >= sizeof(cond->__data)); + + cond->__data.__lock = LLL_MUTEX_LOCK_INITIALIZER; + cond->__data.__futex = 0; + cond->__data.__nwaiters = 0; + cond->__data.__total_seq = 0; + cond->__data.__wakeup_seq = 0; + cond->__data.__woken_seq = 0; + cond->__data.__broadcast_seq = 0; + cond->__data.__flags = (cond_attr == NULL) ? NULL : cond_attr->__flags; + + return 0; +} +versioned_symbol (libpthread, __pthread_minicond_init, + pthread_minicond_init, GLIBC_2_3_2); --- nptl/pthread_minicond_signal.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_signal.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,66 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include "pthread_mini.h" +#include <shlib-compat.h> +#include <sysdep.h> + +#define FUTEX_WAKE_OP 5 +#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1) +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, \ + (futexp), FUTEX_WAKE_OP, (nr_wake), \ + (nr_wake2), (futexp2), \ + FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + +int +__pthread_minicond_signal( + pthread_minicond_t * cond) +{ + /* Make sure we are alone. */ + lll_mutex_lock(cond->__data.__lock); + + /* Are there any waiters to be woken? */ + if (cond->__data.__total_seq > cond->__data.__wakeup_seq) { + /* Yes. Mark one of them as woken. */ + ++cond->__data.__wakeup_seq; + ++cond->__data.__futex; + + /* Wake one. */ + if (!__builtin_expect(lll_futex_wake_unlock(&cond->__data.__futex, 1, 1, &cond->__data.__lock), 0)) + return 0; + + lll_futex_wake(&cond->__data.__futex, 1); + } + + /* We are done. */ + lll_mutex_unlock(cond->__data.__lock); + + return 0; +} + +versioned_symbol (libpthread, __pthread_minicond_signal, pthread_minicond_signal, + GLIBC_2_3_2); --- nptl/pthread_minicond_timedwait2.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_timedwait2.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,37 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include "pthread_mini.h" + +int +__pthread_minicond_timedwait2( + pthread_minicond_t * cond, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context, + const struct timespec *abstime) +{ + return pthread_minicond_timedwait_backend(cond, NULL, lock_callback, lock_context, unlock_callback, unlock_context, abstime); +} + +versioned_symbol (libpthread, __pthread_minicond_timedwait2, pthread_minicond_timedwait2, + GLIBC_2_3_2); --- nptl/pthread_minicond_timedwait_backend.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_timedwait_backend.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,169 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include <errno.h> +#include <time.h> +#include <sysdep.h> +#include "pthread_mini.h" + +static inline int +clock_gettime_syscall_wrapper( + clockid_t clock_id, + struct timespec *tp) +{ + int e = EINVAL; + long int err; + + int r = INTERNAL_SYSCALL (clock_gettime, err, 2, clock_id, tp); + if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + return 0; + + e = INTERNAL_SYSCALL_ERRNO (r, err); + if (e == ENOSYS) + e = EINVAL; + + return e; +} + +int +__pthread_minicond_timedwait_backend( + pthread_minicond_t * cond, + pthread_minimutex_t * mutex, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context, + const struct timespec *abstime) +{ + int result = 0; + int err; + int bc_seq; + +/* Catch invalid parameters. */ + if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) + return EINVAL; + +/* Make sure we are alone. */ + lll_lock(cond->__data.__lock); + +/* Now we can release the mutex. */ + if (mutex != NULL) { + err = pthread_minimutex_cond_unlock(mutex); + } else { + err = unlock_callback(unlock_context); + } + if (__builtin_expect(err, 0)) { + lll_unlock(cond->__data.__lock); + return err; + } +/* We have one new user of the condvar. */ + ++cond->__data.__total_seq; + ++cond->__data.__futex; + cond->__data.__nwaiters += 1; + +/* The current values of the wakeup counter. The "woken" counter + * must exceed this value. */ + unsigned long long int val; + unsigned long long int seq; + val = seq = cond->__data.__wakeup_seq; +/* Remember the broadcast counter. */ + bc_seq = cond->__data.__broadcast_seq; + + while (1) { + struct timespec rt; + { + /* Get the current time. */ + struct timeval tv; + if (cond->__data.__flags == PTHREAD_MINICOND_USE_MONOTONIC_CLOCK) { + (void) clock_gettime_syscall_wrapper(CLOCK_MONOTONIC, &rt); + } else { + (void) gettimeofday(&tv, NULL); + } + /* Convert the absolute timeout value to a relative timeout. */ + rt.tv_sec = abstime->tv_sec - rt.tv_sec; + rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec; + } + if (rt.tv_nsec < 0) { + rt.tv_nsec += 1000000000; + --rt.tv_sec; + } + /* Did we already time out? */ + if (__builtin_expect(rt.tv_sec < 0, 0)) { + if (bc_seq != cond->__data.__broadcast_seq) + goto bc_out; + + goto timeout; + } + + unsigned int futex_val = cond->__data.__futex; + + /* Prepare to wait. Release the condvar futex. */ + lll_unlock(cond->__data.__lock); + + /* Wait until woken by signal or broadcast. */ + err = lll_futex_timed_wait(&cond->__data.__futex, futex_val, &rt); + + /* We are going to look at shared data again, so get the lock. */ + lll_lock(cond->__data.__lock); + + /* If a broadcast happened, we are done. */ + if (bc_seq != cond->__data.__broadcast_seq) + goto bc_out; + + /* Check whether we are eligible for wakeup. */ + val = cond->__data.__wakeup_seq; + if (val != seq && cond->__data.__woken_seq != val) + break; + + /* Not woken yet. Maybe the time expired? */ + if (__builtin_expect(err == -ETIMEDOUT, 0)) { + timeout: + /* Yep. Adjust the counters. */ + ++cond->__data.__wakeup_seq; + ++cond->__data.__futex; + + /* The error value. */ + result = ETIMEDOUT; + break; + } + } + +/* Another thread woken up. */ + ++cond->__data.__woken_seq; + + bc_out: + + cond->__data.__nwaiters -= 1; +/* We are done with the condvar. */ + lll_unlock(cond->__data.__lock); + +/* Get the mutex before returning. */ + if (mutex != NULL) { + err = pthread_minimutex_cond_lock(mutex); + } else { + err = lock_callback(lock_context); + } + + return err ? : result; +} + +versioned_symbol (libpthread, __pthread_minicond_timedwait_backend, pthread_minicond_timedwait_backend, + GLIBC_2_3_2); --- nptl/pthread_minicond_timedwait.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_timedwait.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,34 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include "pthread_mini.h" + +int +__pthread_minicond_timedwait( + pthread_minicond_t * cond, + pthread_minimutex_t * mutex, + const struct timespec *abstime) +{ + return pthread_minicond_timedwait_backend(cond, mutex, NULL, NULL, NULL, NULL, abstime); +} + +versioned_symbol (libpthread, __pthread_minicond_timedwait, pthread_minicond_timedwait, + GLIBC_2_3_2); --- nptl/pthread_minicond_wait2.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_wait2.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,37 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include "pthread_mini.h" + +int +__pthread_minicond_wait2( + pthread_minicond_t * cond, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context) +{ + return pthread_minicond_wait_backend(cond, NULL, lock_callback, lock_context, unlock_callback, unlock_context); +} + +versioned_symbol (libpthread, __pthread_minicond_wait2, pthread_minicond_wait2, + GLIBC_2_3_2); + --- nptl/pthread_minicond_wait_backend.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_wait_backend.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,103 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include "pthread_mini.h" + +int +__pthread_minicond_wait_backend( + pthread_minicond_t *cond, + pthread_minimutex_t *mutex, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context) +{ + int err; + int bc_seq; + +/* Make sure we are alone. */ + lll_mutex_lock(cond->__data.__lock); + +/* Now we can release the mutex. */ + if (mutex != NULL) { + err = pthread_minimutex_cond_unlock(mutex); + } else { + err = unlock_callback(unlock_context); + } + if (__builtin_expect(err, 0)) { + lll_mutex_unlock(cond->__data.__lock); + return err; + } + +/* We have one new user of the condvar. */ + ++cond->__data.__total_seq; + ++cond->__data.__futex; + cond->__data.__nwaiters += 1; + +/* The current values of the wakeup counter. The "woken" counter + * must exceed this value. */ + unsigned long long int val; + unsigned long long int seq; + val = seq = cond->__data.__wakeup_seq; +/* Remember the broadcast counter. */ + bc_seq = cond->__data.__broadcast_seq; + + do { + unsigned int futex_val = cond->__data.__futex; + + /* Prepare to wait. Release the condvar futex. */ + lll_mutex_unlock(cond->__data.__lock); + + /* Wait until woken by signal or broadcast. */ + lll_futex_wait(&cond->__data.__futex, futex_val); + + /* We are going to look at shared data again, so get the lock. */ + lll_mutex_lock(cond->__data.__lock); + + /* If a broadcast happened, we are done. */ + if (bc_seq != cond->__data.__broadcast_seq) + goto bc_out; + + /* Check whether we are eligible for wakeup. */ + val = cond->__data.__wakeup_seq; + } + while (val == seq || cond->__data.__woken_seq == val); + +/* Another thread woken up. */ + ++cond->__data.__woken_seq; + + bc_out: + + cond->__data.__nwaiters -= 1; + +/* We are done with the condvar. */ + lll_mutex_unlock(cond->__data.__lock); + +/* Get the mutex before returning. */ + if (mutex != NULL) { + return pthread_minimutex_cond_lock(mutex); + } else { + return lock_callback(lock_context); + } +} + +versioned_symbol (libpthread, __pthread_minicond_wait_backend, pthread_minicond_wait_backend, + GLIBC_2_3_2); --- nptl/pthread_minicond_wait.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minicond_wait.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,34 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. + + 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. */ + +#include <lowlevellock.h> +#include <shlib-compat.h> +#include "pthread_mini.h" + +int +__pthread_minicond_wait( + pthread_minicond_t *cond, + pthread_minimutex_t *mutex) +{ + return pthread_minicond_wait_backend(cond, mutex, NULL, NULL, NULL, NULL); +} + +versioned_symbol (libpthread, __pthread_minicond_wait, pthread_minicond_wait, + GLIBC_2_3_2); + --- nptl/pthread_mini.h 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_mini.h 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,217 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 pthread_mini_h +#define pthread_mini_h + +/*****************************************/ + +#include <sys/time.h> +#include <pthread.h> + +/*****************************************/ + +#define __SIZEOF_PTHREAD_MINICOND_T 48 + +typedef union { + struct { + int __lock; + unsigned int __futex; + unsigned long long int __total_seq; + unsigned long long int __wakeup_seq; + unsigned long long int __woken_seq; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + int __flags; + int __pad; + } __data; + char __size[__SIZEOF_PTHREAD_MINICOND_T]; + long long int __align; +} pthread_minicond_t; + +#define PTHREAD_MINICOND_USE_REALTIME_CLOCK 0 +#define PTHREAD_MINICOND_USE_MONOTONIC_CLOCK 1 +#define COND_CLOCK_BITS 1 + +typedef struct { + int __flags; +} pthread_minicondattr_t; +/*****************************************/ + +#ifdef PTHREAD_MINI_SUPPORT_NUSERS +#define __SIZEOF_PTHREAD_MINIMUTEX_T 8 +#else //PTHREAD_MINI_SUPPORT_NUSERS +#define __SIZEOF_PTHREAD_MINIMUTEX_T 4 +#endif //PTHREAD_MINI_SUPPORT_NUSERS + +#define __SIZEOF_PTHREAD_MINIMUTEX_ATTR_T 4 + + +typedef union { + struct pthread_minimutex_s { + int __lock; +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + unsigned int __nusers; +#endif //PTHREAD_MINI_SUPPORT_NUSERS + } __data; + char __size[__SIZEOF_PTHREAD_MINIMUTEX_T]; +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + long int __align; +#endif //PTHREAD_MINI_SUPPORT_NUSERS +} pthread_minimutex_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_MINIMUTEX_ATTR_T]; + int __align; +} pthread_minimutex_attr_t; + +/*****************************************/ + +extern int pthread_mini_init( + int use_private, + int *got_private); + +extern int pthread_minimutex_init( + pthread_minimutex_t * mutex); +extern int pthread_minimutex_lock( + pthread_minimutex_t * mutex); +extern int pthread_minimutex_trylock( + pthread_minimutex_t * mutex); +extern int pthread_minimutex_unlock( + pthread_minimutex_t * mutex); +extern int pthread_minimutex_destroy( + pthread_minimutex_t * mutex); + +extern int pthread_minicond_init( + pthread_minicond_t * cond, + pthread_minicondattr_t * attr); +extern int pthread_minicond_wait( + pthread_minicond_t * cond, + pthread_minimutex_t * mutex); +extern int pthread_minicond_timedwait( + pthread_minicond_t * cond, + pthread_minimutex_t * mutex, + const struct timespec *abstime); +extern int pthread_minicond_signal( + pthread_minicond_t * cond); +extern int pthread_minicond_broadcast( + pthread_minicond_t * cond); +extern int pthread_minicond_destroy( + pthread_minicond_t * cond); + +extern int pthread_minicondattr_init( + pthread_minicondattr_t * attr); +extern int pthread_minicondattr_destroy( + pthread_minicondattr_t * attr); +extern int pthread_minicondattr_setclock( + pthread_minicondattr_t *attr, + clockid_t clock_id); +extern int pthread_minicondattr_getclock( + const pthread_minicondattr_t *attr, + clockid_t * clock_id); + + +/* *INDENT-OFF* */ +typedef void *pthread_minicond_wait_mutex_lock_context_t; +typedef void *pthread_minicond_wait_mutex_unlock_context_t; +typedef int (*pthread_minicond_wait_mutex_lock_callback_t)(pthread_minicond_wait_mutex_lock_context_t); +typedef int (*pthread_minicond_wait_mutex_unlock_callback_t)(pthread_minicond_wait_mutex_unlock_context_t); +/* *INDENT-ON* */ + +extern int pthread_minicond_wait_backend( + pthread_minicond_t * cond, + pthread_minimutex_t * mutex, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context); + +extern int + pthread_minicond_wait2( + pthread_minicond_t * cond, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context); + +extern int + pthread_minicond_timedwait2( + pthread_minicond_t * cond, + pthread_minicond_wait_mutex_lock_callback_t lock_callback, + pthread_minicond_wait_mutex_lock_context_t lock_context, + pthread_minicond_wait_mutex_unlock_callback_t unlock_callback, + pthread_minicond_wait_mutex_unlock_context_t unlock_context, + const struct timespec *abstime); + +static __inline int +pthread_minicond_waitx_lock_cb( + void *m) +{ + pthread_mutex_t *mutex = m; + return pthread_mutex_lock(mutex); +} +static __inline int +pthread_minicond_waitx_unlock_cb( + void *m) +{ + pthread_mutex_t *mutex = m; + return pthread_mutex_unlock(mutex); +} +static __inline int +pthread_minicond_waitx( + pthread_minicond_t * cond, + pthread_mutex_t * mutex) +{ + return pthread_minicond_wait2(cond, pthread_minicond_waitx_lock_cb, mutex, pthread_minicond_waitx_unlock_cb, mutex); +} + +static __inline int +pthread_minicond_timedwaitx_lock_cb( + void *m) +{ + pthread_mutex_t *mutex = m; + return pthread_mutex_lock(mutex); +} +static __inline int +pthread_minicond_timedwaitx_unlock_cb( + void *m) +{ + pthread_mutex_t *mutex = m; + return pthread_mutex_unlock(mutex); +} +static __inline int +pthread_minicond_timedwaitx( + pthread_minicond_t * cond, + pthread_mutex_t * mutex, + const struct timespec *abstime) +{ + return pthread_minicond_timedwait2(cond, pthread_minicond_timedwaitx_lock_cb, mutex, pthread_minicond_waitx_unlock_cb, mutex, abstime); +} + +/* #ifdef __PTHREAD_MINI_INT */ +extern int pthread_minimutex_cond_lock( + pthread_minimutex_t * mutex); +extern int pthread_minimutex_cond_unlock( + pthread_minimutex_t * mutex); +/* #endif */ + +/*****************************************/ + +#endif /* pthread_mini_h */ --- nptl/pthread_minimutex_cond_lock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_cond_lock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,36 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include <lowlevellock.h> +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_cond_lock( + pthread_minimutex_t * mutex) +{ + lll_mutex_lock (mutex->__data.__lock); + + return 0; +} + +strong_alias (__pthread_minimutex_cond_lock, pthread_minimutex_cond_lock) --- nptl/pthread_minimutex_cond_unlock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_cond_unlock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,36 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include <lowlevellock.h> +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_cond_unlock( + pthread_minimutex_t * mutex) +{ + lll_mutex_unlock (mutex->__data.__lock); + + return 0; +} + +strong_alias (__pthread_minimutex_cond_unlock, pthread_minimutex_cond_unlock) --- nptl/pthread_minimutex_destroy.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_destroy.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,38 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_destroy( + pthread_minimutex_t * mutex) +{ +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + if (mutex->__data.__nusers != 0) { + return EBUSY; + } +#endif + return 0; +} +strong_alias (__pthread_minimutex_destroy, pthread_minimutex_destroy) +INTDEF(__pthread_minimutex_destroy) --- nptl/pthread_minimutex_init.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_init.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,38 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_init( + pthread_minimutex_t * mutex) +{ + assert(sizeof(pthread_minimutex_t) <= __SIZEOF_PTHREAD_MINIMUTEX_T); + assert(sizeof(mutex->__size) >= sizeof(mutex->__data)); + + memset(mutex, '\0', __SIZEOF_PTHREAD_MINIMUTEX_T); + + return 0; +} +strong_alias (__pthread_minimutex_init, pthread_minimutex_init) +INTDEF(__pthread_minimutex_init) --- nptl/pthread_minimutex_lock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_lock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,36 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <lowlevellock.h> +#include "pthread_mini.h" +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_lock( + pthread_minimutex_t * mutex) +{ + lll_mutex_lock (mutex->__data.__lock); +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + ++mutex->__data.__nusers; +#endif + return 0; +} +#ifndef __pthread_minimutex_lock +strong_alias (__pthread_minimutex_lock, pthread_minimutex_lock) +#endif --- nptl/pthread_minimutex_trylock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_trylock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,40 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include <lowlevellock.h> +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_trylock( + pthread_minimutex_t * mutex) +{ + if (lll_mutex_trylock (mutex->__data.__lock) != 0) { + return EBUSY; + } +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + ++mutex->__data.__nusers; +#endif + return 0; +} + +strong_alias (__pthread_minimutex_trylock, pthread_minimutex_trylock) --- nptl/pthread_minimutex_unlock.c 1969-12-31 19:00:00.000000000 -0500 +++ nptl/pthread_minimutex_unlock.c 2009-05-06 15:22:40.000000000 -0400 @@ -0,0 +1,38 @@ +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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. */ + +#include <assert.h> +#include <errno.h> +#include <string.h> +#include "pthread_mini.h" +#include <lowlevellock.h> +#include "../include/libc-symbols.h" + +int +__pthread_minimutex_unlock( + pthread_minimutex_t * mutex) +{ + lll_mutex_unlock (mutex->__data.__lock); +#ifdef PTHREAD_MINI_SUPPORT_NUSERS + --mutex->__data.__nusers; +#endif + return 0; +} + +strong_alias (__pthread_minimutex_unlock, pthread_minimutex_unlock) --- nptl/Versions 2006-02-28 04:55:16.000000000 -0500 +++ nptl/Versions 2009-05-06 15:22:40.000000000 -0400 @@ -7,13 +7,19 @@ pthread_attr_getschedpolicy; pthread_attr_setschedpolicy; pthread_attr_getscope; pthread_attr_setscope; pthread_condattr_destroy; pthread_condattr_init; + pthread_minicondattr_destroy; pthread_minicondattr_init; pthread_cond_broadcast; pthread_cond_destroy; pthread_cond_init; pthread_cond_signal; pthread_cond_wait; + pthread_minicond_signal; pthread_minicond_wait; pthread_minicond_wait2; + pthread_minicond_timedwait; pthread_minicond_timedwait2; + pthread_minicond_init; pthread_minicond_destroy; pthread_minicond_broadcast; pthread_cond_timedwait; pthread_equal; pthread_exit; pthread_getschedparam; pthread_setschedparam; pthread_mutex_destroy; pthread_mutex_init; + pthread_minimutex_destroy; pthread_minimutex_init; pthread_mutex_lock; pthread_mutex_unlock; + pthread_minimutex_lock; pthread_minimutex_unlock; pthread_self; pthread_setcancelstate; pthread_setcanceltype; } @@ -23,7 +29,11 @@ GLIBC_2.3.2 { # Changed pthread_cond_t. pthread_cond_init; pthread_cond_destroy; + pthread_minicond_init; pthread_minicond_destroy; pthread_cond_wait; pthread_cond_signal; + pthread_minicond_wait; pthread_minicond_signal; + pthread_minicond_wait2; pthread_minicond_broadcast; + pthread_minicond_timedwait; pthread_minicond_timedwait2; pthread_cond_broadcast; pthread_cond_timedwait; } GLIBC_PRIVATE { @@ -47,15 +57,21 @@ pthread_attr_getscope; pthread_attr_setscope; pthread_mutex_init; pthread_mutex_destroy; + pthread_minimutex_init; pthread_minimutex_destroy; pthread_mutex_lock; pthread_mutex_trylock; pthread_mutex_unlock; + pthread_minimutex_lock; pthread_minimutex_unlock; pthread_mutexattr_init; pthread_mutexattr_destroy; pthread_cond_init; pthread_cond_destroy; + pthread_minicond_init; pthread_minicond_destroy; pthread_minicond_broadcast; + pthread_minicond_wait; pthread_minicond_wait2; pthread_minicond_signal; + pthread_minicond_timedwait; pthread_minicond_timedwait2; pthread_cond_wait; pthread_cond_timedwait; pthread_cond_signal; pthread_cond_broadcast; pthread_condattr_destroy; pthread_condattr_init; + pthread_minicondattr_destroy; pthread_minicondattr_init; pthread_cancel; pthread_testcancel; pthread_setcancelstate; pthread_setcanceltype; @@ -76,7 +92,9 @@ # Protected names for functions used in other shared objects. __pthread_mutex_init; __pthread_mutex_destroy; + __pthread_minimutex_init; __pthread_minimutex_destroy; __pthread_mutex_lock; __pthread_mutex_trylock; __pthread_mutex_unlock; + __pthread_minimutex_lock; __pthread_minimutex_unlock; __pthread_mutexattr_init; __pthread_mutexattr_destroy; __pthread_mutexattr_settype; __pthread_key_create; __pthread_getspecific; __pthread_setspecific; @@ -199,6 +217,10 @@ GLIBC_2.3.2 { # Changed pthread_cond_t. pthread_cond_init; pthread_cond_destroy; + pthread_minicond_init; pthread_minicond_destroy; + pthread_minicond_wait; pthread_minicond_wait2; + pthread_minicond_timedwait; pthread_minicond_timedwait2; + pthread_minicond_signal; pthread_minicond_broadcast; pthread_cond_wait; pthread_cond_timedwait; pthread_cond_signal; pthread_cond_broadcast; } @@ -209,6 +231,8 @@ # Unix CS option. pthread_condattr_getclock; pthread_condattr_setclock; + pthread_minicondattr_getclock; pthread_minicondattr_setclock; + pthread_minicondattr_init; pthread_minicondattr_destroy; # Proposed API extensions. pthread_tryjoin_np; pthread_timedjoin_np;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor