summaryrefslogtreecommitdiff
path: root/nptl/pthread_attr_getstack.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-11-07nptl: Change tst-typesizes to _Static_assertAdhemerval Zanella
Instead of rely on runtime check to assure correct pthread types size a better strategy would use _Static_assert to trigger an error on build time (and thus allowing to check to potentially ABI breakage on cross-compiling make check). This patch moves nptl/tst-typesizes.c to libpthread build time on each specific initialization routine and also remove some runtime redundant asserts for the same type sizes. Checked on x86_64-linux-gnu and with a build check for all affected ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu, mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32, tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32). * nptl/pthreadP.h (ASSERT_TYPE_SIZE, ASSERT_PTHREAD_INTERNAL_SIZE): New macros. * nptl/pthread_attr_init.c (__pthread_mutex_init): Add build time checks for expected input type size. * nptl/pthread_barrier_init.c (__pthread_barrier_init): Likewise. * nptl/pthread_barrierattr_init.c (pthread_barrierattr_init): Likewise. * nptl/pthread_cond_init.c (__pthread_cond_init): Likewise. * nptl/pthread_condattr_init.c (__pthread_condattr_init): Likewise. * nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise. * nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likewise. * nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Likewise. * nptl/pthread_rwlockattr_init.c (pthread_rwlockattr_init): Likewise. * nptl/sem_init.c (__new_sem_init, __old_sem_init): Likewise * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Remove superflous runtime assert check. * nptl/pthread_attr_getaffinity.c (__pthread_attr_getaffinity_new): Likewise. * nptl/pthread_attr_getdetachstate.c (__pthread_attr_getdetachstate): Likewise. * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize): Likewise. * nptl/pthread_attr_getinheritsched.c (__pthread_attr_getinheritsched): Likewise. * nptl/pthread_attr_getschedparam.c (__pthread_attr_getschedparam): Likewise. * nptl/pthread_attr_getschedpolicy.c (__pthread_attr_getschedpolicy): Likewise. * nptl/pthread_attr_getscope.c (__pthread_attr_getscope): Likewise. * nptl/pthread_attr_getstack.c (__pthread_attr_getstack): Likewise. * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr): Likewise. * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize): Likewise. * nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new): Likewise. * nptl/pthread_attr_setdetachstate.c (__pthread_attr_setdetachstate): Likewise. * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize): Likewise. * nptl/pthread_attr_setinheritsched.c (__pthread_attr_setinheritsched): Likewise. * nptl/pthread_attr_setschedparam.c (__pthread_attr_setschedparam): Likewise. * nptl/pthread_attr_setschedpolicy.c (__pthread_attr_setschedpolicy): Likewise. * nptl/pthread_attr_setscope.c (__pthread_attr_setscope): Likewise. * nptl/pthread_attr_setstack.c (__pthread_attr_setstack, __old_pthread_attr_setstack): Likewise. * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr): Likewise. * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize): Likewise. * nptl/pthread_getattr_default_np.c (pthread_getattr_default_np): Likewise. * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise. * nptl/pthread_setattr_default_np.c (pthread_setattr_default_np): Likewise. * nptl/tst-typesizes.c: Remove file. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-10-20Convert 113 more function definitions to prototype style (files with ↵Joseph Myers
assertions). This mostly automatically-generated patch converts 113 function definitions in glibc from old-style K&R to prototype-style. Following my other recent such patches, this one deals with the case of function definitions in files that either contain assertions or where grep suggested they might contain assertions - and thus where it isn't possible to use a simple object code comparison as a sanity check on the correctness of the patch, because line numbers are changed. A few such automatically-generated changes needed to be supplemented by manual changes for the result to compile. openat64 had a prototype declaration with "..." but an old-style definition in sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the generated prototype in the definition (I've filed <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing such cases in GCC; the old state was undefined behavior not requiring a diagnostic, but one seems a good idea). In addition, as Florian has noted regparm attribute mismatches between declaration and definition are only diagnosed for prototype definitions, and five functions needed internal_function added to their definitions (in the case of __pthread_mutex_cond_lock, via the macro definition of __pthread_mutex_lock) to compile on i386. After this patch is in, remaining old-style definitions are probably most readily fixed manually before we can turn on -Wold-style-definition for all builds. Tested for x86_64 and x86 (testsuite). * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style function definition. * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. * debug/backtracesyms.c (__backtrace_symbols): Likewise. * elf/dl-minimal.c (_itoa): Likewise. * hurd/hurdmalloc.c (malloc): Likewise. (free): Likewise. (realloc): Likewise. * inet/inet6_option.c (inet6_option_space): Likewise. (inet6_option_init): Likewise. (inet6_option_append): Likewise. (inet6_option_alloc): Likewise. (inet6_option_next): Likewise. (inet6_option_find): Likewise. * io/ftw.c (FTW_NAME): Likewise. (NFTW_NAME): Likewise. (NFTW_NEW_NAME): Likewise. (NFTW_OLD_NAME): Likewise. * libio/iofwide.c (_IO_fwide): Likewise. * libio/strops.c (_IO_str_init_static_internal): Likewise. (_IO_str_init_static): Likewise. (_IO_str_init_readonly): Likewise. (_IO_str_overflow): Likewise. (_IO_str_underflow): Likewise. (_IO_str_count): Likewise. (_IO_str_seekoff): Likewise. (_IO_str_pbackfail): Likewise. (_IO_str_finish): Likewise. * libio/wstrops.c (_IO_wstr_init_static): Likewise. (_IO_wstr_overflow): Likewise. (_IO_wstr_underflow): Likewise. (_IO_wstr_count): Likewise. (_IO_wstr_seekoff): Likewise. (_IO_wstr_pbackfail): Likewise. (_IO_wstr_finish): Likewise. * locale/programs/localedef.c (normalize_codeset): Likewise. * locale/programs/locarchive.c (add_locale_to_archive): Likewise. (add_locales_to_archive): Likewise. (delete_locales_from_archive): Likewise. * malloc/malloc.c (__libc_mallinfo): Likewise. * math/gen-auto-libm-tests.c (init_fp_formats): Likewise. * misc/tsearch.c (__tfind): Likewise. * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise. * nptl/pthread_attr_getdetachstate.c (__pthread_attr_getdetachstate): Likewise. * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize): Likewise. * nptl/pthread_attr_getinheritsched.c (__pthread_attr_getinheritsched): Likewise. * nptl/pthread_attr_getschedparam.c (__pthread_attr_getschedparam): Likewise. * nptl/pthread_attr_getschedpolicy.c (__pthread_attr_getschedpolicy): Likewise. * nptl/pthread_attr_getscope.c (__pthread_attr_getscope): Likewise. * nptl/pthread_attr_getstack.c (__pthread_attr_getstack): Likewise. * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr): Likewise. * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize): Likewise. * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise. (__pthread_attr_init_2_0): Likewise. * nptl/pthread_attr_setdetachstate.c (__pthread_attr_setdetachstate): Likewise. * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize): Likewise. * nptl/pthread_attr_setinheritsched.c (__pthread_attr_setinheritsched): Likewise. * nptl/pthread_attr_setschedparam.c (__pthread_attr_setschedparam): Likewise. * nptl/pthread_attr_setschedpolicy.c (__pthread_attr_setschedpolicy): Likewise. * nptl/pthread_attr_setscope.c (__pthread_attr_setscope): Likewise. * nptl/pthread_attr_setstack.c (__pthread_attr_setstack): Likewise. * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr): Likewise. * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize): Likewise. * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock): Likewise. * nptl/pthread_create.c (__find_in_stack_list): Likewise. * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise. * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to use internal_function. * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to prototype-style function definition. * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise. (__pthread_mutex_cond_lock_adjust): Likewise. Use internal_function. * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Convert to prototype-style function definition. * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Likewise. (__pthread_mutex_unlock): Likewise. * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise. * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise. * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise. * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise. * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise. * nss/makedb.c (process_input): Likewise. * posix/fnmatch.c (__strchrnul): Likewise. (__wcschrnul): Likewise. (fnmatch): Likewise. * posix/fnmatch_loop.c (FCT): Likewise. * posix/glob.c (globfree): Likewise. (__glob_pattern_type): Likewise. (__glob_pattern_p): Likewise. * posix/regcomp.c (re_compile_pattern): Likewise. (re_set_syntax): Likewise. (re_compile_fastmap): Likewise. (regcomp): Likewise. (regerror): Likewise. (regfree): Likewise. * posix/regexec.c (regexec): Likewise. (re_match): Likewise. (re_search): Likewise. (re_match_2): Likewise. (re_search_2): Likewise. (re_search_stub): Likewise. Use internal_function (re_copy_regs): Likewise. (re_set_registers): Convert to prototype-style function definition. (prune_impossible_nodes): Likewise. Use internal_function. * resolv/inet_net_pton.c (inet_net_pton): Convert to prototype-style function definition. (inet_net_pton_ipv4): Likewise. * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise. * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise. * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise. * sysdeps/pthread/timer_delete.c (timer_delete): Likewise. * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise. Make variadic. * time/strptime_l.c (localtime_r): Convert to prototype-style function definition. * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise. * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise. * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise. * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-03-13hppa: Add _STACK_GROWS_* cases to pthread_attr_[sg]etstack.Carlos O'Donell
This is one of a several NPTL patches to build glibc on hppa. The pthread_attr_[sg]etstack functions are defined by POSIX as taking a stackaddr that is the lowest addressable byte of the storage used for the stack. However, the internal iattr variable of the same name in NPTL is actually the final stack address as usable in the stack pointer for the machine. Therefore the NPTL implementation must add and subtract stacksize for _STACK_GROWS_DOWN architectures. HPPA is a _STACK_GROWS_UP architecture and doesn't need to add or subtract anything, the stack address *is* the lowest addressable byte of the storage. Tested on hppa-linux-gnu, with no regressions. Can't impact any other targets because of the conditionals. If nobody objects I'll check this in at the end of the week. I can't see there being any objections to this patch except that it introduces more code to maintain for an old architecture (perhaps we'll get another _S_G_U target in the future?).
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2002-11-26Initial revisioncvs/initialUlrich Drepper
2002-11-26 Ulrich Drepper <drepper@redhat.com> * allocatestack.c (queue_stack): Don't remove stack from list here. Do it in the caller. Correct condition to prematurely terminate loop to free stacks. (__deallocate_stack): Remove stack from list here. 2002-11-26 Ulrich Drepper <drepper@redhat.com> * Makefile (tests): Add tst-stack1. * tst-stack1.c: New file. * allocatestack.c (allocate_stack): Initialize the TCB on a user provided stack. * pthread_attr_getstack.c: Return bottom of the thread area. 2002-11-25 Ulrich Drepper <drepper@redhat.com> * Makefile (libpthread-routines): Add pt-allocrtsig and pthread_kill_other_threads. * pt-allocrtsig.c: New file. * pthread_kill_other_threads.c: New file. * sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for all three functions. * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove allocrtsig. * sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export __libc_current_sigrtmin_private, __libc_current_sigrtmax_private, and __libc_allocate_rtsig_private. * Versions (libpthread): Export pthread_kill_other_threads_np, __libc_current_sigrtmin, and __libc_current_sigrtmax. 2002-11-24 Ulrich Drepper <drepper@redhat.com> * allocatestack.c (allocate_stack): stackaddr in attribute points to the end of the stack. Adjust computations. When mprotect call fails dequeue stack and free it. * pthread_attr_setstack.c: Store top of the stack in stackaddr attribute. * pthread_getattr_np.c: Likewise. * descr.h (IS_DETACHED): Add some more parenthesis to prevent surprises. 2002-11-23 Ulrich Drepper <drepper@redhat.com> * sysdeps/pthread/pthread.h (pthread_self): __THROW must come before attribute definitions. Patch by Luca Barbieri <ldb@ldb.ods.org>. 2002-11-22 Ulrich Drepper <drepper@redhat.com> * pthread_getspecific.c: Optimize access to first 2nd-level array. * pthread_setspecific.c: Likewise. 2002-11-21 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags definitions. Get them from the official place. * sysdeps/unix/sysv/linux/i386/fork.c: Likewise. * sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags. Use new CLONE_ flags in clone() calls. * sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork. * sysdeps/unix/sysv/linux/i386/fork.c: New file. * Versions: Add pthread_* functions for libc. * forward.c: New file. * sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add errno-loc. * herrno.c: New file. * res.c: New file. * Makefile (libpthread-routines): Remove sem_post, sem_wait, sem_trywait, and sem_timedwait. Add herrno and res. * sem_init.c: Don't initialize lock and waiters members. * sem_open.c: Likewise. * sem_post.c: Removed. * sem_wait.c: Removed. * sem_trywait.c: Removed. * sem_timedwait.c: Removed. * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite. Includes full implementations of sem_post, sem_wait, sem_trywait, and sem_timedwait. * sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust for new implementation. * sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock and waiters fields. * tst-sem3.c: Improve error message. * tst-signal3.c: Likewise. * init.c (__pthread_initialize_minimal): Use set_tid_address syscall to tell the kernel about the termination futex and to initialize tid member. Don't initialize main_thread. * descr.h (struct pthread): Remove main_thread member. * cancelllation.c (__do_cancel): Remove code handling main thread. The main thread is not special anymore. * allocatestack.c (__reclaim_stacks): Mark stacks as unused. Add size of the stacks to stack_cache_actsize. * pt-readv.c: Add missing "defined". * pt-sigwait.c: Likewise. * pt-writev.c: Likewise. 2002-11-09 Ulrich Drepper <drepper@redhat.com> * Versions: Export __connect from libpthread. Patch by Luca Barbieri <ldb@ldb.ods.org>. * Makefile (libpthread-routines): Add pt-raise. * sysdeps/unix/sysv/linux/raise.c: New file. * sysdeps/unix/sysv/linux/pt-raise.c: New file. * sysdeps/generic/pt-raise.c: New file. * pthread_cond_init.c: Initialize all data elements of the condvar structure. Patch by Luca Barbieri <ldb@ldb.ods.org>. * pthread_attr_init.c: Actually implement 2.0 compatibility version. * pthread_create.c: Likewise. * Makefile (tests): Add tst-key1, tst-key2, tst-key3. * tst-key1.c: New file. * tst-key2.c: New file. * tst-key3.c: New file. * Versions: Export pthread_detach for version GLIBC_2.0. Reported by Saurabh Desai <sdesai@austin.ibm.com>. 2002-11-08 Ulrich Drepper <drepper@redhat.com> * pthread_key_create.c: Terminate search after an unused key was found. Patch by Luca Barbieri <ldb@ldb.ods.org>. * sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero. Patch by Luca Barbieri <ldb@ldb.ods.org>. 2002-10-10 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic dynamic lookup for errno in PIC. * allocatestack.c (get_cached_stack): Rearrange code slightly to release the stack lock as soon as possible. Call _dl_allocate_tls_init for TCB from the cache to re-initialize the static TLS block. (allocate_stack): Call _dl_allocate_tls_init for user-provided stack. * cancellation.c: Renamed from cancelation.c. * Makefile: Adjust accordingly. * pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P. * cleanup_defer.c: Use CANCELLATION_P. * pthread_testcancel.c: Likewise. * descr.h: Fix spelling in comments. * init.c: Likewise. * pthread_getattr_np.c: Likewise. * pthread_getschedparam.c: Likewise. * pthread_setschedparam.c: Likewise. * Versions: Likewise. * pt-pselect.c: New file. * Makefile (libpthread-routines): Add pt-pselect. * Versions: Add pselect. * tst-cancel4.c: New file. * Makefile (tests): Add tst-cancel4. 2002-10-09 Ulrich Drepper <drepper@redhat.com> * pthread_mutex_lock.c: Always record lock ownership. * pthread_mutex_timedlock.c: Likewise. * pthread_mutex_trylock.c: Likewise. * pt-readv.c: New file. * pt-writev.c: New file. * pt-creat.c: New file. * pt-msgrcv.c: New file. * pt-msgsnd.c: New file. * pt-poll.c: New file. * pt-select.c: New file. * pt-sigpause.c: New file. * pt-sigsuspend.c: New file. * pt-sigwait.c: New file. * pt-sigwaitinfo.c: New file. * pt-waitid.c: New file. * Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat, pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend, pt-sigwait, pt-sigwaitinfo, and pt-waitid. * Versions: Add all the new functions. * tst-exit1.c: New file. * Makefile (tests): Add tst-exit1. * sem_timedwait.c: Minor optimization for more optimal fastpath. 2002-10-08 Ulrich Drepper <drepper@redhat.com> * pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW. * pthread_join.c: Enable asynchronous cancellation around lll_wait_tid call. pthread_join is an official cancellation point. * pthread_timedjoin.c: Likewise. * pthread_cond_wait.c: Revert order in which internal lock are dropped and the condvar's mutex are retrieved. * pthread_cond_timedwait.c: Likewise. Reported by dice@saros.East.Sun.COM. 2002-10-07 Ulrich Drepper <drepper@redhat.com> * pthreadP.h: Cut out all type definitions and move them... * sysdeps/unix/sysv/linux/internaltypes.h: ...here. New file. * pthreadP.h: Include <internaltypes.h>. * sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little performance tweaks. * sem_trywait.c: Shuffle #includes around to get right order. * sem_timedwait.c: Likewise. * sem_post.c: Likewise. * sem_wait.c: Likewise. * nptl 0.3 released. * Makefile (tests): Add tst-signal3. * tst-signal3.c: New file. 2002-10-05 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that the asms modify the sem object. (__lll_sem_timedwait): Now takes struct sem* as first parameter. * sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose the actual members. * pthreadP.h (struct sem): New type. Actual semaphore type. * semaphoreP.h: Include pthreadP.h. * sem_getvalue.c: Adjust to sem_t change. * sem_init.c: Likewise. * sem_open.c: Likewise. * sem_post.c: Likewise. * sem_timedwait.c: Likewise. * sem_trywait.c: Likewise. * sem_wait.c: Likewise. 2002-10-04 Ulrich Drepper <drepper@redhat.com> * Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3. * tst-basic2.c: New file. * tst-exec1.c: New file. * tst-exec2.c: New file. * tst-exec3.c: New file. * tst-fork1.c: Remove extra */. * nptl 0.2 released. The API for IA-32 is complete.