aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-12 03:53:07 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-12 03:53:07 +0000
commit57642a78929e35d58c25f416f523670effdc0f70 (patch)
treeaf543e6c01f354fe5894b66dbf382962a9d1e791 /linuxthreads
parent455e8060b03bc12a2b3a25c9be92b5e420d806fd (diff)
downloadglibc-57642a78929e35d58c25f416f523670effdc0f70.zip
glibc-57642a78929e35d58c25f416f523670effdc0f70.tar.gz
glibc-57642a78929e35d58c25f416f523670effdc0f70.tar.bz2
Update.
2001-09-11 Ulrich Drepper <drepper@redhat.com> * nscd/nscd_gethst_r.c: Don't expect IPv6 addresses for IPv4 lookup. Patch by Stephan Kulow.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog9
-rw-r--r--linuxthreads/join.c11
-rw-r--r--linuxthreads/manager.c23
-rw-r--r--linuxthreads/pthread.c12
-rw-r--r--linuxthreads/semaphore.c4
5 files changed, 41 insertions, 18 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index b85f8c9..b4c474a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-11 Ulrich Drepper <drepper@redhat.com>
+ Wolfram Gloger <wg@malloc.de>
+
+ * join.c: Protect all communications from and to manager with
+ TEMP_FAILURE_RETRY.
+ * manager.c: Likewise.
+ * pthread.c: Likewise.
+ * smeaphore.c: Likewise.
+
2001-08-29 Ulrich Drepper <drepper@redhat.com>
* spinlock.c (__pthread_lock): Top max_count value with
diff --git a/linuxthreads/join.c b/linuxthreads/join.c
index a0cdb41..a6ed08c 100644
--- a/linuxthreads/join.c
+++ b/linuxthreads/join.c
@@ -77,7 +77,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;
- __libc_write(__pthread_manager_request, (char *)&request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__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
@@ -172,8 +173,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;
- __libc_write(__pthread_manager_request,
- (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
}
return 0;
}
@@ -210,8 +211,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;
- __libc_write(__pthread_manager_request,
- (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
}
return 0;
}
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index c7fd965..41f53f3 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -130,7 +130,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 = __libc_read(reqfd, (char *)&request, sizeof(request));
+ n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
+ sizeof(request)));
ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG);
ufd.fd = reqfd;
ufd.events = POLLIN;
@@ -150,8 +151,17 @@ __pthread_manager(void *arg)
}
/* Read and execute request */
if (n == 1 && (ufd.revents & POLLIN)) {
- n = __libc_read(reqfd, (char *)&request, sizeof(request));
- ASSERT(n == sizeof(request));
+ n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
+ sizeof(request)));
+#ifdef DEBUG
+ if (n < 0) {
+ char d[64];
+ write(STDERR_FILENO, d, snprintf(d, sizeof(d), "*** read err %m\n"));
+ } else if (n != sizeof(request)) {
+ write(STDERR_FILENO, "*** short read in manager\n", 26);
+ }
+#endif
+
switch(request.req_kind) {
case REQ_CREATE:
request.req_thread->p_retcode =
@@ -266,8 +276,8 @@ pthread_start_thread(void *arg)
if (__pthread_threads_debug && __pthread_sig_debug > 0) {
request.req_thread = self;
request.req_kind = REQ_DEBUG;
- __libc_write(__pthread_manager_request,
- (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
suspend(self);
}
/* Run the thread code */
@@ -921,7 +931,8 @@ void __pthread_manager_sighandler(int sig)
struct pthread_request request;
request.req_thread = 0;
request.req_kind = REQ_KICK;
- __libc_write(__pthread_manager_request, (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
}
}
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 721da9b..f87413b 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -631,7 +631,8 @@ int __pthread_initialize_manager(void)
}
/* Synchronize debugging of the thread manager */
request.req_kind = REQ_DEBUG;
- __libc_write(__pthread_manager_request, (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
return 0;
}
@@ -653,7 +654,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);
- __libc_write(__pthread_manager_request, (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
suspend(self);
retval = THREAD_GETMEM(self, p_retcode);
if (__builtin_expect (retval, 0) == 0)
@@ -785,8 +787,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;
- __libc_write(__pthread_manager_request,
- (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__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. */
@@ -1151,7 +1153,7 @@ void __pthread_message(char * fmt, ...)
va_start(args, fmt);
vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args);
va_end(args);
- __libc_write(2, buffer, strlen(buffer));
+ TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer)));
}
#endif
diff --git a/linuxthreads/semaphore.c b/linuxthreads/semaphore.c
index d3a1450..e0dac41 100644
--- a/linuxthreads/semaphore.c
+++ b/linuxthreads/semaphore.c
@@ -168,8 +168,8 @@ int __new_sem_post(sem_t * sem)
}
request.req_kind = REQ_POST;
request.req_args.post = sem;
- __libc_write(__pthread_manager_request,
- (char *) &request, sizeof(request));
+ TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+ (char *) &request, sizeof(request)));
}
return 0;
}