]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20060106T0916 cvs/fedora-glibc-2_3_90-28
authorJakub Jelinek <jakub@redhat.com>
Fri, 6 Jan 2006 09:23:26 +0000 (09:23 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 6 Jan 2006 09:23:26 +0000 (09:23 +0000)
50 files changed:
ChangeLog
abi-tags
elf/cache.c
fedora/branch.mk
fedora/glibc.spec.in
include/features.h
include/stdlib.h
io/Makefile
io/Versions
io/fchmodat.c [new file with mode: 0644]
io/fcntl.h
io/sys/stat.h
io/tst-fchmodat.c [new file with mode: 0644]
libio/stdio.h
localedata/ChangeLog
localedata/tst-ctype.c
localedata/tst-mbswcs1.c
nptl/ChangeLog
nptl/Makefile
nptl/sysdeps/pthread/aio_misc.h [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
nptl/tst-cancel24.cc
posix/unistd.h
rt/Makefile
rt/tst-aio10.c [new file with mode: 0644]
rt/tst-aio3.c
rt/tst-aio8.c [new file with mode: 0644]
rt/tst-aio9.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/dl-start.S
sysdeps/powerpc/powerpc32/fpu/fprrest.S
sysdeps/powerpc/powerpc32/fpu/fprsave.S
sysdeps/powerpc/powerpc32/gprrest0.S
sysdeps/powerpc/powerpc32/gprrest1.S
sysdeps/powerpc/powerpc32/gprsave0.S
sysdeps/powerpc/powerpc32/gprsave1.S
sysdeps/powerpc/powerpc32/sysdep.h
sysdeps/powerpc/powerpc64/sysdep.h
sysdeps/pthread/aio_misc.h
sysdeps/pthread/aio_notify.c
sysdeps/pthread/aio_suspend.c
sysdeps/pthread/lio_listio.c
sysdeps/unix/sysv/linux/fchmodat.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/kernel-features.h
sysdeps/unix/sysv/linux/mips/brk.c
sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
time/sys/time.h

index 1f7fa156c62a9a1ab3682ef50491782e42b31a4e..31a5a7a44d5e7152df78e78c0e88ab2fdd970bec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,84 @@
+2006-01-05  Jakub Jelinek  <jakub@redhat.com>
+
+       * 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  <drepper@redhat.com>
+
+       * 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  <roland@redhat.com>
+
+       * 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  <sjmunroe@us.ibm.com>
+
+       * 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  <drepper@redhat.com>
+
+       * 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  <vanders@liqwyd.com>
+
+       * abi-tags (*-.*-syllable.*): New match, with ABI value 5.
+       * elf/cache.c (print_entry): Match the Syllable ABI tag.
+
+2006-01-04  Ulrich Drepper  <drepper@redhat.com>
+
+       * include/stdlib.h: Make even more C++ compliant.
+
 2006-01-04  Joseph S. Myers  <joseph@codesourcery.com>
 
        * sysdeps/unix/sysv/linux/mips/brk.c (__brk): Use
index 31c14c2bc21f9fae341cb40487a6865472adb13f..87cd6816a91fe94b604f95969023937ed49a1d8e 100644 (file)
--- 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.
index c13918ccb4c6fa63f6fe31fd0e162d112efbfb57..9462ac1b538215cd6f73052937796d2bc0582a1a 100644 (file)
@@ -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;
index aff47f5bfa524832872d5c1942323435720b82cf..b919262658b8ab6bdf006810c806725dc028bac9 100644 (file)
@@ -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
index d0692de3e7deaa7e1edec250c9591eaaf5fab026..a4e2a564588b8209cb260eb0cb5f67adae4aa19f 100644 (file)
@@ -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 <<EOF
+mkdir -p override_headers/linux
+cat > override_headers/linux/version.h <<EOF
+#define UTS_RELEASE "2.6.9"
+#define LINUX_VERSION_CODE 132617
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+EOF
+mkdir -p override_headers/asm
+cat > override_headers/asm/unistd.h <<EOF
 #ifndef _HACK_ASM_UNISTD_H
 #include_next <asm/unistd.h>
 %ifarch alpha
@@ -418,7 +424,7 @@ cat > asm/unistd.h <<EOF
 %endif
 #endif
 EOF
-cat > asm/errno.h <<EOF
+cat > override_headers/asm/errno.h <<EOF
 #ifndef _HACK_ASM_ERRNO_H
 #include_next <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 <jakub@redhat.com> 2.3.90-28
+- update from CVS
+  - make aio_suspend interruptible by signals (#171968)
+
+* Fri Jan  6 2006 Jakub Jelinek <jakub@redhat.com> 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 <jakub@redhat.com> 2.3.90-26
 - update from CVS
   - for newly linked lio_listio* callers, send per request
index 4c93af7c0b6dcf79fb8dad07cfa9f4300b52f85a..656caaf639f0efb4fd28d62a84e4aa917317e193 100644 (file)
@@ -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.
 #undef __USE_BSD
 #undef __USE_SVID
 #undef __USE_MISC
+#undef __USE_ATFILE
 #undef __USE_GNU
 #undef __USE_REENTRANT
 #undef __USE_FORTIFY_LEVEL
 # 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,
 # define __USE_SVID    1
 #endif
 
+#ifdef _ATFILE_SOURCE
+# define __USE_ATFILE  1
+#endif
+
 #ifdef _GNU_SOURCE
 # define __USE_GNU     1
 #endif
index 90b779d895a367df4cb5e7c9082df4abffe806b4..89bee37c0a3471bd9d5b01fc8f99809147a026eb 100644 (file)
@@ -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
index 4731e24d2472ed2f6c9a71ca06a53a0bea69204b..b263a487054c4228347c39e95f90e6fb2caf427b 100644 (file)
@@ -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
 
index 2f0f94f3bbbeb8c0e96efb7eb8314346d726c1b3..8cb1abdb4208ea9bdb3715d599a4f1d63d3546b2 100644 (file)
@@ -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 (file)
index 0000000..6aecf2a
--- /dev/null
@@ -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 <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+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 <stub-tag.h>
index 8e13d33dcc91c1e49d91b004bcd42bb9524df41a..fd45933fc266304e13342c170203eeb56017ae3b 100644 (file)
@@ -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.
 
index 6ce3a1be662b65f3b898903c8745e88f94ee4693..93cd7d0610937e3744349bae1a9fd56a269efb97 100644 (file)
@@ -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 (file)
index 0000000..0288d6b
--- /dev/null
@@ -0,0 +1,146 @@
+/* Test for fchmodat function.  */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+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;
+}
index 0076028324ebfab7612fe5348eaf48014707f4fe..3be57285798821ad3ea24f445d2c6308942cf094 100644 (file)
@@ -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;
index 67a60bd8be2d987dcd6bfea07ce8fe697f53f736..f4c29fc173a63bda1132ee08643e5207ab14c148 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-27  Roland McGrath  <roland@redhat.com>
+
+       * tst-ctype.c (main): Add some casts.
+
+       * tst-mbswcs1.c (main): Make BUF const.  Add casts in mbrtowc calls.
+
 2006-01-02  Andreas Jaeger  <aj@suse.de>
 
        * locales/fi_FI: Fix date_fmt.
index fb2e78cbb2cb291175bcfa4ba78e048ad66d2daa..f4e01f0826ee5483a1cac17529e5f2893befc6df 100644 (file)
@@ -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 <drepper@gnu.org>, 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;
index 93795beb9e71652045c9d7e40882e621a5ad71c3..fb2ea84cdd1181a778acfb18a25775f8681512c6 100644 (file)
@@ -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 <haible@ilog.fr>.
 
@@ -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;
 }
index 3bc50ba637a7cac6d690b936589bfe92adec6d2a..73fc297317284eee16b7507b9f84a47afe04c7cc 100644 (file)
@@ -1,3 +1,25 @@
+2006-01-05  Ulrich Drepper  <drepper@redhat.com>
+
+       * 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  <joseph@codesourcery.com>
+
+       * Makefile ($(objpfx)$(multidir)): Use mkdir -p.
+
+2006-01-03  Steven Munroe  <sjmunroe@us.ibm.com>
+
+       * 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  <drepper@redhat.com>
+
+       * tst-cancel24.cc: Use C headers instead of C++ headers.
+
 2006-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Remove #error for
index b15b8ad23a95528421f41a409f998bb22f41009c..119d6a6f0d467c8a29b78f5f41cba1838787a03e 100644 (file)
@@ -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 (file)
index 0000000..5aeb34e
--- /dev/null
@@ -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 <assert.h>
+#include <pthreadP.h>
+#include <lowlevellock.h>
+
+#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 <aio_misc.h>
index b86f11c9b4fc2fbe8325750af3abb9331d1d5462..fd1ee4569d5de3ea5d59bd2cedb94347229357b2 100644 (file)
@@ -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 <drepper@redhat.com>, 2002.
 
 
 
 #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) \
index 84acf3843437e368202648ff152f1573c2eb7e27..dcbc0d652023695dfd0202f134f6816dad89275d 100644 (file)
@@ -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 <Franz.Sirl-kernel@lauterbach.com>, 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 <sysdep.h>
 #include <tls.h>
@@ -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
index 226aaafdcef811af38077495c51a13216f2144fd..83eb444ecec42a1a8ba0a459881c9da24a05ffe4 100644 (file)
@@ -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 <Franz.Sirl-kernel@lauterbach.com>, 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 <sysdep.h>
 #include <tls.h>
@@ -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
index 40c2518af6aa7ca0d3f84de20a3d2f3a874fb1ed..ebcfe6eef13cca3744a0e7873abf5fd8f92bd6a6 100644 (file)
@@ -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 <drepper@redhat.com>, 2002.
 
 
 
 #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) \
index 52cf079d5a52fe8d1bc1452571c4dc165c9f9f20..1af709a8cab1d422ef4401e2b2d178df86f863c5 100644 (file)
@@ -1,7 +1,7 @@
-#include <cstdlib>
-#include <cstdio>
 #include <pthread.h>
 #include <semaphore.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include <unistd.h>
 
 
index 4c03c4d702f182785a9b3c03da2af2dbfa58ec6f..480de5e40f1b687aa3ced53871861242f07de925 100644 (file)
@@ -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));
index cc01cb95c9ee0a72cb1289fddad133c353a69c29..f8487975dddd27cf5cc45c477a5dbbb5e4526bb0 100644 (file)
@@ -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 (file)
index 0000000..6e8f7b7
--- /dev/null
@@ -0,0 +1,119 @@
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+
+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"
index 0c0ced4501c66c9ef49add9a66379bd15e956bb4..95da4c13251625a6dcc4cfaaa696395e7c5188d8 100644 (file)
@@ -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
 #include <unistd.h>
 #include <errno.h>
 
