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.
This commit is contained in:
Ulrich Drepper 2001-09-12 03:53:07 +00:00
parent 455e8060b0
commit 57642a7892
7 changed files with 49 additions and 25 deletions

View File

@ -1,3 +1,8 @@
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.
2001-09-08 Ben Collins <bcollins@debian.org> 2001-09-08 Ben Collins <bcollins@debian.org>
* sysdeps/arm/dl-machine.h (elf_machine_rel): Fix thinko in * sysdeps/arm/dl-machine.h (elf_machine_rel): Fix thinko in

View File

@ -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> 2001-08-29 Ulrich Drepper <drepper@redhat.com>
* spinlock.c (__pthread_lock): Top max_count value with * spinlock.c (__pthread_lock): Top max_count value with

View File

@ -77,7 +77,8 @@ void __pthread_do_exit(void *retval, char *currentframe)
if (self == __pthread_main_thread && __pthread_manager_request >= 0) { if (self == __pthread_main_thread && __pthread_manager_request >= 0) {
request.req_thread = self; request.req_thread = self;
request.req_kind = REQ_MAIN_THREAD_EXIT; 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); suspend(self);
/* Main thread flushes stdio streams and runs atexit functions. /* Main thread flushes stdio streams and runs atexit functions.
It also calls a handler within LinuxThreads which sends a process exit 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_thread = self;
request.req_kind = REQ_FREE; request.req_kind = REQ_FREE;
request.req_args.free.thread_id = thread_id; request.req_args.free.thread_id = thread_id;
__libc_write(__pthread_manager_request, TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)); (char *) &request, sizeof(request)));
} }
return 0; return 0;
} }
@ -210,8 +211,8 @@ int pthread_detach(pthread_t thread_id)
request.req_thread = thread_self(); request.req_thread = thread_self();
request.req_kind = REQ_FREE; request.req_kind = REQ_FREE;
request.req_args.free.thread_id = thread_id; request.req_args.free.thread_id = thread_id;
__libc_write(__pthread_manager_request, TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)); (char *) &request, sizeof(request)));
} }
return 0; return 0;
} }

View File

@ -130,7 +130,8 @@ __pthread_manager(void *arg)
/* Raise our priority to match that of main thread */ /* Raise our priority to match that of main thread */
__pthread_manager_adjust_prio(__pthread_main_thread->p_priority); __pthread_manager_adjust_prio(__pthread_main_thread->p_priority);
/* Synchronize debugging of the thread manager */ /* 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); ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG);
ufd.fd = reqfd; ufd.fd = reqfd;
ufd.events = POLLIN; ufd.events = POLLIN;
@ -150,8 +151,17 @@ __pthread_manager(void *arg)
} }
/* Read and execute request */ /* Read and execute request */
if (n == 1 && (ufd.revents & POLLIN)) { if (n == 1 && (ufd.revents & POLLIN)) {
n = __libc_read(reqfd, (char *)&request, sizeof(request)); n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
ASSERT(n == sizeof(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) { switch(request.req_kind) {
case REQ_CREATE: case REQ_CREATE:
request.req_thread->p_retcode = request.req_thread->p_retcode =
@ -266,8 +276,8 @@ pthread_start_thread(void *arg)
if (__pthread_threads_debug && __pthread_sig_debug > 0) { if (__pthread_threads_debug && __pthread_sig_debug > 0) {
request.req_thread = self; request.req_thread = self;
request.req_kind = REQ_DEBUG; request.req_kind = REQ_DEBUG;
__libc_write(__pthread_manager_request, TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)); (char *) &request, sizeof(request)));
suspend(self); suspend(self);
} }
/* Run the thread code */ /* Run the thread code */
@ -921,7 +931,8 @@ void __pthread_manager_sighandler(int sig)
struct pthread_request request; struct pthread_request request;
request.req_thread = 0; request.req_thread = 0;
request.req_kind = REQ_KICK; 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)));
} }
} }

View File

@ -631,7 +631,8 @@ int __pthread_initialize_manager(void)
} }
/* Synchronize debugging of the thread manager */ /* Synchronize debugging of the thread manager */
request.req_kind = REQ_DEBUG; 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; 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; request.req_args.create.arg = arg;
sigprocmask(SIG_SETMASK, (const sigset_t *) NULL, sigprocmask(SIG_SETMASK, (const sigset_t *) NULL,
&request.req_args.create.mask); &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); suspend(self);
retval = THREAD_GETMEM(self, p_retcode); retval = THREAD_GETMEM(self, p_retcode);
if (__builtin_expect (retval, 0) == 0) 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_thread = self;
request.req_kind = REQ_PROCESS_EXIT; request.req_kind = REQ_PROCESS_EXIT;
request.req_args.exit.code = retcode; request.req_args.exit.code = retcode;
__libc_write(__pthread_manager_request, TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)); (char *) &request, sizeof(request)));
suspend(self); suspend(self);
/* Main thread should accumulate times for thread manager and its /* Main thread should accumulate times for thread manager and its
children, so that timings for main thread account for all threads. */ children, so that timings for main thread account for all threads. */
@ -1151,7 +1153,7 @@ void __pthread_message(char * fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args); vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args);
va_end(args); va_end(args);
__libc_write(2, buffer, strlen(buffer)); TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer)));
} }
#endif #endif

View File

@ -168,8 +168,8 @@ int __new_sem_post(sem_t * sem)
} }
request.req_kind = REQ_POST; request.req_kind = REQ_POST;
request.req_args.post = sem; request.req_args.post = sem;
__libc_write(__pthread_manager_request, TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)); (char *) &request, sizeof(request)));
} }
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. /* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -219,10 +219,6 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
vec[2].iov_base = cp; vec[2].iov_base = cp;
vec[2].iov_len = hst_resp.h_addr_list_cnt * INADDRSZ; vec[2].iov_len = hst_resp.h_addr_list_cnt * INADDRSZ;
ignore = alloca (hst_resp.h_addr_list_cnt * IN6ADDRSZ);
vec[3].iov_base = ignore;
vec[3].iov_len = hst_resp.h_addr_list_cnt * IN6ADDRSZ;
for (cnt = 0; cnt < hst_resp.h_addr_list_cnt; ++cnt) for (cnt = 0; cnt < hst_resp.h_addr_list_cnt; ++cnt)
{ {
resultbuf->h_addr_list[cnt] = cp; resultbuf->h_addr_list[cnt] = cp;
@ -232,9 +228,9 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
resultbuf->h_addrtype = AF_INET; resultbuf->h_addrtype = AF_INET;
resultbuf->h_length = INADDRSZ; resultbuf->h_length = INADDRSZ;
total_len += hst_resp.h_addr_list_cnt * (INADDRSZ + IN6ADDRSZ); total_len += hst_resp.h_addr_list_cnt * INADDRSZ;
n = 4; n = 3;
} }
else else
{ {