From dd486f53ee367e1667c61ec1fffdb59f9a8130e9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 6 Jan 2006 09:23:26 +0000 Subject: Updated to fedora-glibc-20060106T0916 --- ChangeLog | 81 ++++++++++++ abi-tags | 2 + elf/cache.c | 3 +- fedora/branch.mk | 4 +- fedora/glibc.spec.in | 23 +++- include/features.h | 12 +- include/stdlib.h | 30 ++--- io/Makefile | 7 +- io/Versions | 1 + io/fchmodat.c | 50 +++++++ io/fcntl.h | 12 +- io/sys/stat.h | 10 +- io/tst-fchmodat.c | 146 +++++++++++++++++++++ libio/stdio.h | 4 +- localedata/ChangeLog | 6 + localedata/tst-ctype.c | 14 +- localedata/tst-mbswcs1.c | 16 +-- nptl/ChangeLog | 22 ++++ nptl/Makefile | 2 +- nptl/sysdeps/pthread/aio_misc.h | 73 +++++++++++ nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h | 26 +++- .../sysv/linux/powerpc/powerpc32/sysdep-cancel.h | 10 +- .../sysv/linux/powerpc/powerpc64/sysdep-cancel.h | 10 +- nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 25 +++- nptl/tst-cancel24.cc | 4 +- posix/unistd.h | 8 +- rt/Makefile | 5 +- rt/tst-aio10.c | 119 +++++++++++++++++ rt/tst-aio3.c | 22 +++- rt/tst-aio8.c | 39 ++++++ rt/tst-aio9.c | 124 +++++++++++++++++ sysdeps/powerpc/powerpc32/dl-start.S | 10 +- sysdeps/powerpc/powerpc32/fpu/fprrest.S | 7 +- sysdeps/powerpc/powerpc32/fpu/fprsave.S | 7 +- sysdeps/powerpc/powerpc32/gprrest0.S | 7 +- sysdeps/powerpc/powerpc32/gprrest1.S | 7 +- sysdeps/powerpc/powerpc32/gprsave0.S | 7 +- sysdeps/powerpc/powerpc32/gprsave1.S | 7 +- sysdeps/powerpc/powerpc32/sysdep.h | 15 ++- sysdeps/powerpc/powerpc64/sysdep.h | 14 +- sysdeps/pthread/aio_misc.h | 7 +- sysdeps/pthread/aio_notify.c | 22 +++- sysdeps/pthread/aio_suspend.c | 40 +++++- sysdeps/pthread/lio_listio.c | 27 +++- sysdeps/unix/sysv/linux/fchmodat.c | 87 ++++++++++++ sysdeps/unix/sysv/linux/kernel-features.h | 16 ++- sysdeps/unix/sysv/linux/mips/brk.c | 2 +- sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S | 8 +- sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S | 8 +- time/sys/time.h | 5 +- 50 files changed, 1057 insertions(+), 156 deletions(-) create mode 100644 io/fchmodat.c create mode 100644 io/tst-fchmodat.c create mode 100644 nptl/sysdeps/pthread/aio_misc.h create mode 100644 rt/tst-aio10.c create mode 100644 rt/tst-aio8.c create mode 100644 rt/tst-aio9.c create mode 100644 sysdeps/unix/sysv/linux/fchmodat.c diff --git a/ChangeLog b/ChangeLog index 1f7fa156c6..31a5a7a44d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,84 @@ +2006-01-05 Jakub Jelinek + + * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_WAITID_SYSCALL): + Only define for 2.6.12+ on s390{,x}. + (__ASSUME_GETDENTS32_D_TYPE): Only define for 2.6.8+ on most arches + and only for 2.6.11+ on s390{,x}. + +2006-01-05 Ulrich Drepper + + * sysdeps/pthread/aio_misc.h [!DONT_USE_BOOTSTRAP_MAP] + (struct waitlist): Don't add cond. + * sysdeps/pthread/aio_notify.c [!DONT_USE_BOOTSTRAP_MAP] + (__aio_notify): Use AIO_MISC_NOTIFY instead of pthread_cond_signal. + * sysdeps/pthread/aio_suspend.c [!DONT_USE_BOOTSTRAP_MAP]: Don't + use condvar, use AIO_MISC_WAIT. + * sysdeps/pthread/lio_listio.c: Likewise. + * rt/Makefile (tests): Add tst-aio9 and tst-aio10. + * rt/tst-aio9.c: New file. + * rt/tst-aio10.c: New file. + + * rt/tst-aio3.c: The thread is now supposed to be created. + +2006-01-05 Roland McGrath + + * include/features.h: Grok _ATFILE_SOURCE and define __USE_ATFILE when + it or _GNU_SOURCE is defined. + * io/fcntl.h: Protect *at and AT_* with [__USE_ATFILE] instead of + [__USE_GNU]. + * libio/stdio.h: Likewise. + * posix/unistd.h: Likewise. + * time/sys/time.h: Likewise. + + * io/sys/stat.h [__USE_GNU]: Declare fchmodat. + * io/fchmodat.c: New file. + * io/Makefile (routines): Add fchmodat. + * io/Versions (libc: GLIBC_2.4): Likewise. + * sysdeps/unix/sysv/linux/fchmodat.c: New file. + * io/tst-fchmodat.c: New file. + * io/Makefile (tests): Add it. + +2006-01-03 Steven Munroe + + * sysdeps/powerpc/powerpc32/sysdep.h (ENTRY, EALIGN): Add cfi_startproc + directive to ENTRY macros. + (END): Add cfi_endproc directive to END macro. + * sysdeps/powerpc/powerpc64/sysdep.h (ENTRY, EALIGN): Add cfi_startproc + directive to ENTRY macros. + (END, END_GEN_TB): Add cfi_endproc directive to END macros. + * sysdeps/powerpc/powerpc32/dl-start.S: Remove ENTRY()s for + _dl_start_user and _dl_main_dispatch. + * sysdeps/powerpc/powerpc32/fpu/fprrest.S: Use END macro. + * sysdeps/powerpc/powerpc32/fpu/fprsave.S: Use Likewise. + * sysdeps/powerpc/powerpc32/gprrest0.S: Likewise. + * sysdeps/powerpc/powerpc32/gprrest1.S: Likewise. + * sysdeps/powerpc/powerpc32/gprsave0.S: Likewise. + * sysdeps/powerpc/powerpc32/gprsave1.S: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S: Remove redundant + cfi_startproc and cfi_endproc. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S: Likewise. + +2006-01-04 Ulrich Drepper + + * sysdeps/pthread/aio_misc.h (struct waitlist): Add result member. + * sysdeps/pthread/aio_notify.c (__aio_notify): For synchronous waiters, + failed I/O, and a result pointer, set value to -1. + * sysdeps/pthread/aio_suspend.c: Initialize result pointer to NULL. + * sysdeps/pthread/lio_listio.c: For LIO_WAIT, point result pointer in + wait list to local variable result. If nonzero afterwards, set errno + to EIO. For LIO_NOWAIT set result to NULL. + * rt/Makefile (tests): Add tst-aio8. + * rt/tst-aio8.c: New file. + +2005-12-25 Kristian Van Der Vliet + + * abi-tags (*-.*-syllable.*): New match, with ABI value 5. + * elf/cache.c (print_entry): Match the Syllable ABI tag. + +2006-01-04 Ulrich Drepper + + * include/stdlib.h: Make even more C++ compliant. + 2006-01-04 Joseph S. Myers * sysdeps/unix/sysv/linux/mips/brk.c (__brk): Use diff --git a/abi-tags b/abi-tags index 31c14c2bc2..87cd6816a9 100644 --- a/abi-tags +++ b/abi-tags @@ -26,5 +26,7 @@ .*-.*-knetbsd.*-gnu.* 4 1.6.0 # earliest compatible kernel version +.*-.*-syllable.* 5 2.0.0 # just an arbitrary value + # There is no catch-all default here because every supported OS that uses # ELF must have its own unique ABI tag. diff --git a/elf/cache.c b/elf/cache.c index c13918ccb4..9462ac1b53 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -107,7 +107,8 @@ print_entry (const char *lib, int flag, unsigned int osversion, [2] = "Solaris", [3] = "FreeBSD", [4] = "kNetBSD", - [5] = N_("Unknown OS") + [5] = "Syllable", + [6] = N_("Unknown OS") }; #define MAXTAG (sizeof abi_tag_os / sizeof abi_tag_os[0] - 1) unsigned int os = osversion >> 24; diff --git a/fedora/branch.mk b/fedora/branch.mk index aff47f5bfa..b919262658 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2006-01-04 07:54 UTC -fedora-sync-tag := fedora-glibc-20060104T0754 +fedora-sync-date := 2006-01-06 09:16 UTC +fedora-sync-tag := fedora-glibc-20060106T0916 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index d0692de3e7..a4e2a56458 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 26 +%define glibcrelease 28 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define prelinkarches noarch %define xenarches i686 athlon @@ -237,8 +237,14 @@ package or when debugging this package. %endif # Hack till glibc-kernheaders get updated, argh -mkdir asm -cat > asm/unistd.h < override_headers/linux/version.h < override_headers/asm/unistd.h < %ifarch alpha @@ -418,7 +424,7 @@ cat > asm/unistd.h < asm/errno.h < override_headers/asm/errno.h < %ifarch alpha @@ -530,7 +536,7 @@ mkdir $builddir ; cd $builddir build_CFLAGS="$BuildFlags -g -O3 $*" CC="$GCC" CXX="$GXX" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \ --enable-add-ons=nptl$AddOns --without-cvs $EnableKernel \ - --with-headers=%{_prefix}/include --enable-bind-now \ + --with-headers=`cd ..; pwd`/override_headers:%{_prefix}/include --enable-bind-now \ --with-tls --with-__thread --build %{nptl_target_cpu}-redhat-linux \ --host %{nptl_target_cpu}-redhat-linux \ --disable-profile @@ -1122,6 +1128,13 @@ rm -f *.filelist* %endif %changelog +* Fri Jan 6 2006 Jakub Jelinek 2.3.90-28 +- update from CVS + - make aio_suspend interruptible by signals (#171968) + +* Fri Jan 6 2006 Jakub Jelinek 2.3.90-27 +- only rely on d_type in 32-bit getdents on s390 for 2.6.11+ + * Wed Jan 4 2006 Jakub Jelinek 2.3.90-26 - update from CVS - for newly linked lio_listio* callers, send per request diff --git a/include/features.h b/include/features.h index 4c93af7c0b..656caaf639 100644 --- a/include/features.h +++ b/include/features.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1993,1995-2003,2004,2005 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1993,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 + 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 @@ -38,6 +39,7 @@ _FILE_OFFSET_BITS=N Select default filesystem interface. _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. _SVID_SOURCE ISO C, POSIX, and SVID things. + _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. @@ -69,6 +71,7 @@ __USE_BSD Define 4.3BSD things. __USE_SVID Define SVID things. __USE_MISC Define things common to BSD and System V Unix. + __USE_ATFILE Define *at interfaces and AT_* constants for them. __USE_GNU Define GNU extensions. __USE_REENTRANT Define reentrant/thread-safe *_r functions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. @@ -102,6 +105,7 @@ #undef __USE_BSD #undef __USE_SVID #undef __USE_MISC +#undef __USE_ATFILE #undef __USE_GNU #undef __USE_REENTRANT #undef __USE_FORTIFY_LEVEL @@ -158,6 +162,8 @@ # define _BSD_SOURCE 1 # undef _SVID_SOURCE # define _SVID_SOURCE 1 +# undef _ATFILE_SOURCE +# define _ATFILE_SOURCE 1 #endif /* If nothing (other than _GNU_SOURCE) is defined, @@ -256,6 +262,10 @@ # define __USE_SVID 1 #endif +#ifdef _ATFILE_SOURCE +# define __USE_ATFILE 1 +#endif + #ifdef _GNU_SOURCE # define __USE_GNU 1 #endif diff --git a/include/stdlib.h b/include/stdlib.h index 90b779d895..89bee37c0a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -144,44 +144,44 @@ libc_hidden_proto (____strtoul_l_internal) libc_hidden_proto (____strtoull_l_internal) extern __inline double -__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) +__NTH (__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, + __locale_t __loc)) { return ____strtod_l_internal (__nptr, __endptr, 0, __loc); } extern __inline long int -__strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) +__NTH (__strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, + int __base, __locale_t __loc)) { return ____strtol_l_internal (__nptr, __endptr, __base, 0, __loc); } extern __inline unsigned long int -__strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) +__NTH (__strtoul_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, __locale_t __loc)) { return ____strtoul_l_internal (__nptr, __endptr, __base, 0, __loc); } extern __inline float -__strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) +__NTH (__strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, + __locale_t __loc)) { return ____strtof_l_internal (__nptr, __endptr, 0, __loc); } extern __inline long double -__strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) +__NTH (__strtold_l (__const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc)) { return ____strtold_l_internal (__nptr, __endptr, 0, __loc); } __extension__ extern __inline long long int -__strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) +__NTH (__strtoll_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, __locale_t __loc)) { return ____strtoll_l_internal (__nptr, __endptr, __base, 0, __loc); } __extension__ extern __inline unsigned long long int -__strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) +__NTH (__strtoull_l (__const char * __restrict __nptr, + char **__restrict __endptr, int __base, __locale_t __loc)) { return ____strtoull_l_internal (__nptr, __endptr, __base, 0, __loc); } @@ -196,7 +196,7 @@ __strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr, #endif -extern void * __default_morecore (ptrdiff_t); +extern void *__default_morecore (ptrdiff_t) __THROW; libc_hidden_proto (__default_morecore) __END_DECLS diff --git a/io/Makefile b/io/Makefile index 4731e24d24..b263a48705 100644 --- a/io/Makefile +++ b/io/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1992-2002, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 1992-2002,2003,2005,2006 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 @@ -35,7 +35,8 @@ routines := \ fxstatat fxstatat64 \ statfs fstatfs statfs64 fstatfs64 \ statvfs fstatvfs statvfs64 fstatvfs64 \ - umask chmod fchmod lchmod mkdir mkdirat \ + umask chmod fchmod lchmod fchmodat \ + mkdir mkdirat \ open open64 openat openat64 close \ read write lseek lseek64 access euidaccess \ fcntl flock lockf lockf64 \ @@ -63,7 +64,7 @@ test-srcs := ftwtest tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \ tst-openat tst-unlinkat tst-fstatat tst-futimesat \ - tst-renameat tst-fchownat + tst-renameat tst-fchownat tst-fchmodat distribute := ftwtest-sh diff --git a/io/Versions b/io/Versions index 2f0f94f3bb..8cb1abdb42 100644 --- a/io/Versions +++ b/io/Versions @@ -98,6 +98,7 @@ libc { nftw; nftw64; } GLIBC_2.4 { + fchmodat; fchownat; __fxstatat; __fxstatat64; linkat; diff --git a/io/fchmodat.c b/io/fchmodat.c new file mode 100644 index 0000000000..6aecf2ac23 --- /dev/null +++ b/io/fchmodat.c @@ -0,0 +1,50 @@ +/* Change the protections of file relative to open directory. Stub version. + Copyright (C) 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +int +fchmodat (fd, file, mode, flag) + int fd; + const char *file; + mode_t mode; + int flag; +{ + if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) + { + __set_errno (EINVAL); + return -1; + } + + if (fd < 0 && fd != AT_FDCWD) + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (fchownat) + +#include diff --git a/io/fcntl.h b/io/fcntl.h index 8e13d33dcc..fd45933fc2 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005 - Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006 + 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 @@ -56,7 +56,7 @@ __BEGIN_DECLS # define SEEK_END 2 /* Seek from end of file. */ #endif /* XPG */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE # define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */ @@ -92,11 +92,11 @@ extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1)); #endif -#ifdef __USE_GNU -/* Similar to OPEN but a relative path name is interpreted relative to +#ifdef __USE_ATFILE +/* Similar to `open' but a relative path name is interpreted relative to the directory for which FD is a descriptor. - NOTE: some other OPENAT implementation support additional functionality + NOTE: some other `openat' implementation support additional functionality through this interface, especially using the O_XATTR flag. This is not yet supported here. diff --git a/io/sys/stat.h b/io/sys/stat.h index 6ce3a1be66..93cd7d0610 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1995-2004,2005 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2004,2005,2006 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 @@ -293,6 +293,14 @@ extern int lchmod (__const char *__file, __mode_t __mode) extern int fchmod (int __fd, __mode_t __mode) __THROW; #endif +#ifdef __USE_GNU +/* Set file access permissions of FILE relative to + the directory FD is open on. */ +extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag) + __THROW __nonnull ((2)) __wur; +#endif /* Use GNU. */ + + /* Set the file creation mask of the current process to MASK, and return the old creation mask. */ diff --git a/io/tst-fchmodat.c b/io/tst-fchmodat.c new file mode 100644 index 0000000000..0288d6b5d9 --- /dev/null +++ b/io/tst-fchmodat.c @@ -0,0 +1,146 @@ +/* Test for fchmodat function. */ + +#include +#include +#include +#include +#include +#include + + +static void prepare (void); +#define PREPARE(argc, argv) prepare () + +static int do_test (void); +#define TEST_FUNCTION do_test () + +#include "../test-skeleton.c" + +static int dir_fd; + +static void +prepare (void) +{ + size_t test_dir_len = strlen (test_dir); + static const char dir_name[] = "/tst-fchmodat.XXXXXX"; + + size_t dirbuflen = test_dir_len + sizeof (dir_name); + char *dirbuf = malloc (dirbuflen); + if (dirbuf == NULL) + { + puts ("out of memory"); + exit (1); + } + + snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); + if (mkdtemp (dirbuf) == NULL) + { + puts ("cannot create temporary directory"); + exit (1); + } + + add_temp_file (dirbuf); + + dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY); + if (dir_fd == -1) + { + puts ("cannot open directory"); + exit (1); + } +} + + +static int +do_test (void) +{ + /* fdopendir takes over the descriptor, make a copy. */ + int dupfd = dup (dir_fd); + if (dupfd == -1) + { + puts ("dup failed"); + return 1; + } + if (lseek (dupfd, 0, SEEK_SET) != 0) + { + puts ("1st lseek failed"); + return 1; + } + + /* The directory should be empty save the . and .. files. */ + DIR *dir = fdopendir (dupfd); + if (dir == NULL) + { + puts ("fdopendir failed"); + return 1; + } + struct dirent64 *d; + while ((d = readdir64 (dir)) != NULL) + if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0) + { + printf ("temp directory contains file \"%s\"\n", d->d_name); + return 1; + } + closedir (dir); + + umask (022); + + /* Try to create a file. */ + int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666); + if (fd == -1) + { + if (errno == ENOSYS) + { + puts ("*at functions not supported"); + return 0; + } + + puts ("file creation failed"); + return 1; + } + write (fd, "hello", 5); + puts ("file created"); + + struct stat64 st1; + if (fstat64 (fd, &st1) != 0) + { + puts ("fstat64 failed"); + return 1; + } + + close (fd); + + if ((st1.st_mode & 0777) != 0644) + { + printf ("openat created mode %04o, not 0644\n", (st1.st_mode & 0777)); + return 1; + } + + if (fchmodat (dir_fd, "some-file", 0400, 0) != 0) + { + puts ("fchownat failed"); + return 1; + } + + struct stat64 st2; + if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0) + { + puts ("fstatat64 failed"); + return 1; + } + + if ((st2.st_mode & 0777) != 0400) + { + puts ("mode change failed"); + return 1; + } + + if (unlinkat (dir_fd, "some-file", 0) != 0) + { + puts ("unlinkat failed"); + return 1; + } + + close (dir_fd); + + return 0; +} diff --git a/libio/stdio.h b/libio/stdio.h index 0076028324..3be5728579 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -1,5 +1,5 @@ /* Define ISO C stdio on top of C++ iostreams. - Copyright (C) 1991,1994-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1991,1994-2004,2005,2006 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 @@ -156,7 +156,7 @@ extern int remove (__const char *__filename) __THROW; extern int rename (__const char *__old, __const char *__new) __THROW; __END_NAMESPACE_STD -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ extern int renameat (int __oldfd, __const char *__old, int __newfd, __const char *__new) __THROW; diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 67a60bd8be..f4c29fc173 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,9 @@ +2005-12-27 Roland McGrath + + * tst-ctype.c (main): Add some casts. + + * tst-mbswcs1.c (main): Make BUF const. Add casts in mbrtowc calls. + 2006-01-02 Andreas Jaeger * locales/fi_FI: Fix date_fmt. diff --git a/localedata/tst-ctype.c b/localedata/tst-ctype.c index fb2e78cbb2..f4e01f0826 100644 --- a/localedata/tst-ctype.c +++ b/localedata/tst-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,02 Free Software Foundation, Inc. +/* Copyright (C) 2000,02, 05 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2000. @@ -345,14 +345,14 @@ punct = %04x alnum = %04x\n", || getline (&resline, &reslinelen, stdin) <= 0) break; - inp = strchr (inpline, '\n'); + inp = (unsigned char *) strchr (inpline, '\n'); if (inp != NULL) *inp = '\0'; - resp = strchr (resline, '\n'); + resp = (unsigned char *) strchr (resline, '\n'); if (resp != NULL) *resp = '\0'; - inp = inpline; + inp = (unsigned char *) inpline; while (*inp != ' ' && *inp != '\t' && *inp && *inp != '\n' && *inp != '\0') ++inp; @@ -371,11 +371,11 @@ punct = %04x alnum = %04x\n", if (strcmp (inpline, classes[n].name) == 0) break; - resp = resline; + resp = (unsigned char *) resline; while (*resp == ' ' || *resp == '\t') ++resp; - if (strlen (inp) != strlen (resp)) + if (strlen ((char *) inp) != strlen ((char *) resp)) { printf ("lines \"%.20s\"... and \"%.20s\" have not the same length\n", inp, resp); @@ -384,7 +384,7 @@ punct = %04x alnum = %04x\n", if (n < nclasses) { - if (strspn (resp, "01") != strlen (resp)) + if (strspn ((char *) resp, "01") != strlen ((char *) resp)) { printf ("result string \"%s\" malformed\n", resp); continue; diff --git a/localedata/tst-mbswcs1.c b/localedata/tst-mbswcs1.c index 93795beb9e..fb2ea84cdd 100644 --- a/localedata/tst-mbswcs1.c +++ b/localedata/tst-mbswcs1.c @@ -1,5 +1,5 @@ /* Test restarting behaviour of mbrtowc. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Bruno Haible . @@ -37,7 +37,7 @@ int main (void) { - unsigned char buf[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; + const unsigned char buf[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; mbstate_t state; wchar_t wc = 42; size_t n; @@ -52,12 +52,12 @@ main (void) memset (&state, '\0', sizeof (state)); - show (mbrtowc (&wc, buf + 0, 1, &state), 1, 37); - show (mbrtowc (&wc, buf + 1, 1, &state), -2, 37); - show (mbrtowc (&wc, buf + 2, 3, &state), 2, 8364); - show (mbrtowc (&wc, buf + 4, 1, &state), -2, 8364); - show (mbrtowc (&wc, buf + 5, 1, &state), 1, 955); - show (mbrtowc (&wc, buf + 5, 1, &state), -1, 955); + show (mbrtowc (&wc, (const char *) buf + 0, 1, &state), 1, 37); + show (mbrtowc (&wc, (const char *) buf + 1, 1, &state), -2, 37); + show (mbrtowc (&wc, (const char *) buf + 2, 3, &state), 2, 8364); + show (mbrtowc (&wc, (const char *) buf + 4, 1, &state), -2, 8364); + show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), 1, 955); + show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), -1, 955); return result; } diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 3bc50ba637..73fc297317 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,25 @@ +2006-01-05 Ulrich Drepper + + * sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_futex_wait): + Return status. + (lll_futex_timed_wait): Define. + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise. + * sysdeps/pthread/aio_misc.h: New file. + +2006-01-03 Joseph S. Myers + + * Makefile ($(objpfx)$(multidir)): Use mkdir -p. + +2006-01-03 Steven Munroe + + * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h + (PSEUDO): Remove redundant cfi_startproc and cfi_endproc directives. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise. + +2006-01-04 Ulrich Drepper + + * tst-cancel24.cc: Use C headers instead of C++ headers. + 2006-01-03 Jakub Jelinek * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Remove #error for diff --git a/nptl/Makefile b/nptl/Makefile index b15b8ad23a..119d6a6f0d 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -324,7 +324,7 @@ crti-objs += $(multidir)/crti.o crtn-objs += $(multidir)/crtn.o omit-deps += $(multidir)/crti $(multidir)/crtn $(objpfx)$(multidir): - mkdir $@ + mkdir -p $@ endif extra-objs += $(crti-objs) $(crtn-objs) omit-deps += crti crtn diff --git a/nptl/sysdeps/pthread/aio_misc.h b/nptl/sysdeps/pthread/aio_misc.h new file mode 100644 index 0000000000..5aeb34eb98 --- /dev/null +++ b/nptl/sysdeps/pthread/aio_misc.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* We define a special synchronization primitive for AIO. POSIX + conditional variables would be ideal but the pthread_cond_*wait + operations do not return on EINTR. This is a requirement for + correct aio_suspend and lio_listio implementations. */ + +#include +#include +#include + +#define DONT_NEED_AIO_MISC_COND 1 + +#define AIO_MISC_NOTIFY(waitlist) \ + do { \ + if (--*waitlist->counterp == 0) \ + lll_futex_wake (waitlist->counterp, 1); \ + } while (0) + +#define AIO_MISC_WAIT(result, futex, timeout, cancel) \ + do { \ + int oldval = futex; \ + \ + if (oldval != 0) \ + { \ + pthread_mutex_unlock (&__aio_requests_mutex); \ + \ + int oldtype; \ + if (cancel) \ + oldtype = LIBC_CANCEL_ASYNC (); \ + \ + int status; \ + do \ + { \ + status = lll_futex_timed_wait (&futex, oldval, timeout); \ + if (status != -EWOULDBLOCK) \ + break; \ + \ + oldval = futex; \ + } \ + while (oldval != 0); \ + \ + if (cancel) \ + LIBC_CANCEL_RESET (oldtype); \ + \ + if (status == -EINTR) \ + result = EINTR; \ + else if (status == -ETIMEDOUT) \ + result = EAGAIN; \ + else \ + assert (status == 0 || status == -EWOULDBLOCK); \ + \ + pthread_mutex_lock (&__aio_requests_mutex); \ + } \ + } while (0) + +#include_next diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index b86f11c9b4..fd1ee4569d 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -66,17 +66,33 @@ #define lll_futex_wait(futex, val) \ - do { \ - int __ignore; \ + ({ \ + int __status; \ register __typeof (val) _val asm ("edx") = (val); \ __asm __volatile (LLL_EBX_LOAD \ LLL_ENTER_KERNEL \ LLL_EBX_LOAD \ - : "=a" (__ignore) \ + : "=a" (__status) \ : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (0), \ "c" (FUTEX_WAIT), "d" (_val), \ "i" (offsetof (tcbhead_t, sysinfo))); \ - } while (0) + __status; \ + }) + + +#define lll_futex_timed_wait(futex, val, timeout) \ + ({ \ + int __status; \ + register __typeof (val) _val asm ("edx") = (val); \ + __asm __volatile (LLL_EBX_LOAD \ + LLL_ENTER_KERNEL \ + LLL_EBX_LOAD \ + : "=a" (__status) \ + : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout), \ + "c" (FUTEX_WAIT), "d" (_val), \ + "i" (offsetof (tcbhead_t, sysinfo))); \ + __status; \ + }) #define lll_futex_wake(futex, nr) \ diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h index 84acf38434..dcbc0d6520 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h @@ -1,5 +1,5 @@ /* Cancellable system call stubs. Linux/PowerPC version. - Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Franz Sirl , 2003. @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include #include @@ -30,7 +30,6 @@ # define PSEUDO(name, syscall_name, args) \ .section ".text"; \ ENTRY (name) \ - cfi_startproc; \ SINGLE_THREAD_P; \ bne- .Lpseudo_cancel; \ .type __##syscall_name##_nocancel,@function; \ @@ -62,8 +61,7 @@ CGOTRESTORE; \ mtlr 4; \ mtcr 0; \ - addi 1,1,48; \ - cfi_endproc; + addi 1,1,48; # define DOCARGS_0 # define UNDOCARGS_0 diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h index 226aaafdce..83eb444ece 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h @@ -1,5 +1,5 @@ /* Cancellable system call stubs. Linux/PowerPC64 version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Franz Sirl , 2003. @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include #include @@ -36,7 +36,6 @@ # define PSEUDO(name, syscall_name, args) \ .section ".text"; \ ENTRY (name) \ - cfi_startproc; \ SINGLE_THREAD_P; \ bne- .Lpseudo_cancel; \ .type DASHDASHPFX(syscall_name##_nocancel),@function; \ @@ -66,8 +65,7 @@ ld 3,64(1); \ mtlr 9; \ mtcr 0; \ - addi 1,1,128; \ - cfi_endproc; + addi 1,1,128; # define DOCARGS_0 # define UNDOCARGS_0 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index 40c2518af6..ebcfe6eef1 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -47,16 +47,31 @@ #define lll_futex_wait(futex, val) \ - do { \ - int __ignore; \ + ({ \ + int __status; \ register __typeof (val) _val asm ("edx") = (val); \ __asm __volatile ("xorq %%r10, %%r10\n\t" \ "syscall" \ - : "=a" (__ignore) \ + : "=a" (__status) \ : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \ "d" (_val) \ : "memory", "cc", "r10", "r11", "cx"); \ - } while (0) + __status; \ + }) + + +#define lll_futex_timed_wait(futex, val, timeout) \ + ({ \ + register const struct timespec *__to __asm__ ("r10") = timeout; \ + int __status; \ + register __typeof (val) _val asm ("edx") = (val); \ + __asm __volatile ("syscall" \ + : "=a" (__status) \ + : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \ + "d" (_val), "r" (__to) \ + : "memory", "cc", "r11", "cx"); \ + __status; \ + }) #define lll_futex_wake(futex, nr) \ diff --git a/nptl/tst-cancel24.cc b/nptl/tst-cancel24.cc index 52cf079d5a..1af709a8ca 100644 --- a/nptl/tst-cancel24.cc +++ b/nptl/tst-cancel24.cc @@ -1,7 +1,7 @@ -#include -#include #include #include +#include +#include #include diff --git a/posix/unistd.h b/posix/unistd.h index 4c03c4d702..480de5e40f 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -431,7 +431,7 @@ extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group) #endif /* Use BSD || X/Open Unix. */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Change the owner and group of FILE relative to the directory FD is open on. */ extern int fchownat (int __fd, __const char *__file, __uid_t __owner, @@ -742,7 +742,7 @@ extern int ttyslot (void) __THROW; extern int link (__const char *__from, __const char *__to) __THROW __nonnull ((1, 2)) __wur; -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Like link but relative paths in TO and FROM are interpreted relative to FROMFD and TOFD respectively. */ extern int linkat (int __fromfd, __const char *__from, int __tofd, @@ -761,7 +761,7 @@ extern int readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2)) __wur; #endif /* Use BSD. */ -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ extern int symlinkat (__const char *__from, int __tofd, __const char *__to) __THROW __nonnull ((1, 3)) __wur; @@ -775,7 +775,7 @@ extern int readlinkat (int __fd, __const char *__restrict __path, /* Remove the link NAME. */ extern int unlink (__const char *__name) __THROW __nonnull ((1)); -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Remove the link NAME relative to FD. */ extern int unlinkat (int __fd, __const char *__name, int __flag) __THROW __nonnull ((2)); diff --git a/rt/Makefile b/rt/Makefile index cc01cb95c9..f8487975dd 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1997-2004, 2006 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 @@ -43,7 +43,8 @@ librt-routines = $(aio-routines) \ tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \ tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \ - tst-aio7 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \ + tst-aio7 tst-aio8 tst-aio9 tst-aio10 \ + tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \ tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \ tst-timer3 tst-timer4 tst-timer5 \ tst-cpuclock1 tst-cpuclock2 \ diff --git a/rt/tst-aio10.c b/rt/tst-aio10.c new file mode 100644 index 0000000000..6e8f7b78c0 --- /dev/null +++ b/rt/tst-aio10.c @@ -0,0 +1,119 @@ +#include +#include +#include +#include +#include +#include +#include + +static pthread_barrier_t b; +static pthread_t main_thread; +static int flag; + + +static void * +tf (void *arg) +{ + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + /* There is unfortunately no other way to try to make sure the other + thread reached the aio_suspend call. This test could fail on + highly loaded machines. */ + sleep (2); + + pthread_kill (main_thread, SIGUSR1); + + while (1) + sleep (1000); + + return NULL; +} + + +static void +sh (int sig) +{ + flag = 1; +} + + +static int +do_test (void) +{ + main_thread = pthread_self (); + + struct sigaction sa; + + sa.sa_handler = sh; + sa.sa_flags = 0; + sigemptyset (&sa.sa_mask); + + if (sigaction (SIGUSR1, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init"); + return 1; + } + + int fds[2]; + if (pipe (fds) != 0) + { + puts ("pipe failed"); + return 1; + } + + char buf[42]; + struct aiocb req; + req.aio_fildes = fds[0]; + req.aio_lio_opcode = LIO_READ; + req.aio_reqprio = 0; + req.aio_offset = 0; + req.aio_buf = buf; + req.aio_nbytes = sizeof (buf); + req.aio_sigevent.sigev_notify = SIGEV_NONE; + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: barrier_wait failed"); + exit (1); + } + + struct aiocb *list[1]; + list[0] = &req; + + e = lio_listio (LIO_WAIT, list, 1, NULL); + if (e != -1) + { + puts ("lio_listio succeeded"); + return 1; + } + if (errno != EINTR) + { + printf ("lio_listio did not return EINTR: %d (%d = %m)\n", e, errno); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 5 +#include "../test-skeleton.c" diff --git a/rt/tst-aio3.c b/rt/tst-aio3.c index 0c0ced4501..95da4c1325 100644 --- a/rt/tst-aio3.c +++ b/rt/tst-aio3.c @@ -1,5 +1,5 @@ /* Test for notification mechanism in lio_listio. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2006 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,13 +24,18 @@ #include #include -int flag; +static pthread_barrier_t b; static void thrfct (sigval_t arg) { - flag = 1; + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } } @@ -52,6 +57,12 @@ do_test (int argc, char *argv[]) unlink (name); + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + arr[0] = &cb; cb.aio_fildes = fd; @@ -82,9 +93,10 @@ do_test (int argc, char *argv[]) return 1; } - if (flag != 0) + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) { - puts ("thread created, should not have happened"); + puts ("parent: barrier_wait failed"); return 1; } diff --git a/rt/tst-aio8.c b/rt/tst-aio8.c new file mode 100644 index 0000000000..b03639dabd --- /dev/null +++ b/rt/tst-aio8.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include +#include + +static int +do_test (void) +{ + int fd = open ("/dev/full", O_RDWR); + if (fd == -1) + { + puts ("could not open /dev/full"); + return 0; + } + + struct aiocb req; + req.aio_fildes = fd; + req.aio_lio_opcode = LIO_WRITE; + req.aio_reqprio = 0; + req.aio_buf = (void *) "hello"; + req.aio_nbytes = 5; + req.aio_offset = 0; + req.aio_sigevent.sigev_notify = SIGEV_NONE; + + struct aiocb *list[1]; + list[0] = &req; + + int r = lio_listio (LIO_WAIT, list, 1, NULL); + int e = errno; + + printf ("r = %d, e = %d (%s)\n", r, e, strerror (e)); + + return r != -1 || e != EIO; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/rt/tst-aio9.c b/rt/tst-aio9.c new file mode 100644 index 0000000000..eab4f6859a --- /dev/null +++ b/rt/tst-aio9.c @@ -0,0 +1,124 @@ +#include +#include +#include +#include +#include +#include +#include + +static pthread_barrier_t b; +static pthread_t main_thread; +static int flag; + + +static void * +tf (void *arg) +{ + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + /* There is unfortunately no other way to try to make sure the other + thread reached the aio_suspend call. This test could fail on + highly loaded machines. */ + sleep (2); + + pthread_kill (main_thread, SIGUSR1); + + while (1) + sleep (1000); + + return NULL; +} + + +static void +sh (int sig) +{ + flag = 1; +} + + +static int +do_test (void) +{ + main_thread = pthread_self (); + + struct sigaction sa; + + sa.sa_handler = sh; + sa.sa_flags = 0; + sigemptyset (&sa.sa_mask); + + if (sigaction (SIGUSR1, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init"); + return 1; + } + + int fds[2]; + if (pipe (fds) != 0) + { + puts ("pipe failed"); + return 1; + } + + char buf[42]; + struct aiocb req; + req.aio_fildes = fds[0]; + req.aio_reqprio = 0; + req.aio_offset = 0; + req.aio_buf = buf; + req.aio_nbytes = sizeof (buf); + req.aio_sigevent.sigev_notify = SIGEV_NONE; + + if (aio_read (&req) != 0) + { + puts ("aio_read failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: barrier_wait failed"); + exit (1); + } + + const struct aiocb *list[1]; + list[0] = &req; + + e = aio_suspend (list, 1, NULL); + if (e != -1) + { + puts ("aio_suspend succeeded"); + return 1; + } + if (errno != EINTR) + { + puts ("aio_suspend did not return EINTR"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 5 +#include "../test-skeleton.c" diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S index 7403a352fa..c77c4de198 100644 --- a/sysdeps/powerpc/powerpc32/dl-start.S +++ b/sysdeps/powerpc/powerpc32/dl-start.S @@ -1,5 +1,5 @@ /* Machine-dependent ELF startup code. PowerPC version. - Copyright (C) 1995-2000, 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2002, 2004, 2005, 2006 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 @@ -14,8 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include @@ -39,7 +39,7 @@ ENTRY(_start) bl _dl_start@local /* FALLTHRU */ -ENTRY(_dl_start_user) +_dl_start_user: /* Now, we do our main work of calling initialisation procedures. The ELF ABI doesn't say anything about parameters for these, so we just pass argc, argv, and the environment. @@ -98,7 +98,7 @@ ENTRY(_dl_start_user) Take the opportunity to clear LR, so anyone who accidentally returns from _start gets SEGV. Also clear the next few words of the stack. */ -ENTRY(_dl_main_dispatch) +_dl_main_dispatch: li r31,0 stw r31,0(r1) mtlr r31 diff --git a/sysdeps/powerpc/powerpc32/fpu/fprrest.S b/sysdeps/powerpc/powerpc32/fpu/fprrest.S index 42317809eb..2f6c6deb2e 100644 --- a/sysdeps/powerpc/powerpc32/fpu/fprrest.S +++ b/sysdeps/powerpc/powerpc32/fpu/fprrest.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* Floating Point Registers (FPRs) restore routine @@ -92,3 +92,4 @@ C_TEXT(_restfpr_29): lwz r0,8(r1) #get return address from frame lfd fp30,-16(r1) #restore f30 lfd fp31,-8(r1) #restore f31 blr #return +END (_restfpr_all) diff --git a/sysdeps/powerpc/powerpc32/fpu/fprsave.S b/sysdeps/powerpc/powerpc32/fpu/fprsave.S index d7bc1ab7dc..597c3e611f 100644 --- a/sysdeps/powerpc/powerpc32/fpu/fprsave.S +++ b/sysdeps/powerpc/powerpc32/fpu/fprsave.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* Floating Point Registers (FPRs) save routine @@ -91,3 +91,4 @@ C_TEXT(_savefpr_29): stfd fp29,-24(r1) #save f29 stfd fp31,-8(r1) #save f31 stw r0,8(r1) #save LR in callers frame blr #return +END (_savefpr_all) diff --git a/sysdeps/powerpc/powerpc32/gprrest0.S b/sysdeps/powerpc/powerpc32/gprrest0.S index cf493f0c47..90eb4a0c4c 100644 --- a/sysdeps/powerpc/powerpc32/gprrest0.S +++ b/sysdeps/powerpc/powerpc32/gprrest0.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* General Purpose Register (GPR) restore routine @@ -67,3 +67,4 @@ C_TEXT(_restgpr0_29): lwz r0,8(r1) #get return address from frame lwz r30,-8(r1) #restore r30 lwz r31,-4(r1) #restore r31 blr #return +END (_restgpr0_all) diff --git a/sysdeps/powerpc/powerpc32/gprrest1.S b/sysdeps/powerpc/powerpc32/gprrest1.S index 5ac18606f8..ca00b8f133 100644 --- a/sysdeps/powerpc/powerpc32/gprrest1.S +++ b/sysdeps/powerpc/powerpc32/gprrest1.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* General Purpose Register (GPR) restore routine @@ -61,3 +61,4 @@ C_TEXT(_restgpr1_29): lwz r29,-12(r12) #restore r29 lwz r30,-8(r12) #restore r30 lwz r31,-4(r12) #restore r31 blr #return +END (_restgpr1_all) diff --git a/sysdeps/powerpc/powerpc32/gprsave0.S b/sysdeps/powerpc/powerpc32/gprsave0.S index a09f1e569a..8b81647dd7 100644 --- a/sysdeps/powerpc/powerpc32/gprsave0.S +++ b/sysdeps/powerpc/powerpc32/gprsave0.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* General Purpose Register (GPR) save routine @@ -66,3 +66,4 @@ C_TEXT(_savegpr0_29): stw r29,-12(r1) #save r29 stw r31,-4(r1) #save r31 stw r0,8(r1) #save LR in callers frame blr #return +END (_savegpr0_all) diff --git a/sysdeps/powerpc/powerpc32/gprsave1.S b/sysdeps/powerpc/powerpc32/gprsave1.S index 06ee4a69d3..6c1790129e 100644 --- a/sysdeps/powerpc/powerpc32/gprsave1.S +++ b/sysdeps/powerpc/powerpc32/gprsave1.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* General Purpose Register (GPR) save routine @@ -61,3 +61,4 @@ C_TEXT(_savegpr1_29): stw r29,-12(r12) #save r29 stw r30,-8(r12) #save r30 stw r31,-4(r12) #save r31 blr #return +END (_savegpr1_all) diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h index 552f595a10..8fc624ebd9 100644 --- a/sysdeps/powerpc/powerpc32/sysdep.h +++ b/sysdeps/powerpc/powerpc32/sysdep.h @@ -1,5 +1,5 @@ /* Assembly macros for 32-bit PowerPC. - Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2006 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 @@ -14,8 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include @@ -31,7 +31,8 @@ for its benefit. */ # define CALL_MCOUNT \ mflr r0; \ - stw r0,4(r1); \ + stw r0,4(r1); \ + cfi_offset (lr, 4); \ bl JUMPTARGET(_mcount); #else /* PROF */ # define CALL_MCOUNT /* Do nothing. */ @@ -42,6 +43,7 @@ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ + cfi_startproc; \ CALL_MCOUNT #define EALIGN_W_0 /* No words to insert. */ @@ -61,6 +63,7 @@ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ + cfi_startproc; \ CALL_MCOUNT \ b 0f; \ .align ALIGNARG(alignt); \ @@ -72,11 +75,13 @@ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ - C_LABEL(name) + C_LABEL(name) \ + cfi_startproc; #endif #undef END #define END(name) \ + cfi_endproc; \ ASM_SIZE_DIRECTIVE(name) #define DO_CALL(syscall) \ diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index fead0b578a..2745d7eb71 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -1,5 +1,5 @@ /* Assembly macros for 64-bit PowerPC. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2006 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 @@ -14,8 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include @@ -92,7 +92,8 @@ name##: OPD_ENT (name); \ #define ENTRY(name) \ ENTRY_2(name) \ .align ALIGNARG(2); \ -BODY_LABEL(name): +BODY_LABEL(name): \ + cfi_startproc; #define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_1 nop @@ -109,7 +110,8 @@ BODY_LABEL(name): ENTRY_2(name) \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ -BODY_LABEL(name): +BODY_LABEL(name): \ + cfi_startproc; /* Local labels stripped out by the linker. */ #undef L @@ -173,11 +175,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ /* END generates Traceback tables */ #undef END #define END(name) \ + cfi_endproc; \ TRACEBACK(name) \ END_2(name) /* This form supports more informative traceback tables */ #define END_GEN_TB(name,mask) \ + cfi_endproc; \ TRACEBACK_MASK(name,mask) \ END_2(name) diff --git a/sysdeps/pthread/aio_misc.h b/sysdeps/pthread/aio_misc.h index 44d53b078f..50962c7519 100644 --- a/sysdeps/pthread/aio_misc.h +++ b/sysdeps/pthread/aio_misc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,2001,2003,2006 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 @@ -46,7 +46,12 @@ struct waitlist { struct waitlist *next; + /* The next two fields is used in synchronous `lio_listio' operations. */ +#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t *cond; +#endif + int *result; + volatile int *counterp; /* The next field is used in asynchronous `lio_listio' operations. */ struct sigevent *sigevp; diff --git a/sysdeps/pthread/aio_notify.c b/sysdeps/pthread/aio_notify.c index 877e8d9363..3f7f70ef7c 100644 --- a/sysdeps/pthread/aio_notify.c +++ b/sysdeps/pthread/aio_notify.c @@ -1,6 +1,5 @@ /* Notify initiator of AIO request. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 - Free Software Foundation, Inc. + Copyright (C) 1997-2001, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -144,15 +143,24 @@ __aio_notify (struct requestlist *req) { struct waitlist *next = waitlist->next; - /* Decrement the counter. This is used in both cases. */ - --*waitlist->counterp; - if (waitlist->sigevp == NULL) - pthread_cond_signal (waitlist->cond); + { + if (waitlist->result != NULL && aiocbp->__return_value == -1) + *waitlist->result = -1; + +#ifdef DONT_NEED_AIO_MISC_COND + AIO_MISC_NOTIFY (waitlist); +#else + /* Decrement the counter. */ + --*waitlist->counterp; + + pthread_cond_signal (waitlist->cond); +#endif + } else /* This is part of a asynchronous `lio_listio' operation. If this request is the last one, send the signal. */ - if (*waitlist->counterp == 0) + if (--*waitlist->counterp == 0) { #ifdef BROKEN_THREAD_SIGNALS __aio_notify_only (waitlist->sigevp, waitlist->caller_pid); diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c index 8f8e33a7dc..b85b16d10e 100644 --- a/sysdeps/pthread/aio_suspend.c +++ b/sysdeps/pthread/aio_suspend.c @@ -1,6 +1,5 @@ /* Suspend until termination of a requests. - Copyright (C) 1997,1998,1999,2000,2002,2003,2005 - Free Software Foundation, Inc. + Copyright (C) 1997-2000,2002,2003,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -45,7 +44,9 @@ struct clparam const struct aiocb *const *list; struct waitlist *waitlist; struct requestlist **requestlist; +#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t *cond; +#endif int nent; }; @@ -53,6 +54,12 @@ struct clparam static void cleanup (void *arg) { +#ifdef DONT_NEED_AIO_MISC_COND + /* Acquire the mutex. If pthread_cond_*wait is used this would + happen implicitly. */ + pthread_mutex_lock (&__aio_requests_mutex); +#endif + const struct clparam *param = (const struct clparam *) arg; /* Now remove the entry in the waiting list for all requests @@ -76,8 +83,10 @@ cleanup (void *arg) *listp = (*listp)->next; } +#ifndef DONT_NEED_AIO_MISC_COND /* Release the conditional variable. */ (void) pthread_cond_destroy (param->cond); +#endif /* Release the mutex. */ pthread_mutex_unlock (&__aio_requests_mutex); @@ -90,13 +99,21 @@ aio_suspend (list, nent, timeout) int nent; const struct timespec *timeout; { + if (__builtin_expect (nent < 0, 0)) + { + __set_errno (EINVAL); + return -1; + } + struct waitlist waitlist[nent]; struct requestlist *requestlist[nent]; +#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +#endif int cnt; bool any = false; int result = 0; - int dummy; + int cntr = 1; /* Request the mutex. */ pthread_mutex_lock (&__aio_requests_mutex); @@ -112,9 +129,12 @@ aio_suspend (list, nent, timeout) if (requestlist[cnt] != NULL) { +#ifndef DONT_NEED_AIO_MISC_COND waitlist[cnt].cond = &cond; +#endif + waitlist[cnt].result = NULL; waitlist[cnt].next = requestlist[cnt]->waiting; - waitlist[cnt].counterp = &dummy; + waitlist[cnt].counterp = &cntr; waitlist[cnt].sigevp = NULL; #ifdef BROKEN_THREAD_SIGNALS waitlist[cnt].caller_pid = 0; /* Not needed. */ @@ -140,12 +160,17 @@ aio_suspend (list, nent, timeout) .list = list, .waitlist = waitlist, .requestlist = requestlist, +#ifndef DONT_NEED_AIO_MISC_COND .cond = &cond, +#endif .nent = nent }; pthread_cleanup_push (cleanup, &clparam); +#ifdef DONT_NEED_AIO_MISC_COND + AIO_MISC_WAIT (result, cntr, timeout, 1); +#else if (timeout == NULL) result = pthread_cond_wait (&cond, &__aio_requests_mutex); else @@ -167,6 +192,7 @@ aio_suspend (list, nent, timeout) result = pthread_cond_timedwait (&cond, &__aio_requests_mutex, &abstime); } +#endif pthread_cleanup_pop (0); } @@ -190,19 +216,23 @@ aio_suspend (list, nent, timeout) *listp = (*listp)->next; } +#ifndef DONT_NEED_AIO_MISC_COND /* Release the conditional variable. */ if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0)) /* This must never happen. */ abort (); +#endif if (result != 0) { - /* An error occurred. Possibly it's EINTR. We have to translate +#ifndef DONT_NEED_AIO_MISC_COND + /* An error occurred. Possibly it's ETIMEDOUT. We have to translate the timeout error report of `pthread_cond_timedwait' to the form expected from `aio_suspend'. */ if (result == ETIMEDOUT) __set_errno (EAGAIN); else +#endif __set_errno (result); result = -1; diff --git a/sysdeps/pthread/lio_listio.c b/sysdeps/pthread/lio_listio.c index 815840397e..c652404ae2 100644 --- a/sysdeps/pthread/lio_listio.c +++ b/sysdeps/pthread/lio_listio.c @@ -122,9 +122,11 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, } else if (LIO_MODE (mode) == LIO_WAIT) { +#ifndef DONT_NEED_AIO_MISC_COND pthread_cond_t cond = PTHREAD_COND_INITIALIZER; - struct waitlist waitlist[nent]; int oldstate; +#endif + struct waitlist waitlist[nent]; total = 0; for (cnt = 0; cnt < nent; ++cnt) @@ -133,7 +135,10 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP) { +#ifndef DONT_NEED_AIO_MISC_COND waitlist[cnt].cond = &cond; +#endif + waitlist[cnt].result = &result; waitlist[cnt].next = requests[cnt]->waiting; waitlist[cnt].counterp = &total; waitlist[cnt].sigevp = NULL; @@ -145,21 +150,32 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, } } - /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancelation +#ifdef DONT_NEED_AIO_MISC_COND + AIO_MISC_WAIT (result, total, NULL, 0); +#else + /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancellation points we must be careful. We added entries to the waiting lists - which we must remove. So defer cancelation for now. */ + which we must remove. So defer cancellation for now. */ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate); while (total > 0) pthread_cond_wait (&cond, &__aio_requests_mutex); - /* Now it's time to restore the cancelation state. */ + /* Now it's time to restore the cancellation state. */ pthread_setcancelstate (oldstate, NULL); /* Release the conditional variable. */ if (pthread_cond_destroy (&cond) != 0) /* This must never happen. */ abort (); +#endif + + /* If any of the I/O requests failed, return -1 and set errno. */ + if (result != 0) + { + __set_errno (result == EINTR ? EINTR : EIO); + result = -1; + } } else { @@ -188,7 +204,10 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent, if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP) { +#ifndef DONT_NEED_AIO_MISC_COND waitlist->list[cnt].cond = NULL; +#endif + waitlist->list[cnt].result = NULL; waitlist->list[cnt].next = requests[cnt]->waiting; waitlist->list[cnt].counterp = &waitlist->counter; waitlist->list[cnt].sigevp = &waitlist->sigev; diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c new file mode 100644 index 0000000000..de35e4376f --- /dev/null +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -0,0 +1,87 @@ +/* Change the protections of file relative to open directory. Linux version. + Copyright (C) 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +fchmodat (fd, file, mode, flag) + int fd; + const char *file; + mode_t mode; + int flag; +{ + if (flag & ~AT_SYMLINK_NOFOLLOW) + { + __set_errno (EINVAL); + return -1; + } +#ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */ + if (flag & AT_SYMLINK_NOFOLLOW) + { + __set_errno (ENOTSUP); + return -1; + } +#endif + + char *buf = NULL; + + if (fd != AT_FDCWD && file[0] != '/') + { + size_t filelen = strlen (file); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd, file); + file = buf; + } + + int result; + INTERNAL_SYSCALL_DECL (err); + +#ifdef __NR_lchmod + if (flag & AT_SYMLINK_NOFOLLOW) + result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode); + else +#endif + result = INTERNAL_SYSCALL (chmod, err, 2, file, mode); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) + { + __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf); + result = -1; + } + + return result; +} diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 9bbd97e6d2..3bc5dc03c2 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 1999-2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1999-2003, 2004, 2005, 2006 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 @@ -423,8 +423,10 @@ #endif /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type - information as well. */ -#if __LINUX_KERNEL_VERSION >= 132612 + information as well and in between 2.6.5 and 2.6.8 most compat wrappers + were fixed too. Except s390{,x} which was fixed in 2.6.11. */ +#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__) # define __ASSUME_GETDENTS32_D_TYPE 1 #endif @@ -435,9 +437,11 @@ #endif /* Starting with version 2.6.9, the waitid system call is available. - Except for powerpc and powerpc64, where it is available in 2.6.12. */ -#if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \ - || (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__) + Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12. */ +#if (__LINUX_KERNEL_VERSION >= 0x020609 \ + && !defined __powerpc__ && !defined __s390__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060c \ + && (defined __powerpc__ || defined __s390__)) # define __ASSUME_WAITID_SYSCALL 1 #endif diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c index 33e51a22b2..00056bee7a 100644 --- a/sysdeps/unix/sysv/linux/mips/brk.c +++ b/sysdeps/unix/sysv/linux/mips/brk.c @@ -41,7 +41,7 @@ __brk (void *addr) "syscall" /* Perform the system call. */ : "=r" (res) : "I" (SYS_ify (brk)), "r" (addr) -+ : "$4", "$7", __SYSCALL_CLOBBERS); + : "$4", "$7", __SYSCALL_CLOBBERS); newbrk = (void *) res; } __curbrk = newbrk; diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S index 3e4a188a20..0bb5bef78b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,96,97,99, 2003, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include #include @@ -53,7 +53,6 @@ .text ENTRY(__socket) - cfi_startproc stwu r1,-48(r1) cfi_adjust_cfa_offset(48) #if NARGS >= 1 @@ -114,7 +113,6 @@ ENTRY(__socket) addi r1,r1,48 PSEUDO_RET #endif - cfi_endproc PSEUDO_END (__socket) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S index a73f7be666..15d8e84c1f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,96,97,99, 2003, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street, + Fifth Floor, Boston MA 02110-1301, USA. */ #include #include @@ -52,7 +52,6 @@ .text ENTRY(__socket) CALL_MCOUNT NARGS - cfi_startproc stdu r1,-144(r1) cfi_adjust_cfa_offset(144) #if NARGS >= 1 @@ -117,7 +116,6 @@ ENTRY(__socket) addi r1,r1,144 PSEUDO_RET #endif - cfi_endproc PSEUDO_END (__socket) #ifndef NO_WEAK_ALIAS diff --git a/time/sys/time.h b/time/sys/time.h index 96649ffa45..177696b08a 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1994,1996-2002,2003,2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,1996-2002,2003,2005,2006 + 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 @@ -148,7 +149,7 @@ extern int lutimes (__const char *__file, __const struct timeval __tvp[2]) extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW; #endif -#ifdef __USE_GNU +#ifdef __USE_ATFILE /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ -- cgit v1.2.3