-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 (file)
index 0000000..b03639d
--- /dev/null
@@ -0,0 +1,39 @@
+#include <aio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+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 (file)
index 0000000..eab4f68
--- /dev/null
@@ -0,0 +1,124 @@
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+
+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"
index 7403a352fad4a4b28ff7b0a2a009b84d6d09c6c0..c77c4de1987a7003efb4c52531fb98ad84c61e84 100644 (file)
@@ -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 <sysdep.h>
 
@@ -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
index 42317809eb1ec75e336a844c8ffcc00b53babfcf..2f6c6deb2ec275cfa3c4450bf5b8270469280916 100644 (file)
@@ -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)
index d7bc1ab7dcbc9e31f0167672ccf8b43e8ac5b16d..597c3e611fb47e0e116a36e5478581f973074836 100644 (file)
@@ -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)
index cf493f0c473e34dac24f92e82142453f03514950..90eb4a0c4ce31878ddda31bfcb1b092a950cd0e4 100644 (file)
@@ -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)
index 5ac18606f87c9365dc8934f240ec46d7980543c0..ca00b8f133e64b395525f7409f00ff5b607c490c 100644 (file)
@@ -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)
index a09f1e569ad12d0817799aca37174f01d34a0a9d..8b81647dd77aed5b0592c96849d4957593816dd5 100644 (file)
@@ -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)
index 06ee4a69d31994123fc82ecfdb867a93b0c0c1bf..6c1790129ebf9e58246e8117154eaf09bcea0841 100644 (file)
@@ -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)
index 552f595a10f607c17346a02b60d238b62ec20e88..8fc624ebd927ea9c6ec05e018273892ae222e483 100644 (file)
@@ -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 <sysdeps/powerpc/sysdep.h>
 
