From fbf86ddab2cd53c0a63173c1eb8b39c2b970fb8d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 1 Jun 2004 18:53:04 +0000 Subject: [PATCH] Update. 2004-05-10 Jakub Jelinek * sysdeps/posix/sysconf.c (__sysconf) : Return _POSIX_* value instead of 1. * sysdeps/unix/sysv/linux/sysconf.c (__sysconf) : Return _POSIX_VERSION instead of 1. 2004-05-07 Jeroen Dekkers * sysdeps/mach/hurd/i386/Makefile (CFLAGS-init-first.c): Add -momit-leaf-frame-pointer. * inet/test-ifaddrs.c (addr_string): Surround AF_PACKET case with #ifdef AF_PACKET. * sysdeps/mach/hurd/getcwd.c (_hurd_canonicalize_directory_name_intern): Only realloc when size is <= 0. * sysdeps/mach/hurd/mmap.c (__mmap): Fail when addr or offset isn't page aligned. * sysdeps/mach/hurd/spawni.c (EXPAND_DTABLE): Set dtablesize to new size. * sysdeps/mach/hurd/Versions (GLIBC_PRIVATE): Add __libc_read, __libc_write and __libc_lseek64. --- ChangeLog | 35 +++++++++++++++ inet/test-ifaddrs.c | 2 + nptl/ChangeLog | 17 +++++++ .../unix/sysv/linux/sh/bits/pthreadtypes.h | 1 + .../sysv/linux/sh/pthread_cond_broadcast.S | 5 +++ .../sysv/linux/sh/pthread_cond_timedwait.S | 37 ++++++++++++++-- .../unix/sysv/linux/sh/pthread_cond_wait.S | 22 ++++++++++ sysdeps/mach/hurd/Versions | 3 ++ sysdeps/mach/hurd/getcwd.c | 7 +-- sysdeps/mach/hurd/i386/Makefile | 3 ++ sysdeps/mach/hurd/mmap.c | 24 +++------- sysdeps/mach/hurd/spawni.c | 5 ++- sysdeps/posix/sysconf.c | 44 +++++++++---------- sysdeps/unix/sysv/linux/sysconf.c | 2 +- 14 files changed, 156 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e0f97e883..745dc0e2c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2004-05-10 Jakub Jelinek + + * sysdeps/posix/sysconf.c (__sysconf) : Return _POSIX_* value instead of 1. + * sysdeps/unix/sysv/linux/sysconf.c (__sysconf) + : Return _POSIX_VERSION instead of 1. + +2004-05-07 Jeroen Dekkers + + * sysdeps/mach/hurd/i386/Makefile (CFLAGS-init-first.c): Add + -momit-leaf-frame-pointer. + + * inet/test-ifaddrs.c (addr_string): Surround AF_PACKET case with + #ifdef AF_PACKET. + + * sysdeps/mach/hurd/getcwd.c + (_hurd_canonicalize_directory_name_intern): Only realloc when + size is <= 0. + + * sysdeps/mach/hurd/mmap.c (__mmap): Fail when addr or offset + isn't page aligned. + + * sysdeps/mach/hurd/spawni.c (EXPAND_DTABLE): Set dtablesize to + new size. + + * sysdeps/mach/hurd/Versions (GLIBC_PRIVATE): Add __libc_read, + __libc_write and __libc_lseek64. + 2004-05-29 Roland McGrath * elf/Makefile (shared-only-routines): Add dl-caller. diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c index 185859e323..7efca25337 100644 --- a/inet/test-ifaddrs.c +++ b/inet/test-ifaddrs.c @@ -48,8 +48,10 @@ addr_string (struct sockaddr *sa, char *buf, size_t size) case AF_UNSPEC: return "---"; +#ifdef AF_PACKET case AF_PACKET: return ""; +#endif default: ++failures; diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 9164affc9d..071e7048cc 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,20 @@ +2004-06-01 Kaz Kojima + + * sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_cond_t): + Add __broadcast_seq field. + * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: Mark + all waiters as woken with woken_seq and bump broadcast counter. + * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Use new + __broadcast_seq. Increment __woken_seq correctly when cleanuped. + * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Likewise. + Comment typo fixes. Avoid returning -ETIMEDOUT. + +2004-06-01 Ulrich Drepper + + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S + (__condvar_tw_cleanup): Fix access to saved broadcast_seq value. + Reported by Kaz Kojima. + 2004-05-25 Jakub Jelinek * sysdeps/unix/sysv/linux/aio_misc.h: New file. diff --git a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h index 7d05908778..2a4c95a083 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h @@ -82,6 +82,7 @@ typedef union unsigned long long int __wakeup_seq; unsigned long long int __woken_seq; void *__mutex; + unsigned int __broadcast_seq; } __data; char __size[__SIZEOF_PTHREAD_COND_T]; long long int __align; diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S index a433ba3c37..4277c9a111 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S @@ -67,6 +67,11 @@ __pthread_cond_broadcast: woken up. */ mov.l r1, @(wakeup_seq,r8) mov.l r0, @(wakeup_seq+4,r8) + mov.l r1, @(woken_seq,r8) + mov.l r0, @(woken_seq+4,r8) + mov.l @(broadcast_seq,r8), r2 + add #1, r2 + mov.l r2, @(broadcast_seq,r8) /* Get the address of the mutex used. */ mov.l @(dep_mutex,r8), r9 diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S index ab3bbe035a..b9d8f5b920 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -114,6 +114,8 @@ __pthread_cond_timedwait: /* Get and store current wakeup_seq value. */ mov.l @(wakeup_seq,r8), r10 mov.l @(wakeup_seq+4,r8), r11 + mov.l @(broadcast_seq,r8), r0 + mov.l r0, @(4,r15) 8: /* Get current time. */ @@ -140,8 +142,10 @@ __pthread_cond_timedwait: add r1, r3 add #-1, r2 12: + mov #-ETIMEDOUT, r1 + mov.l r1, @(12,r15) cmp/pz r2 - bf 13f /* Time is already up. */ + bf 6f /* Time is already up. */ /* Store relative timeout. */ mov.l r2, @(16,r15) @@ -193,6 +197,11 @@ __pthread_cond_timedwait: #endif bf 5f 6: + mov.l @(broadcast_seq,r8), r0 + mov.l @(4,r15), r1 + cmp/eq r0, r1 + bf 23f + mov.l @(woken_seq,r8), r0 mov.l @(woken_seq+4,r8), r1 @@ -212,7 +221,7 @@ __pthread_cond_timedwait: mov.l @(12,r15),r0 cmp/eq #-ETIMEDOUT, r0 bf 8b -13: + mov #1, r2 mov #0, r3 @@ -227,6 +236,11 @@ __pthread_cond_timedwait: bra 14f mov.l r0, @(24,r15) +23: + mov #0, r0 + bra 24f + mov.l r0, @(24,r15) + 9: mov #0, r0 mov.l r0, @(24,r15) @@ -242,6 +256,7 @@ __pthread_cond_timedwait: mov.l r0,@(woken_seq,r8) mov.l r1,@(woken_seq+4,r8) +24: #if cond_lock != 0 DEC (@(cond_lock,r8), r2) #else @@ -301,7 +316,7 @@ __pthread_cond_timedwait: nop 3: - /* Unlock in loop requires waekup. */ + /* Unlock in loop requires wakeup. */ mov r8, r4 #if cond_lock != 0 add #cond_lock, r4 @@ -327,7 +342,7 @@ __pthread_cond_timedwait: nop 10: - /* Unlock after loop requires waekup. */ + /* Unlock after loop requires wakeup. */ mov r8, r4 #if cond_lock != 0 add #cond_lock, r4 @@ -403,6 +418,11 @@ __condvar_tw_cleanup: .Lmwait5b: 1: + mov.l @(broadcast_seq,r8), r0 + mov.l @(4,r15), r1 + cmp/eq r0, r1 + bf 3f + mov #1, r2 mov #0, r3 @@ -414,6 +434,15 @@ __condvar_tw_cleanup: mov.l r0,@(wakeup_seq,r8) mov.l r1,@(wakeup_seq+4,r8) + clrt + mov.l @(woken_seq,r8),r0 + mov.l @(woken_seq+4,r8),r1 + addc r2, r0 + addc r3, r1 + mov.l r0,@(woken_seq,r8) + mov.l r1,@(woken_seq+4,r8) + +3: #if cond_lock != 0 DEC (@(cond_lock,r8), r2) #else diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S index c93a304363..6068de8f42 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S @@ -108,6 +108,8 @@ __pthread_cond_wait: /* Get and store current wakeup_seq value. */ mov.l @(wakeup_seq,r8), r10 mov.l @(wakeup_seq+4,r8), r11 + mov.l @(broadcast_seq,r8), r0 + mov.l r0, @(4,r15) 8: /* Unlock. */ @@ -152,6 +154,11 @@ __pthread_cond_wait: #endif bf 5f 6: + mov.l @(broadcast_seq,r8), r0 + mov.l @(4,r15), r1 + cmp/eq r0, r1 + bf 16f + mov.l @(woken_seq,r8), r0 mov.l @(woken_seq+4,r8), r1 @@ -179,6 +186,7 @@ __pthread_cond_wait: mov.l r0,@(woken_seq,r8) mov.l r1,@(woken_seq+4,r8) +16: #if cond_lock != 0 DEC (@(cond_lock,r8), r2) #else @@ -330,6 +338,11 @@ __condvar_w_cleanup: .Lmwait3b: 1: + mov.l @(broadcast_seq,r8), r0 + mov.l @(4,r15), r1 + cmp/eq r0, r1 + bf 3f + mov #1, r2 mov #0, r3 @@ -341,6 +354,15 @@ __condvar_w_cleanup: mov.l r0,@(wakeup_seq,r8) mov.l r1,@(wakeup_seq+4,r8) + clrt + mov.l @(woken_seq,r8),r0 + mov.l @(woken_seq+4,r8),r1 + addc r2, r0 + addc r3, r1 + mov.l r0,@(woken_seq,r8) + mov.l r1,@(woken_seq+4,r8) + +3: #if cond_lock != 0 DEC (@(cond_lock,r8), r2) #else diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions index dcaaae6146..89e19061af 100644 --- a/sysdeps/mach/hurd/Versions +++ b/sysdeps/mach/hurd/Versions @@ -4,6 +4,9 @@ libc { __getcwd; __mmap; } GLIBC_PRIVATE { + # Functions shared with the dynamic linker + __libc_read; __libc_write; __libc_lseek64; + _dl_init_first; } } diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index 510290460c..7e07e6b404 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,98,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,04 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 @@ -50,6 +50,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, file_t parent; char *dirbuf = NULL; unsigned int dirbufsize = 0; + const size_t orig_size = size; inline void cleanup (void) { @@ -67,7 +68,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, } - if (size == 0) + if (size <= 0) { if (buf != NULL) { @@ -226,7 +227,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, if (file_namep - file_name < d->d_namlen + 1) { - if (buf != NULL) + if (orig_size > 0) { errno = ERANGE; return NULL; diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile index 56fcba8fb9..e7d3b44682 100644 --- a/sysdeps/mach/hurd/i386/Makefile +++ b/sysdeps/mach/hurd/i386/Makefile @@ -3,3 +3,6 @@ sysdep_routines += ioperm sysdep_headers += sys/io.h endif +ifeq ($(subdir),csu) +CFLAGS-init-first.c += -momit-leaf-frame-pointer +endif diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c index 85bde529b9..1d1460cead 100644 --- a/sysdeps/mach/hurd/mmap.c +++ b/sysdeps/mach/hurd/mmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994,1995,1996,1997,1999,2002,2003 +/* Copyright (C) 1994,1995,1996,1997,1999,2002,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -39,10 +39,13 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) vm_prot_t vmprot; memory_object_t memobj; vm_address_t mapaddr; - vm_size_t pageoff; mapaddr = (vm_address_t) addr; + /* ADDR and OFFSET must be page-aligned. */ + if ((mapaddr & (vm_page_size - 1)) || (offset & (vm_page_size - 1))) + return (__ptr_t) (long int) __hurd_fail (EINVAL); + if ((flags & (MAP_TYPE|MAP_INHERIT)) == MAP_ANON && prot == (PROT_READ|PROT_WRITE)) /* cf VM_PROT_DEFAULT */ { @@ -62,20 +65,6 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) return err ? (__ptr_t) (long int) __hurd_fail (err) : (__ptr_t) mapaddr; } - pageoff = offset & (vm_page_size - 1); - offset &= ~(vm_page_size - 1); - - if (flags & MAP_FIXED) - { - /* A specific address is requested. It need not be page-aligned; - it just needs to be congruent with the object offset. */ - if ((mapaddr & (vm_page_size - 1)) != pageoff) - return (__ptr_t) (long int) __hurd_fail (EINVAL); - else - /* We will add back PAGEOFF after mapping. */ - mapaddr -= pageoff; - } - vmprot = VM_PROT_NONE; if (prot & PROT_READ) vmprot |= VM_PROT_READ; @@ -173,9 +162,6 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) if (err) return (__ptr_t) (long int) __hurd_fail (err); - /* Adjust the mapping address for the offset-within-page. */ - mapaddr += pageoff; - return (__ptr_t) mapaddr; } diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c index 73b4d3507c..244ca2d6e1 100644 --- a/sysdeps/mach/hurd/spawni.c +++ b/sysdeps/mach/hurd/spawni.c @@ -1,5 +1,5 @@ /* spawn a new process running an executable. Hurd version. - Copyright (C) 2001,02 Free Software Foundation, Inc. + Copyright (C) 2001,02,04 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 @@ -399,6 +399,7 @@ __spawni (pid_t *pid, const char *file, NEW_TABLE (dtable, newfd); \ NEW_TABLE (ulink_dtable, newfd); \ NEW_TABLE (dtable_cells, newfd); \ + dtablesize = newfd + 1; \ } \ ((unsigned int)newfd < dtablesize ? 0 : EMFILE); \ }) @@ -592,7 +593,7 @@ __spawni (pid_t *pid, const char *file, case ESTALE: case ENOTDIR: /* Those errors indicate the file is missing or not executable -v by us, in which case we want to just try the next path + by us, in which case we want to just try the next path directory. */ continue; diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index 66f978ba3b..d1286a06fe 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -97,98 +97,98 @@ __sysconf (name) case _SC_REALTIME_SIGNALS: #ifdef _POSIX_REALTIME_SIGNALS - return 1; + return _POSIX_REALTIME_SIGNALS; #else return -1; #endif case _SC_PRIORITY_SCHEDULING: #ifdef _POSIX_PRIORITY_SCHEDULING - return 1; + return _POSIX_PRIORITY_SCHEDULING; #else return -1; #endif case _SC_TIMERS: #ifdef _POSIX_TIMERS - return 1; + return _POSIX_TIMERS; #else return -1; #endif case _SC_ASYNCHRONOUS_IO: #ifdef _POSIX_ASYNCHRONOUS_IO - return 1; + return _POSIX_ASYNCHRONOUS_IO; #else return -1; #endif case _SC_PRIORITIZED_IO: #ifdef _POSIX_PRIORITIZED_IO - return 1; + return _POSIX_PRIORITIZED_IO; #else return -1; #endif case _SC_SYNCHRONIZED_IO: #ifdef _POSIX_SYNCHRONIZED_IO - return 1; + return _POSIX_SYNCHRONIZED_IO; #else return -1; #endif case _SC_FSYNC: #ifdef _POSIX_FSYNC - return 1; + return _POSIX_FSYNC; #else return -1; #endif case _SC_MAPPED_FILES: #ifdef _POSIX_MAPPED_FILES - return 1; + return _POSIX_MAPPED_FILES; #else return -1; #endif case _SC_MEMLOCK: #ifdef _POSIX_MEMLOCK - return 1; + return _POSIX_MEMLOCK; #else return -1; #endif case _SC_MEMLOCK_RANGE: #ifdef _POSIX_MEMLOCK_RANGE - return 1; + return _POSIX_MEMLOCK_RANGE; #else return -1; #endif case _SC_MEMORY_PROTECTION: #ifdef _POSIX_MEMORY_PROTECTION - return 1; + return _POSIX_MEMORY_PROTECTION; #else return -1; #endif case _SC_MESSAGE_PASSING: #ifdef _POSIX_MESSAGE_PASSING - return 1; + return _POSIX_MESSAGE_PASSING; #else return -1; #endif case _SC_SEMAPHORES: #ifdef _POSIX_SEMAPHORES - return 1; + return _POSIX_SEMAPHORES; #else return -1; #endif case _SC_SHARED_MEMORY_OBJECTS: #ifdef _POSIX_SHARED_MEMORY_OBJECTS - return 1; + return _POSIX_SHARED_MEMORY_OBJECTS; #else return -1; #endif @@ -507,14 +507,14 @@ __sysconf (name) /* POSIX 1003.1c (POSIX Threads). */ case _SC_THREADS: #ifdef _POSIX_THREADS - return 1; + return _POSIX_THREADS; #else return -1; #endif case _SC_THREAD_SAFE_FUNCTIONS: #ifdef _POSIX_THREAD_SAFE_FUNCTIONS - return 1; + return _POSIX_THREAD_SAFE_FUNCTIONS; #else return -1; #endif @@ -569,42 +569,42 @@ __sysconf (name) case _SC_THREAD_ATTR_STACKADDR: #ifdef _POSIX_THREAD_ATTR_STACKADDR - return 1; + return _POSIX_THREAD_ATTR_STACKADDR; #else return -1; #endif case _SC_THREAD_ATTR_STACKSIZE: #ifdef _POSIX_THREAD_ATTR_STACKSIZE - return 1; + return _POSIX_THREAD_ATTR_STACKSIZE; #else return -1; #endif case _SC_THREAD_PRIORITY_SCHEDULING: #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - return 1; + return _POSIX_THREAD_PRIORITY_SCHEDULING; #else return -1; #endif case _SC_THREAD_PRIO_INHERIT: #ifdef _POSIX_THREAD_PRIO_INHERIT - return 1; + return _POSIX_THREAD_PRIO_INHERIT; #else return -1; #endif case _SC_THREAD_PRIO_PROTECT: #ifdef _POSIX_THREAD_PRIO_PROTECT - return 1; + return _POSIX_THREAD_PRIO_PROTECT; #else return -1; #endif case _SC_THREAD_PROCESS_SHARED: #ifdef _POSIX_THREAD_PROCESS_SHARED - return 1; + return _POSIX_THREAD_PROCESS_SHARED; #else return -1; #endif diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index de07e8062f..3cf6aa70bb 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -44,7 +44,7 @@ __sysconf (int name) INTERNAL_SYSCALL_DECL (err); int r; r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); - return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : 1; + return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : _POSIX_VERSION; } #endif