From 27b0258934adb212b760ead998d51f8005224abc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 3 May 2004 22:40:52 +0000 Subject: Update. 2004-04-23 Jakub Jelinek * sysdeps/ia64/fpu/libm_support.h (__libm_error_support): Add libc_hidden_proto. Define to __GI___libm_error_support for assembly going into libc.so. * sysdeps/ia64/fpu/libc_libm_error.c (__libm_error_support): Add libc_hidden_def. * include/libc-symbols.h (HIDDEN_BUILTIN_JUMPTARGET): Define. * sysdeps/ia64/bcopy.S (bcopy): Use it for jump to memmove. * sysdeps/unix/sysv/linux/ia64/sysdep.S (__syscall_error): Access gprel errno if RTLD_PRIVATE_ERRNO or __thread __libc_errno/errno if USE___THREAD. --- linuxthreads/ChangeLog | 24 ++++++++++++++++++++++++ linuxthreads/join.c | 13 +++++++------ linuxthreads/manager.c | 19 ++++++++++--------- linuxthreads/pthread.c | 41 +++++++++++++++++++++-------------------- linuxthreads/semaphore.c | 5 +++-- linuxthreads/specific.c | 6 +++--- 6 files changed, 68 insertions(+), 40 deletions(-) (limited to 'linuxthreads') diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index d79cf86ba6..5840521e28 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,27 @@ +2004-05-02 Jakub Jelinek + + * manager.c: Include not-cancel.h. + (__pthread_manager): Use read_not_cancel instead of __libc_read. + (pthread_start_thread, __pthread_manager_sighandler): Use + write_not_cancel instead of __libc_write. + (pthread_reap_children): Use waitpid_not_cancel instead of + __libc_waitpid. + * pthread.c: Include not-cancel.h. + (__pthread_initialize_minimal, __pthread_create_2_1, + pthread_onexit_process, __pthread_message): Use + write_not_cancel instead of __libc_write. + (__pthread_initialize_manager): Likewise. Use close_not_cancel + instead of __libc_close. + (__pthread_reset_main_thread): Use close_not_cancel instead of + __libc_close. + * join.c: Include not-cancel.h. + (__pthread_do_exit, pthread_join, pthread_detach): Use + write_not_cancel instead of __libc_write. + * semaphore.c: Include not-cancel.h. + (__new_sem_post): Use write_not_cancel instead of __libc_write. + * specific.c: Include not-cancel.h. + (pthread_key_delete): Use write_not_cancel instead of __libc_write. + 2004-05-01 Jakub Jelinek * Versions (libc): Add __on_exit and __libc_sigaction. diff --git a/linuxthreads/join.c b/linuxthreads/join.c index 3d204296fc..148f222319 100644 --- a/linuxthreads/join.c +++ b/linuxthreads/join.c @@ -22,6 +22,7 @@ #include "internals.h" #include "spinlock.h" #include "restart.h" +#include void __pthread_exit(void * retval) { @@ -78,8 +79,8 @@ void __pthread_do_exit(void *retval, char *currentframe) if (self == __pthread_main_thread && __pthread_manager_request >= 0) { request.req_thread = self; request.req_kind = REQ_MAIN_THREAD_EXIT; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *)&request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *)&request, sizeof(request))); suspend(self); /* Main thread flushes stdio streams and runs atexit functions. It also calls a handler within LinuxThreads which sends a process exit @@ -174,8 +175,8 @@ int pthread_join(pthread_t thread_id, void ** thread_return) request.req_thread = self; request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } @@ -212,8 +213,8 @@ int pthread_detach(pthread_t thread_id) request.req_thread = thread_self(); request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 876dd32772..f21a6def6f 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -36,6 +36,7 @@ #include "spinlock.h" #include "restart.h" #include "semaphore.h" +#include /* For debugging purposes put the maximum number of threads in a variable. */ const int __linuxthreads_pthread_threads_max = PTHREAD_THREADS_MAX; @@ -141,8 +142,8 @@ __pthread_manager(void *arg) /* Raise our priority to match that of main thread */ __pthread_manager_adjust_prio(__pthread_main_thread->p_priority); /* Synchronize debugging of the thread manager */ - n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, - sizeof(request))); + n = TEMP_FAILURE_RETRY(read_not_cancel(reqfd, (char *)&request, + sizeof(request))); ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG); ufd.fd = reqfd; ufd.events = POLLIN; @@ -162,8 +163,8 @@ __pthread_manager(void *arg) } /* Read and execute request */ if (n == 1 && (ufd.revents & POLLIN)) { - n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, - sizeof(request))); + n = TEMP_FAILURE_RETRY(read_not_cancel(reqfd, (char *)&request, + sizeof(request))); #ifdef DEBUG if (n < 0) { char d[64]; @@ -301,8 +302,8 @@ pthread_start_thread(void *arg) if (__pthread_threads_debug && __pthread_sig_debug > 0) { request.req_thread = self; request.req_kind = REQ_DEBUG; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); } /* Run the thread code */ @@ -970,7 +971,7 @@ static void pthread_reap_children(void) pid_t pid; int status; - while ((pid = __libc_waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) { + while ((pid = waitpid_not_cancel(-1, &status, WNOHANG | __WCLONE)) > 0) { pthread_exited(pid); if (WIFSIGNALED(status)) { /* If a thread died due to a signal, send the same signal to @@ -1090,8 +1091,8 @@ void __pthread_manager_sighandler(int sig) struct pthread_request request; request.req_thread = 0; request.req_kind = REQ_KICK; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); } } diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index 124aa5243d..6c98d73255 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -34,6 +34,7 @@ #include #include #include +#include /* Sanity check. */ #if !defined __SIGRTMIN || (__SIGRTMAX - __SIGRTMIN) < 3 @@ -328,8 +329,8 @@ __pthread_initialize_minimal(void) { static const char msg[] = "\ cannot allocate TLS data structures for initial thread\n"; - TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO, - msg, sizeof msg - 1)); + TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO, + msg, sizeof msg - 1)); abort (); } const char *lossage = TLS_INIT_TP (tcbp, 0); @@ -337,11 +338,11 @@ cannot allocate TLS data structures for initial thread\n"; { static const char msg[] = "cannot set up thread-local storage: "; const char nl = '\n'; - TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO, - msg, sizeof msg - 1)); - TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO, - lossage, strlen (lossage))); - TEMP_FAILURE_RETRY (__libc_write (STDERR_FILENO, &nl, 1)); + TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO, + msg, sizeof msg - 1)); + TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO, + lossage, strlen (lossage))); + TEMP_FAILURE_RETRY (write_not_cancel (STDERR_FILENO, &nl, 1)); } /* Though it was allocated with libc's malloc, that was done without @@ -657,8 +658,8 @@ int __pthread_initialize_manager(void) tcbp = _dl_allocate_tls (NULL); if (tcbp == NULL) { free(__pthread_manager_thread_bos); - __libc_close(manager_pipe[0]); - __libc_close(manager_pipe[1]); + close_not_cancel(manager_pipe[0]); + close_not_cancel(manager_pipe[1]); return -1; } @@ -787,8 +788,8 @@ int __pthread_initialize_manager(void) _dl_deallocate_tls (tcbp, true); #endif free(__pthread_manager_thread_bos); - __libc_close(manager_pipe[0]); - __libc_close(manager_pipe[1]); + close_not_cancel(manager_pipe[0]); + close_not_cancel(manager_pipe[1]); return -1; } mgr->p_tid = 2* PTHREAD_THREADS_MAX + 1; @@ -803,8 +804,8 @@ int __pthread_initialize_manager(void) } /* Synchronize debugging of the thread manager */ request.req_kind = REQ_DEBUG; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); return 0; } @@ -826,8 +827,8 @@ int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr, request.req_args.create.arg = arg; sigprocmask(SIG_SETMASK, (const sigset_t *) NULL, &request.req_args.create.mask); - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); retval = THREAD_GETMEM(self, p_retcode); if (__builtin_expect (retval, 0) == 0) @@ -1004,8 +1005,8 @@ static void pthread_onexit_process(int retcode, void *arg) request.req_thread = self; request.req_kind = REQ_PROCESS_EXIT; request.req_args.exit.code = retcode; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); /* Main thread should accumulate times for thread manager and its children, so that timings for main thread account for all threads. */ @@ -1127,8 +1128,8 @@ void __pthread_reset_main_thread(void) free(__pthread_manager_thread_bos); __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL; /* Close the two ends of the pipe */ - __libc_close(__pthread_manager_request); - __libc_close(__pthread_manager_reader); + close_not_cancel(__pthread_manager_request); + close_not_cancel(__pthread_manager_reader); __pthread_manager_request = __pthread_manager_reader = -1; } @@ -1399,7 +1400,7 @@ void __pthread_message(const char * fmt, ...) va_start(args, fmt); vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args); va_end(args); - TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer))); + TEMP_FAILURE_RETRY(write_not_cancel(2, buffer, strlen(buffer))); } #endif diff --git a/linuxthreads/semaphore.c b/linuxthreads/semaphore.c index 0793a5f712..017539e176 100644 --- a/linuxthreads/semaphore.c +++ b/linuxthreads/semaphore.c @@ -22,6 +22,7 @@ #include "restart.h" #include "queue.h" #include +#include int __new_sem_init(sem_t *sem, int pshared, unsigned int value) { @@ -168,8 +169,8 @@ int __new_sem_post(sem_t * sem) } request.req_kind = REQ_POST; request.req_args.post = sem; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c index aa8fcb5ab3..f54fabaeb9 100644 --- a/linuxthreads/specific.c +++ b/linuxthreads/specific.c @@ -22,7 +22,7 @@ #include "spinlock.h" #include "restart.h" #include - +#include /* Table of keys. */ @@ -120,8 +120,8 @@ int pthread_key_delete(pthread_key_t key) request.req_args.for_each.arg = &args; request.req_args.for_each.fn = pthread_key_delete_helper; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, - (char *) &request, sizeof(request))); + TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); } -- cgit v1.2.3