@@ -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);                                                   \
   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)                                                     \
index fead0b578a2aea71fa41a51b929218c68e1b37e6..2745d7eb716811308e156f8aec825479efad4fd1 100644 (file)
@@ -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 <sysdeps/powerpc/sysdep.h>
 
@@ -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)
 
index 44d53b078f04708f881d585c218cd47a4b9d4707..50962c751966087d0253c0d6daf84a4d5e26625d 100644 (file)
@@ -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;
index 877e8d936331c138c0ae3459cb8587dcb7ee808c..3f7f70ef7c1cff2706b712fc06f7034e9fca2b69 100644 (file)
@@ -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 <drepper@cygnus.com>, 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);
index 8f8e33a7dc29345264a498291f1a20e58a1ee44a..b85b16d10e3868f010642a09647e497b21d3048a 100644 (file)
@@ -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 <drepper@cygnus.com>, 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;
index 815840397e363034f4c8fd6d14a1303bc8fefcee..c652404ae2c6e1c550c4987067d0f0a2f521fbf8 100644 (file)
@@ -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 (file)
index 0000000..de35e43
--- /dev/null
@@ -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 <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <sysdep.h>
+
+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;
+}
index 9bbd97e6d21b33b592e0c3a5d9c60bdd8f0855f4..3bc5dc03c24b1d0a17ce9614b1fbbb4ba5c53250 100644 (file)
@@ -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
 #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
 
 #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
 
index 33e51a22b2fa63982bb31e95975140db3c56599e..00056bee7aa49d234fa0ef8416b3bd21e4c0a369 100644 (file)
@@ -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;
index 3e4a188a20ea1e5a7a3113e3c8761d48695b40a1..0bb5bef78b783b4629d3b0a59d7595ac67e61f11 100644 (file)
@@ -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 <sysdep-cancel.h>
 #include <socketcall.h>
@@ -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)
 
index a73f7be666d2b623726e533587090d199464eb6d..15d8e84c1f0faa8218edeebb7d71f7c35b994ea0 100644 (file)
@@ -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 <sysdep-cancel.h>
 #include <socketcall.h>
@@ -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
index 96649ffa45f6e4e2389143d2528516569e8ee192..177696b08aa4894b2759ef28c1a6b9bd1717866b 100644 (file)
@@ -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.  */