[PATCH v3] Add and use new glibc-internal futex API.

Torvald Riegel triegel@redhat.com
Mon Jun 22 19:55:00 GMT 2015


This is a revision of
https://sourceware.org/ml/libc-alpha/2015-06/msg00596.html

Compared to v2, I've moved the absolute-timeout futex wait functionality
directly into futex-internal (ie, no new function in
lowlevellock-futex.h), and added checks for support for shared futexes
in several places.

This patch doesn't try to change how shared/private is represented in
the attributes for barrier, rwlock, mutex, and condvar.  I think it is
sufficient, and easier, to address this in follow-up patches, if we need
to.

Tested on x86_64-linux.


2015-06-22  Torvald Riegel  <triegel@redhat.com>

	* sysdeps/nptl/futex-internal.h: New file.
	* sysdeps/nacl/futex-internal.h: New file.
	* sysdeps/unix/sysv/linux/futex-internal.h: New file.
	* nptl/allocatestack.c (setxid_mark_thread): Use futex wrappers with
	error checking.
	(setxid_unmark_thread): Likewise.
	(__nptl_setxid): Likewise.
	(__wait_lookup_done): Likewise.
	* nptl/cancellation.c (__pthread_disable_asynccancel): Likewise.
	* nptl/nptl-init.c (sighandler_setxid): Likewise.
	* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
	* nptl/pthread_once.c (clear_once_control): Likewise.
	(__pthread_once_slow): Likewise.
	* nptl/unregister-atfork.c (__unregister_atfork): Likewise.
	* sysdeps/nacl/exit-thread.h (__exit_thread): Likewise.
	* sysdeps/nptl/aio_misc.h (AIO_MISC_NOTIFY, AIO_MISC_WAIT): Likewise.
	* sysdeps/nptl/fork.c (__libc_fork): Likewise.
	* sysdeps/nptl/gai_misc.h (GAI_MISC_NOTIFY, GAI_MISC_WAIT): Likewise.
	* nptl/pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock_slow):
	Likewise.
	(__pthread_rwlock_rdlock): Likewise.
	* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
	Likewise.
	* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
	Likewise.
	* nptl/pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock):
	Likewise.
	* nptl/pthread_rwlock_unlock.c (__pthread_rwlock_unlock): Likewise.
	* nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock_slow:
	Likewise.
	* nptl/pthread_rwlock_init (__pthread_rwlock_init): Remove
	__ASSUME_PRIVATE_FUTEX check.
	* nptl/pthread_rwlockattr_setpshared (pthread_rwlockattr_setpshared):
	Check that shared futexes are supported.
	* nptl/pthread_barrier_wait.c (pthread_barrier_wait): Use futex
	wrappers with error checking.
	* nptl/pthread_barrier_init.c (pthread_barrier_init): Add comments,
	remove attribute sanity check and __ASSUME_PRIVATE_FUTEX check.
	* nptl/pthread_barrierattr_setpshared.c
	(pthread_barrierattr_setpshared): Check that shared futexes are
	supported.
	* nptl/pthread_condattr_setpshared.c (pthread_condattr_setpshared):
	Likewise.
	* nptl/pthread_mutexattr_setpshared.c (pthread_mutexattr_setpshared):
	Likewise.
	* nptl/sem_init.c (futex_private_if_supported): Remove.
	(__new_sem_init): Adapt and check that shared futexes are supported.
	* nptl/sem_open.c (sem_open): Likewise.
	* nptl/sem_post.c (futex_wake): Remove.
	* nptl/sem_waitcommon.c (futex_abstimed_wait, futex_wake): Remove.
	(do_futex_wait): Use futex wrappers with error checking.
	* nptl/sem_wait.c: Include lowlevellock.h.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: futex-api.patch
Type: text/x-patch
Size: 70269 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150622/29937199/attachment.bin>


More information about the Libc-alpha mailing list