diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
commit | cab56836b146bc129f1ad43f0393d95a9deca63a (patch) | |
tree | 4f4e655319bbac78fca170da05275c127429b460 /sysdeps/pthread | |
parent | 04ac1241a4cd004872282c2c82ec37fa33925292 (diff) | |
parent | 82dd75a7f436a19047325d62182590c9f9e23a78 (diff) |
Merge branch 't/tls' into refs/top-bases/t/tls-threadvar
Diffstat (limited to 'sysdeps/pthread')
29 files changed, 80 insertions, 144 deletions
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile index 332a461bf1..ea4f889489 100644 --- a/sysdeps/pthread/Makefile +++ b/sysdeps/pthread/Makefile @@ -1,5 +1,5 @@ # sysdeps makefile fragment for all pthread-supporting configurations. -# Copyright (C) 2014-2016 Free Software Foundation, Inc. +# Copyright (C) 2014-2018 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 diff --git a/sysdeps/pthread/aio_cancel.c b/sysdeps/pthread/aio_cancel.c index 448a312157..dc259a6e48 100644 --- a/sysdeps/pthread/aio_cancel.c +++ b/sysdeps/pthread/aio_cancel.c @@ -1,5 +1,5 @@ /* Cancel requests associated with given file descriptor. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_error.c b/sysdeps/pthread/aio_error.c index 88545b0e0d..ca01a1ee10 100644 --- a/sysdeps/pthread/aio_error.c +++ b/sysdeps/pthread/aio_error.c @@ -1,5 +1,5 @@ /* Return error status of asynchronous I/O request. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_fsync.c b/sysdeps/pthread/aio_fsync.c index 20516cfc8b..8238b26192 100644 --- a/sysdeps/pthread/aio_fsync.c +++ b/sysdeps/pthread/aio_fsync.c @@ -1,5 +1,5 @@ /* Synchronize I/O in given file descriptor. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c index f55570d23b..fb13d6210b 100644 --- a/sysdeps/pthread/aio_misc.c +++ b/sysdeps/pthread/aio_misc.c @@ -1,5 +1,5 @@ /* Handle general operations. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -159,7 +159,6 @@ get_elem (void) void -internal_function __aio_free_request (struct requestlist *elem) { elem->running = no; @@ -169,7 +168,6 @@ __aio_free_request (struct requestlist *elem) struct requestlist * -internal_function __aio_find_req (aiocb_union *elem) { struct requestlist *runp = requests; @@ -192,7 +190,6 @@ __aio_find_req (aiocb_union *elem) struct requestlist * -internal_function __aio_find_req_fd (int fildes) { struct requestlist *runp = requests; @@ -206,7 +203,6 @@ __aio_find_req_fd (int fildes) void -internal_function __aio_remove_request (struct requestlist *last, struct requestlist *req, int all) { @@ -299,7 +295,6 @@ weak_alias (__aio_init, aio_init) /* The main function of the async I/O handling. It enqueues requests and if necessary starts and handles threads. */ struct requestlist * -internal_function __aio_enqueue_request (aiocb_union *aiocbp, int operation) { int result = 0; @@ -350,10 +345,6 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation) return NULL; } newp->aiocbp = aiocbp; -#ifdef BROKEN_THREAD_SIGNALS - newp->caller_pid = (aiocbp->aiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL - ? getpid () : 0); -#endif newp->waiting = NULL; aiocbp->aiocb.__abs_prio = prio; diff --git a/sysdeps/pthread/aio_misc.h b/sysdeps/pthread/aio_misc.h index e042998717..45fc9994ce 100644 --- a/sysdeps/pthread/aio_misc.h +++ b/sysdeps/pthread/aio_misc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 @@ -54,11 +54,6 @@ struct waitlist volatile unsigned int *counterp; /* The next field is used in asynchronous `lio_listio' operations. */ struct sigevent *sigevp; -#ifdef BROKEN_THREAD_SIGNALS - /* XXX See requestlist, it's used to work around the broken signal - handling in Linux. */ - pid_t caller_pid; -#endif }; @@ -86,12 +81,6 @@ struct requestlist /* Pointer to the actual data. */ aiocb_union *aiocbp; -#ifdef BROKEN_THREAD_SIGNALS - /* PID of the initiator thread. - XXX This is only necessary for the broken signal handling on Linux. */ - pid_t caller_pid; -#endif - /* List of waiting processes. */ struct waitlist *waiting; }; @@ -104,40 +93,30 @@ extern pthread_mutex_t __aio_requests_mutex attribute_hidden; /* Enqueue request. */ extern struct requestlist *__aio_enqueue_request (aiocb_union *aiocbp, int operation) - attribute_hidden internal_function; + attribute_hidden; /* Find request entry for given AIO control block. */ -extern struct requestlist *__aio_find_req (aiocb_union *elem) - attribute_hidden internal_function; +extern struct requestlist *__aio_find_req (aiocb_union *elem) attribute_hidden; /* Find request entry for given file descriptor. */ -extern struct requestlist *__aio_find_req_fd (int fildes) - attribute_hidden internal_function; +extern struct requestlist *__aio_find_req_fd (int fildes) attribute_hidden; /* Remove request from the list. */ extern void __aio_remove_request (struct requestlist *last, struct requestlist *req, int all) - attribute_hidden internal_function; + attribute_hidden; /* Release the entry for the request. */ -extern void __aio_free_request (struct requestlist *req) - attribute_hidden internal_function; +extern void __aio_free_request (struct requestlist *req) attribute_hidden; /* Notify initiator of request and tell this everybody listening. */ -extern void __aio_notify (struct requestlist *req) - attribute_hidden internal_function; +extern void __aio_notify (struct requestlist *req) attribute_hidden; /* Notify initiator of request. */ -#ifdef BROKEN_THREAD_SIGNALS -extern int __aio_notify_only (struct sigevent *sigev, pid_t caller_pid) - attribute_hidden internal_function; -#else -extern int __aio_notify_only (struct sigevent *sigev) - attribute_hidden internal_function; -#endif +extern int __aio_notify_only (struct sigevent *sigev) attribute_hidden; /* Send the signal. */ extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid) - attribute_hidden internal_function; + attribute_hidden; #endif /* aio_misc.h */ diff --git a/sysdeps/pthread/aio_notify.c b/sysdeps/pthread/aio_notify.c index 75f3229667..394083172a 100644 --- a/sysdeps/pthread/aio_notify.c +++ b/sysdeps/pthread/aio_notify.c @@ -1,5 +1,5 @@ /* Notify initiator of AIO request. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -48,12 +48,7 @@ notify_func_wrapper (void *arg) int -internal_function -#ifdef BROKEN_THREAD_SIGNALS -__aio_notify_only (struct sigevent *sigev, pid_t caller_pid) -#else __aio_notify_only (struct sigevent *sigev) -#endif { int result = 0; @@ -99,15 +94,9 @@ __aio_notify_only (struct sigevent *sigev) #if _POSIX_REALTIME_SIGNALS > 0 /* Note that the standard gives us the option of using a plain non-queuing signal here when SA_SIGINFO is not set for the signal. */ -# ifdef BROKEN_THREAD_SIGNALS - if (__aio_sigqueue (sigev->sigev_signo, sigev->sigev_value, caller_pid) - < 0) - result = -1; -# else if (__aio_sigqueue (sigev->sigev_signo, sigev->sigev_value, getpid ()) < 0) result = -1; -# endif #else /* There are no queued signals on this system at all. */ result = raise (sigev->sigev_signo); @@ -119,17 +108,12 @@ __aio_notify_only (struct sigevent *sigev) void -internal_function __aio_notify (struct requestlist *req) { struct waitlist *waitlist; struct aiocb *aiocbp = &req->aiocbp->aiocb; -#ifdef BROKEN_THREAD_SIGNALS - if (__aio_notify_only (&aiocbp->aio_sigevent, req->caller_pid) != 0) -#else if (__aio_notify_only (&aiocbp->aio_sigevent) != 0) -#endif { /* XXX What shall we do if already an error is set by read/write/fsync? */ @@ -162,11 +146,7 @@ __aio_notify (struct requestlist *req) this request is the last one, send the signal. */ if (--*waitlist->counterp == 0) { -#ifdef BROKEN_THREAD_SIGNALS - __aio_notify_only (waitlist->sigevp, waitlist->caller_pid); -#else __aio_notify_only (waitlist->sigevp); -#endif /* This is tricky. See lio_listio.c for the reason why this works. */ free ((void *) waitlist->counterp); diff --git a/sysdeps/pthread/aio_read.c b/sysdeps/pthread/aio_read.c index 79bec53d8f..6c4dc42dee 100644 --- a/sysdeps/pthread/aio_read.c +++ b/sysdeps/pthread/aio_read.c @@ -1,5 +1,5 @@ /* Asynchronous read. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_read64.c b/sysdeps/pthread/aio_read64.c index b778056b4e..ad680104f2 100644 --- a/sysdeps/pthread/aio_read64.c +++ b/sysdeps/pthread/aio_read64.c @@ -1,5 +1,5 @@ /* Asynchronous read, 64bit offset version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c index ba9fb65c42..010cbf84df 100644 --- a/sysdeps/pthread/aio_suspend.c +++ b/sysdeps/pthread/aio_suspend.c @@ -1,5 +1,5 @@ /* Suspend until termination of a requests. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -145,9 +145,6 @@ aio_suspend (const struct aiocb *const list[], int nent, waitlist[cnt].next = requestlist[cnt]->waiting; waitlist[cnt].counterp = &cntr; waitlist[cnt].sigevp = NULL; -#ifdef BROKEN_THREAD_SIGNALS - waitlist[cnt].caller_pid = 0; /* Not needed. */ -#endif requestlist[cnt]->waiting = &waitlist[cnt]; any = true; } diff --git a/sysdeps/pthread/aio_write.c b/sysdeps/pthread/aio_write.c index 8dfc3013e9..c6b09e3b14 100644 --- a/sysdeps/pthread/aio_write.c +++ b/sysdeps/pthread/aio_write.c @@ -1,5 +1,5 @@ /* Asynchronous write. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/aio_write64.c b/sysdeps/pthread/aio_write64.c index ef14c45982..94084c787f 100644 --- a/sysdeps/pthread/aio_write64.c +++ b/sysdeps/pthread/aio_write64.c @@ -1,5 +1,5 @@ /* Asynchronous write, 64bit offset version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/allocalim.h b/sysdeps/pthread/allocalim.h index 076889463b..99f74838dd 100644 --- a/sysdeps/pthread/allocalim.h +++ b/sysdeps/pthread/allocalim.h @@ -1,5 +1,5 @@ /* Determine whether block of given size can be allocated on the stack or not. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2018 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 @@ -24,6 +24,9 @@ extern __always_inline int __libc_use_alloca (size_t size) { - return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1) - || __builtin_expect (__libc_alloca_cutoff (size), 1)); + return (__glibc_likely (__libc_alloca_cutoff (size)) +#ifdef PTHREAD_STACK_MIN + || __glibc_likely (size <= PTHREAD_STACK_MIN / 4) +#endif + ); } diff --git a/sysdeps/pthread/bits/sigthread.h b/sysdeps/pthread/bits/sigthread.h index 32ef1a974a..b1fb6150e4 100644 --- a/sysdeps/pthread/bits/sigthread.h +++ b/sysdeps/pthread/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 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 @@ -20,10 +20,11 @@ #define _BITS_SIGTHREAD_H 1 #if !defined _SIGNAL_H && !defined _PTHREAD_H -# error "Never include this file directly. Use <pthread.h> instead" +# error "Never include this file directly. Use <signal.h> instead" #endif /* Functions for handling signals. */ +#include <bits/types/__sigset_t.h> /* Modify the signal mask for the calling thread. The arguments have the same meaning as for sigprocmask(2). */ diff --git a/sysdeps/pthread/bits/types/sigevent_t.h b/sysdeps/pthread/bits/types/sigevent_t.h new file mode 100644 index 0000000000..f242f14615 --- /dev/null +++ b/sysdeps/pthread/bits/types/sigevent_t.h @@ -0,0 +1,18 @@ +#ifndef __sigevent_t_defined +#define __sigevent_t_defined 1 + +#include <bits/types.h> +#include <bits/types/__sigval_t.h> +#include <bits/pthreadtypes.h> + +/* Structure to transport application-defined values with signals. */ +typedef struct sigevent + { + __sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + void (*sigev_notify_function) (__sigval_t); /* Function to start. */ + pthread_attr_t *sigev_notify_attributes; /* Really pthread_attr_t.*/ + } sigevent_t; + +#endif diff --git a/sysdeps/pthread/flockfile.c b/sysdeps/pthread/flockfile.c index 4972da4453..4dc3f75035 100644 --- a/sysdeps/pthread/flockfile.c +++ b/sysdeps/pthread/flockfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -18,13 +18,13 @@ #include <pthread.h> #include <stdio.h> -#include <libio.h> #include <stdio-lock.h> void __flockfile (FILE *stream) { + stream->_flags2 |= _IO_FLAGS2_NEED_LOCK; _IO_lock_lock (*stream->_lock); } strong_alias (__flockfile, _IO_flockfile) diff --git a/sysdeps/pthread/ftrylockfile.c b/sysdeps/pthread/ftrylockfile.c index c899fcc6bf..3fff61f3c6 100644 --- a/sysdeps/pthread/ftrylockfile.c +++ b/sysdeps/pthread/ftrylockfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/pthread/funlockfile.c b/sysdeps/pthread/funlockfile.c index 866266af2b..27afe8c131 100644 --- a/sysdeps/pthread/funlockfile.c +++ b/sysdeps/pthread/funlockfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -18,7 +18,6 @@ #include <pthread.h> #include <stdio.h> -#include <libio.h> #include <stdio-lock.h> diff --git a/sysdeps/pthread/lio_listio.c b/sysdeps/pthread/lio_listio.c index da83889c8e..ebf3c21fba 100644 --- a/sysdeps/pthread/lio_listio.c +++ b/sysdeps/pthread/lio_listio.c @@ -1,5 +1,5 @@ /* Enqueue and list of read or write requests. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -107,14 +107,7 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, pthread_mutex_unlock (&__aio_requests_mutex); if (LIO_MODE (mode) == LIO_NOWAIT) - { -#ifdef BROKEN_THREAD_SIGNALS - __aio_notify_only (sig, - sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0); -#else __aio_notify_only (sig); -#endif - } return result; } @@ -140,9 +133,6 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, waitlist[cnt].next = requests[cnt]->waiting; waitlist[cnt].counterp = &total; waitlist[cnt].sigevp = NULL; -#ifdef BROKEN_THREAD_SIGNALS - waitlist[cnt].caller_pid = 0; /* Not needed. */ -#endif requests[cnt]->waiting = &waitlist[cnt]; ++total; } @@ -190,9 +180,6 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, } else { -#ifdef BROKEN_THREAD_SIGNALS - pid_t caller_pid = sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0; -#endif total = 0; for (cnt = 0; cnt < nent; ++cnt) @@ -209,9 +196,6 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, waitlist->list[cnt].next = requests[cnt]->waiting; waitlist->list[cnt].counterp = &waitlist->counter; waitlist->list[cnt].sigevp = &waitlist->sigev; -#ifdef BROKEN_THREAD_SIGNALS - waitlist->list[cnt].caller_pid = caller_pid; -#endif requests[cnt]->waiting = &waitlist->list[cnt]; ++total; } diff --git a/sysdeps/pthread/lio_listio64.c b/sysdeps/pthread/lio_listio64.c index b5558517d1..09f098aceb 100644 --- a/sysdeps/pthread/lio_listio64.c +++ b/sysdeps/pthread/lio_listio64.c @@ -1,5 +1,5 @@ /* Enqueue and list of read or write requests, 64bit offset version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/pthread/posix-timer.h b/sysdeps/pthread/posix-timer.h index 0782a0715e..d7af9a017a 100644 --- a/sysdeps/pthread/posix-timer.h +++ b/sysdeps/pthread/posix-timer.h @@ -1,5 +1,5 @@ /* Definitions for POSIX timer implementation on top of NPTL. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -87,7 +87,7 @@ extern struct thread_node __timer_signal_thread_rclk; /* Return pointer to timer structure corresponding to ID. */ #define timer_id2ptr(timerid) ((struct timer_node *) timerid) -#define timer_ptr2id(timerid) ((void *) timerid) +#define timer_ptr2id(timerid) ((timer_t) timerid) /* Check whether timer is valid; global mutex must be held. */ static inline int diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h index 9927db7667..ff672ebd24 100644 --- a/sysdeps/pthread/semaphore.h +++ b/sysdeps/pthread/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 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 @@ -21,8 +21,7 @@ #include <features.h> #include <sys/types.h> #ifdef __USE_XOPEN2K -# define __need_timespec -# include <time.h> +# include <bits/types/struct_timespec.h> #endif /* Get the definition for sem_t. */ diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c index 887d38971a..2381a60d6f 100644 --- a/sysdeps/pthread/timer_create.c +++ b/sysdeps/pthread/timer_create.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -77,7 +77,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) { newtimer->event.sigev_notify = SIGEV_SIGNAL; newtimer->event.sigev_signo = SIGALRM; - newtimer->event.sigev_value.sival_ptr = timer_ptr2id (newtimer); + newtimer->event.sigev_value.sival_ptr = newtimer; newtimer->event.sigev_notify_function = 0; } diff --git a/sysdeps/pthread/timer_delete.c b/sysdeps/pthread/timer_delete.c index f8f335a07b..0daab37624 100644 --- a/sysdeps/pthread/timer_delete.c +++ b/sysdeps/pthread/timer_delete.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. diff --git a/sysdeps/pthread/timer_getoverr.c b/sysdeps/pthread/timer_getoverr.c index 07c2cc503a..edd519964d 100644 --- a/sysdeps/pthread/timer_getoverr.c +++ b/sysdeps/pthread/timer_getoverr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. diff --git a/sysdeps/pthread/timer_gettime.c b/sysdeps/pthread/timer_gettime.c index c93e3358a7..f5f060afec 100644 --- a/sysdeps/pthread/timer_gettime.c +++ b/sysdeps/pthread/timer_gettime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -50,7 +50,7 @@ timer_gettime (timer_t timerid, struct itimerspec *value) { if (armed) { - clock_gettime (clock, &now); + __clock_gettime (clock, &now); if (timespec_compare (&now, &expiry) < 0) timespec_sub (&value->it_value, &expiry, &now); else diff --git a/sysdeps/pthread/timer_routines.c b/sysdeps/pthread/timer_routines.c index 7aa4437a61..c12246792b 100644 --- a/sysdeps/pthread/timer_routines.c +++ b/sysdeps/pthread/timer_routines.c @@ -1,5 +1,5 @@ /* Helper code for POSIX timer implementation on NPTL. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -29,8 +29,11 @@ #include <sys/syscall.h> #include "posix-timer.h" -#include <nptl/pthreadP.h> +#include <timer_routines.h> +#ifndef DELAYTIMER_MAX +# define DELAYTIMER_MAX INT_MAX +#endif /* Number of threads used. */ #define THREAD_MAXNODES 16 @@ -373,7 +376,7 @@ thread_func (void *arg) /* This assumes that the elements of the list of one thread are all for the same clock. */ - clock_gettime (timer->clock, &now); + __clock_gettime (timer->clock, &now); while (1) { @@ -460,10 +463,14 @@ int __timer_thread_start (struct thread_node *thread) { int retval = 1; + sigset_t set, oset; assert (!thread->exists); thread->exists = 1; + sigfillset (&set); + pthread_sigmask (SIG_SETMASK, &set, &oset); + if (pthread_create (&thread->id, &thread->attr, (void *(*) (void *)) thread_func, thread) != 0) { @@ -471,6 +478,8 @@ __timer_thread_start (struct thread_node *thread) retval = -1; } + pthread_sigmask (SIG_SETMASK, &oset, NULL); + return retval; } @@ -482,31 +491,6 @@ __timer_thread_wakeup (struct thread_node *thread) } -/* Compare two pthread_attr_t thread attributes for exact equality. - Returns 1 if they are equal, otherwise zero if they are not equal - or contain illegal values. This version is NPTL-specific for - performance reason. One could use the access functions to get the - values of all the fields of the attribute structure. */ -static int -thread_attr_compare (const pthread_attr_t *left, const pthread_attr_t *right) -{ - struct pthread_attr *ileft = (struct pthread_attr *) left; - struct pthread_attr *iright = (struct pthread_attr *) right; - - return (ileft->flags == iright->flags - && ileft->schedpolicy == iright->schedpolicy - && (ileft->schedparam.sched_priority - == iright->schedparam.sched_priority) - && ileft->guardsize == iright->guardsize - && ileft->stackaddr == iright->stackaddr - && ileft->stacksize == iright->stacksize - && ((ileft->cpuset == NULL && iright->cpuset == NULL) - || (ileft->cpuset != NULL && iright->cpuset != NULL - && ileft->cpusetsize == iright->cpusetsize - && memcmp (ileft->cpuset, iright->cpuset, - ileft->cpusetsize) == 0))); -} - /* Search the list of active threads and find one which has matching attributes. Global mutex lock must be held by caller. */ diff --git a/sysdeps/pthread/timer_settime.c b/sysdeps/pthread/timer_settime.c index 4de6bd9efb..8a71a506f8 100644 --- a/sysdeps/pthread/timer_settime.c +++ b/sysdeps/pthread/timer_settime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -55,7 +55,7 @@ timer_settime (timer_t timerid, int flags, const struct itimerspec *value, if ((flags & TIMER_ABSTIME) == 0) { - clock_gettime (timer->clock, &now); + __clock_gettime (timer->clock, &now); have_now = 1; } @@ -80,7 +80,7 @@ timer_settime (timer_t timerid, int flags, const struct itimerspec *value, if (! have_now) { pthread_mutex_unlock (&__timer_mutex); - clock_gettime (timer->clock, &now); + __clock_gettime (timer->clock, &now); have_now = 1; pthread_mutex_lock (&__timer_mutex); timer_addref (timer); diff --git a/sysdeps/pthread/tst-timer.c b/sysdeps/pthread/tst-timer.c index d3c9762899..7a943afb7c 100644 --- a/sysdeps/pthread/tst-timer.c +++ b/sysdeps/pthread/tst-timer.c @@ -1,5 +1,5 @@ /* Tests for POSIX timer implementation. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -23,6 +23,7 @@ #include <time.h> #include <unistd.h> #include <stdlib.h> +#include <stdint.h> static void |