__openat64_not_cancel): Remove prototypes.
(__openat_nocancel, __openat64_nocancel): New prototypes or defines.
(openat_not_cancel, openat_not_cancel_3, openat64_not_cancel,
openat64_not_cancel_3): Use them.
* init.c (__pthread_initialize_minimal_internal): Likewise.
* descr.h (struct xid_command): Pretty printing.
(struct pthread): Use __pthread_list_t or __pthread_slist_t for
robust_list. Adjust macros.
* pthread_create.c (start_thread): Adjust robust_list handling.
* phtread_mutex_unlock.c: Don't allow unlocking from any thread
but the owner for all robust mutex types.
* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Define
__pthread_list_t and __pthread_slist_t. Use them in pthread_mutex_t.
* sysdeps/pthread/pthread.h: Adjust mutex initializers.
Don't give the union a name because it changes the mangled name.
Instead name the struct for __data.
* sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
* pthread_create.c (start_thread): Adjust robust mutex free loop.
* descr.h (ENQUEUE_MUTEX, DEQUEUE_MUTEX): Adjust.
* elf/rtld.c: Define __pointer_chk_guard_local and if necessary
__pointer_chk_guard.
(_rtld_global_ro): Initialize _dl_pointer_guard.
(dl_main): Initialize __pointer_chk_guard_local and either
__pointer_chk_guard or TLS value if necessary.
(process_envvars): Recognize and handle LD_POINTER_GUARD.
* sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_pointer_guard.
* sysdeps/i386/__longjmp.S: Use PTR_DEMANGLE for PC if defined.
* sysdeps/x86_64/__longjmp.S: Likewise.
* sysdeps/i386/bsd-_setjmp.S: Use PTR_MANGLE for PC if defined.
* sysdeps/i386/bsd-_setjmp.S: Likewise.
* sysdeps/i386/setjmp.S: Likewise.
[IS_IN_rtld]: Avoid call to __sigjmp_save.
* sysdeps/i386/setjmp.S: Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and
PTR_DEMANGLE.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
* sysdeps/i386/elf/setjmp.S: Removed.
* sysdeps/i386/elf/bsd-setjmp.S: Removed.
Jakub Jelinek <jakub@redhat.com>
* descr.h: Define SETXID_BIT and SETXID_BITMASK. Adjust
CANCEL_RESTMASK.
(struct pthread): Move specific_used field to avoid padding.
Add setxid_futex field.
* init.c (sighandler_setxid): Reset setxid flag and release the
setxid futex.
* allocatestack.c (setxid_signal_thread): New function. Broken
out of the bodies of the two loops in __nptl_setxid. For undetached
threads check whether they are exiting and if yes, don't send a signal.
(__nptl_setxid): Simplify loops by using setxid_signal_thread.
* pthread_create.c (start_thread): For undetached threads, check
whether setxid bit is set. If yes, wait until signal has been
processed.
* allocatestack.c (STACK_VARIABLES): Initialize them.
* pthread_create.c (__pthread_create_2_1): Initialize pd.
* configure.in: Add --enable-stackguard-randomization option.
(ENABLE_STACKGUARD_RANDOMIZE): New define.
* config.h.in (ENABLE_STACKGUARD_RANDOMIZE): Add.
* sysdeps/unix/sysv/linux/dl-osinfo.h: Include stdint.h.
(_dl_setup_stack_chk_guard): New inline function.
* sysdeps/generic/dl-osinfo.h: Include stdint.h.
(_dl_setup_stack_chk_guard): New inline function.
* elf/rtld.c (__stack_chk_guard): New variable.
(dl_main): Remove all traces of TLS_INIT_TP_EXPENSIVE.
Set __stack_chk_guard to _dl_setup_stack_chk_guard (),
use THREAD_SET_STACK_GUARD if defined.
* elf/Versions (ld): Export __stack_chk_guard@@GLIBC_2.4.
* sysdeps/generic/libc-start.c (__stack_chk_guard): New variable.
(__libc_start_main): Set __stack_chk_guard to
_dl_setup_stack_chk_guard (), use THREAD_SET_STACK_GUARD if defined.
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Remove all
traces of TLS_INIT_TP_EXPENSIVE.
* debug/Versions (libc): Export __stack_chk_fail@@GLIBC_2.4.
* debug/Makefile (routines): Add stack_chk_fail.
(static-only-routines): Add stack_chk_fail_local.
* debug/stack_chk_fail_local.c: New file.
* debug/stack_chk_fail.c: New file.
* elf/Makefile: Add rules to build and run tst-stackguard1{,-static}
tests.
* elf/tst-stackguard1.c: New file.
* elf/tst-stackguard1-static.c: New file.
* elf/stackguard-macros.h: New file.
2004-11-20 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/bits/socket.h (SCM_RIGHTS): Avoid
comma at the end of enum if __USE_BSD is not defined.
(calc_inveclosure, calc_eclosure): Skip OP_DELETED_SUBEXP nodes.
2004-10-28 Jakub Jelinek <jakub@redhat.com>
* pthread_create.c (__pthread_create_2_1): Avoid leaking stacks
if sched_priority is not between minprio and maxprio.
2004-09-25 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/setuid.c (__setuid): Remove second
result declaration.
2004-09-22 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/ia64/sysdep.h: Adjust whitespace.
* pthread_attr_setschedparam.c: Don't test priority against limits
here. Set ATTR_FLAG_SCHED_SET flag.
* pthread_attr_setschedpolicy.c: Set ATTR_FLAG_POLICY_SET flag.
* pthread_create.c (__pthread_create_2_1): Copy scheduling attributes
from parent thread to child. If attribute is used and scheduling
parameters are not inherited, copy parameters from attribute or
compute them. Check priority value.
* pthread_getschedparam.c: If the parameters aren't known yet get
them from the kernel.
* pthread_setschedparam.c: Set ATTR_FLAG_SCHED_SET and
ATTR_FLAG_POLICY_SET flag for thread.
* sysdeps/unix/sysv/linux/internaltypes.h: Define ATTR_FLAG_SCHED_SET
and ATTR_FLAG_POLICY_SET.
* sysdeps/pthread/createthread.c: Use tgkill if possible.
(cfsetospeed): Only set c_ospeed under [_HAVE_STRUCT_TERMIOS_C_OSPEED].
(cfsetispeed): Only set c_ispeed under [_HAVE_STRUCT_TERMIOS_C_ISPEED].
* sysdeps/unix/sysv/linux/bits/termios.h
(_HAVE_STRUCT_TERMIOS_C_ISPEED, _HAVE_STRUCT_TERMIOS_C_OSPEED): Define.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/pthread/createthread.c (do_clone): If __ASSUME_CLONE_STOPPED
is not defined, do explicit synchronization.
(create_thread): Do not lock pd->lock here. If __ASSUME_CLONE_STOPPED
is not defined also unlock pd->lock for non-debugging case in case
it is necessary.
* pthread_create.c (start_thread): Always get and release pd->lock
if __ASSUME_CLONE_STOPPED is not defined.
(start_thread_debug): Removed. Adjust users.
* allocatestack.c (allocate_stack): Always initialize lock if
__ASSUME_CLONE_STOPPED is not defined.
* Makefile (tests): Add tst-sched1.
* tst-sched1.c: New file.
2003-07-22 Jakub Jelinek <jakub@redhat.com>
* include/resolv.h (__resp): Declare. Define to __libc_resp
if in libc.so.
(_res): If USE___THREAD, define to (*__resp).
* resolv/res_libc.c (_res): Normal .bss variable with compat_symbol
even if USE___THREAD.
(__resp): New __thread variable.
(__libc_resp): New alias.
* resolv/Versions (libc): Export _res@GLIBC_2.0 even if
USE_TLS && HAVE___THREAD. Export __resp@@GLIBC_PRIVATE.
* sysdeps/generic/res-state.c (__res_state): Return __resp
if USE___THREAD.
2003-07-20 Ulrich Drepper <drepper@redhat.com>
* Makefile (libpthread-routines): Add pthread_attr_getaffinity and
pthread_attr_setaffinity.
* Versions [libpthread] (GLIBC_2.3.3): Likewise.
* sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c: New file.
* sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c: New file.
* pthread_attr_destroy.c: Free cpuset element if allocated.
* pthread_create.c: Pass iattr as additional parameter to
create_thread.
* sysdeps/pthread/createthread.c: If attribute is provided and
a new thread is created with affinity set or scheduling parameters,
start thread with CLONE_STOPPED.
* sysdeps/pthread/pthread.h: Declare pthread_attr_getaffinity and
pthread_attr_setaffinity.
* sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_attr): Add
cpuset element.
2003-04-01 Ulrich Drepper <drepper@redhat.com>
* pthread_create.c (deallocate_tsd): Clear/free memory after the last
round, not the first. Use specific_used flag instead of local
found_nonzero variable. Use THREAD_[SG]ETMEM where possible.
(__free_tcb): Don't call deallocate_tsd here.
(start_thread): Call deallocate_tsd here.
* pthread_setspecific.c: Set specific_used flag really only when
needed.
* Makefile (tests): Add tst-tsd3.c
* tst-tsd3.c: New file.
* descr.h (struct pthread): Move the union out of [!TLS_DTV_AT_TP], so
we always define the padding space.
[!TLS_DTV_AT_TP]: Give tcbhead_t field a name, `header', since GCC
stopped supporting its own extensions fully.
[TLS_MULTIPLE_THREADS_IN_TCB]: Put `multiple_threads' inside a wrapper
struct also called `header', so `header.multiple_threads' is the field
name to use on all machines.
* allocatestack.c (allocate_stack): Use `header.' prefix.
* sysdeps/pthread/createthread.c (create_thread): Likewise.
* pthread_create.c (__pthread_create_2_1): Likewise.
* sysdeps/i386/tls.h (INSTALL_NEW_DTV, THREAD_DTV): Likewise.
(THREAD_SELF): Likewise.
* sysdeps/x86_64/tls.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/pthread/createthread.c (ARCH_CLONE): Define if not defined.
(create_thread): Only assert PD->tcb != NULL under [TLS_TCB_AT_TP].
Use ARCH_CLONE.
* allocatestack.c (ALLOCATE_STACK_PARMS): New macro.
[NEED_SEPARATE_REGISTER_STACK] (STACK_VARIABLES,
STACK_VARIABLES_ARGS, STACK_VARIABLES_PARMS, ALLOCATE_STACK_PARMS,
ALLOCATE_STACK): New macros.
(TLS_TPADJ): New macro.
(get_cached_stack, queue_stack, __deallocate_stack): Use TLS_TPADJ.
(allocate_stack): Handle TLS_DTV_AT_TP and
NEED_SEPARATE_REGISTER_STACK. Use TLS_TPADJ.
* pthread_create.c (__pthread_create_2_1) [! TLS_TCB_AT_TP]:
Don't set PD->self.
* init.c [__ia64__] (__NR_set_tid_address): Define.
* pthread_create.c: Define __pthread_keys using nocommon
attribute, not by placing it explicitly in bss.
Remove DEFINE_DEALLOC definition. Not needed anymore.
* allocatestack.c: Define ARCH_MAP_FLAGS if not already defined.
Use it in mmap call to allocate stacks.
* sysdeps/pthread/createthread.c (create_thread): Fix comment.
* pthreadP.h: Mark declarations of __find_in_stack_list, __free_tcb,
and __deallocate_stack with internal_function.
* pthread_create.c: Adjust definitions appropriately.
* allocatestack.c: Likewise.
* pthread_join.c: Add one more __builtin_expect.
* pthread_timedjoin.c: Likewise.
* pthread_getspecific.c (__pthread_getspecific): Clear data->data
not data of sequence number does not match.
Add one __builtin_expect.
2003-02-14 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/libc-start.c [HAVE_PTR_NTHREADS]: Decrement thread
counter and only call __exit_thread if this is not the last thread.
* sysdeps/i386/td_ta_map_lwp2thr.c: Moved from ../nptl_db.
* sysdeps/generic/td_ta_map_lwp2thr.c: New file.
* pthread_create.c (start_thread): Add missing & on __nptl_last_event.