Updated to fedora-glibc-20060106T0916

This commit is contained in:
Jakub Jelinek 2006-01-06 09:23:26 +00:00
parent 04c414477b
commit dd486f53ee
50 changed files with 1057 additions and 156 deletions

View File

@ -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> 2006-01-04 Joseph S. Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/brk.c (__brk): Use * sysdeps/unix/sysv/linux/mips/brk.c (__brk): Use

View File

@ -26,5 +26,7 @@
.*-.*-knetbsd.*-gnu.* 4 1.6.0 # earliest compatible kernel version .*-.*-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 # There is no catch-all default here because every supported OS that uses
# ELF must have its own unique ABI tag. # ELF must have its own unique ABI tag.

View File

@ -107,7 +107,8 @@ print_entry (const char *lib, int flag, unsigned int osversion,
[2] = "Solaris", [2] = "Solaris",
[3] = "FreeBSD", [3] = "FreeBSD",
[4] = "kNetBSD", [4] = "kNetBSD",
[5] = N_("Unknown OS") [5] = "Syllable",
[6] = N_("Unknown OS")
}; };
#define MAXTAG (sizeof abi_tag_os / sizeof abi_tag_os[0] - 1) #define MAXTAG (sizeof abi_tag_os / sizeof abi_tag_os[0] - 1)
unsigned int os = osversion >> 24; unsigned int os = osversion >> 24;

View File

@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD glibc-base := HEAD
DIST_BRANCH := devel DIST_BRANCH := devel
COLLECTION := dist-fc4 COLLECTION := dist-fc4
fedora-sync-date := 2006-01-04 07:54 UTC fedora-sync-date := 2006-01-06 09:16 UTC
fedora-sync-tag := fedora-glibc-20060104T0754 fedora-sync-tag := fedora-glibc-20060106T0916

View File

@ -1,4 +1,4 @@
%define glibcrelease 26 %define glibcrelease 28
%define auxarches i586 i686 athlon sparcv9 alphaev6 %define auxarches i586 i686 athlon sparcv9 alphaev6
%define prelinkarches noarch %define prelinkarches noarch
%define xenarches i686 athlon %define xenarches i686 athlon
@ -237,8 +237,14 @@ package or when debugging this package.
%endif %endif
# Hack till glibc-kernheaders get updated, argh # Hack till glibc-kernheaders get updated, argh
mkdir asm mkdir -p override_headers/linux
cat > asm/unistd.h <<EOF 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 #ifndef _HACK_ASM_UNISTD_H
#include_next <asm/unistd.h> #include_next <asm/unistd.h>
%ifarch alpha %ifarch alpha
@ -418,7 +424,7 @@ cat > asm/unistd.h <<EOF
%endif %endif
#endif #endif
EOF EOF
cat > asm/errno.h <<EOF cat > override_headers/asm/errno.h <<EOF
#ifndef _HACK_ASM_ERRNO_H #ifndef _HACK_ASM_ERRNO_H
#include_next <asm/errno.h> #include_next <asm/errno.h>
%ifarch alpha %ifarch alpha
@ -530,7 +536,7 @@ mkdir $builddir ; cd $builddir
build_CFLAGS="$BuildFlags -g -O3 $*" build_CFLAGS="$BuildFlags -g -O3 $*"
CC="$GCC" CXX="$GXX" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \ CC="$GCC" CXX="$GXX" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \
--enable-add-ons=nptl$AddOns --without-cvs $EnableKernel \ --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 \ --with-tls --with-__thread --build %{nptl_target_cpu}-redhat-linux \
--host %{nptl_target_cpu}-redhat-linux \ --host %{nptl_target_cpu}-redhat-linux \
--disable-profile --disable-profile
@ -1122,6 +1128,13 @@ rm -f *.filelist*
%endif %endif
%changelog %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 * Wed Jan 4 2006 Jakub Jelinek <jakub@redhat.com> 2.3.90-26
- update from CVS - update from CVS
- for newly linked lio_listio* callers, send per request - for newly linked lio_listio* callers, send per request

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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. _FILE_OFFSET_BITS=N Select default filesystem interface.
_BSD_SOURCE ISO C, POSIX, and 4.3BSD things. _BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
_SVID_SOURCE ISO C, POSIX, and SVID things. _SVID_SOURCE ISO C, POSIX, and SVID things.
_ATFILE_SOURCE Additional *at interfaces.
_GNU_SOURCE All of the above, plus GNU extensions. _GNU_SOURCE All of the above, plus GNU extensions.
_REENTRANT Select additionally reentrant object. _REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems. _THREAD_SAFE Same as _REENTRANT, often used by other systems.
@ -69,6 +71,7 @@
__USE_BSD Define 4.3BSD things. __USE_BSD Define 4.3BSD things.
__USE_SVID Define SVID things. __USE_SVID Define SVID things.
__USE_MISC Define things common to BSD and System V Unix. __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_GNU Define GNU extensions.
__USE_REENTRANT Define reentrant/thread-safe *_r functions. __USE_REENTRANT Define reentrant/thread-safe *_r functions.
__USE_FORTIFY_LEVEL Additional security measures used, according to level. __USE_FORTIFY_LEVEL Additional security measures used, according to level.
@ -102,6 +105,7 @@
#undef __USE_BSD #undef __USE_BSD
#undef __USE_SVID #undef __USE_SVID
#undef __USE_MISC #undef __USE_MISC
#undef __USE_ATFILE
#undef __USE_GNU #undef __USE_GNU
#undef __USE_REENTRANT #undef __USE_REENTRANT
#undef __USE_FORTIFY_LEVEL #undef __USE_FORTIFY_LEVEL
@ -158,6 +162,8 @@
# define _BSD_SOURCE 1 # define _BSD_SOURCE 1
# undef _SVID_SOURCE # undef _SVID_SOURCE
# define _SVID_SOURCE 1 # define _SVID_SOURCE 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
#endif #endif
/* If nothing (other than _GNU_SOURCE) is defined, /* If nothing (other than _GNU_SOURCE) is defined,
@ -256,6 +262,10 @@
# define __USE_SVID 1 # define __USE_SVID 1
#endif #endif
#ifdef _ATFILE_SOURCE
# define __USE_ATFILE 1
#endif
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
# define __USE_GNU 1 # define __USE_GNU 1
#endif #endif

View File

@ -144,44 +144,44 @@ libc_hidden_proto (____strtoul_l_internal)
libc_hidden_proto (____strtoull_l_internal) libc_hidden_proto (____strtoull_l_internal)
extern __inline double extern __inline double
__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr,
__locale_t __loc) __locale_t __loc))
{ {
return ____strtod_l_internal (__nptr, __endptr, 0, __loc); return ____strtod_l_internal (__nptr, __endptr, 0, __loc);
} }
extern __inline long int extern __inline long int
__strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtol_l (__const char *__restrict __nptr, char **__restrict __endptr,
int __base, __locale_t __loc) int __base, __locale_t __loc))
{ {
return ____strtol_l_internal (__nptr, __endptr, __base, 0, __loc); return ____strtol_l_internal (__nptr, __endptr, __base, 0, __loc);
} }
extern __inline unsigned long int extern __inline unsigned long int
__strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtoul_l (__const char *__restrict __nptr,
int __base, __locale_t __loc) char **__restrict __endptr, int __base, __locale_t __loc))
{ {
return ____strtoul_l_internal (__nptr, __endptr, __base, 0, __loc); return ____strtoul_l_internal (__nptr, __endptr, __base, 0, __loc);
} }
extern __inline float extern __inline float
__strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtof_l (__const char *__restrict __nptr, char **__restrict __endptr,
__locale_t __loc) __locale_t __loc))
{ {
return ____strtof_l_internal (__nptr, __endptr, 0, __loc); return ____strtof_l_internal (__nptr, __endptr, 0, __loc);
} }
extern __inline long double extern __inline long double
__strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtold_l (__const char *__restrict __nptr,
__locale_t __loc) char **__restrict __endptr, __locale_t __loc))
{ {
return ____strtold_l_internal (__nptr, __endptr, 0, __loc); return ____strtold_l_internal (__nptr, __endptr, 0, __loc);
} }
__extension__ extern __inline long long int __extension__ extern __inline long long int
__strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, __NTH (__strtoll_l (__const char *__restrict __nptr,
int __base, __locale_t __loc) char **__restrict __endptr, int __base, __locale_t __loc))
{ {
return ____strtoll_l_internal (__nptr, __endptr, __base, 0, __loc); return ____strtoll_l_internal (__nptr, __endptr, __base, 0, __loc);
} }
__extension__ extern __inline unsigned long long int __extension__ extern __inline unsigned long long int
__strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr, __NTH (__strtoull_l (__const char * __restrict __nptr,
int __base, __locale_t __loc) char **__restrict __endptr, int __base, __locale_t __loc))
{ {
return ____strtoull_l_internal (__nptr, __endptr, __base, 0, __loc); return ____strtoull_l_internal (__nptr, __endptr, __base, 0, __loc);
} }
@ -196,7 +196,7 @@ __strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr,
#endif #endif
extern void * __default_morecore (ptrdiff_t); extern void *__default_morecore (ptrdiff_t) __THROW;
libc_hidden_proto (__default_morecore) libc_hidden_proto (__default_morecore)
__END_DECLS __END_DECLS

View 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. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -35,7 +35,8 @@ routines := \
fxstatat fxstatat64 \ fxstatat fxstatat64 \
statfs fstatfs statfs64 fstatfs64 \ statfs fstatfs statfs64 fstatfs64 \
statvfs fstatvfs statvfs64 fstatvfs64 \ statvfs fstatvfs statvfs64 fstatvfs64 \
umask chmod fchmod lchmod mkdir mkdirat \ umask chmod fchmod lchmod fchmodat \
mkdir mkdirat \
open open64 openat openat64 close \ open open64 openat openat64 close \
read write lseek lseek64 access euidaccess \ read write lseek lseek64 access euidaccess \
fcntl flock lockf lockf64 \ fcntl flock lockf lockf64 \
@ -63,7 +64,7 @@ test-srcs := ftwtest
tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \ tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
tst-openat tst-unlinkat tst-fstatat tst-futimesat \ tst-openat tst-unlinkat tst-fstatat tst-futimesat \
tst-renameat tst-fchownat tst-renameat tst-fchownat tst-fchmodat
distribute := ftwtest-sh distribute := ftwtest-sh

View File

@ -98,6 +98,7 @@ libc {
nftw; nftw64; nftw; nftw64;
} }
GLIBC_2.4 { GLIBC_2.4 {
fchmodat;
fchownat; fchownat;
__fxstatat; __fxstatat64; __fxstatat; __fxstatat64;
linkat; linkat;

50
io/fchmodat.c Normal file
View File

@ -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>

View File

@ -1,5 +1,5 @@
/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005 /* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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. */ # define SEEK_END 2 /* Seek from end of file. */
#endif /* XPG */ #endif /* XPG */
#ifdef __USE_GNU #ifdef __USE_ATFILE
# define AT_FDCWD -100 /* Special value used to indicate # define AT_FDCWD -100 /* Special value used to indicate
openat should use the current openat should use the current
working directory. */ 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)); extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1));
#endif #endif
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Similar to OPEN but a relative path name is interpreted relative to /* Similar to `open' but a relative path name is interpreted relative to
the directory for which FD is a descriptor. 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 through this interface, especially using the O_XATTR flag. This is not
yet supported here. yet supported here.

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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; extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif #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, /* Set the file creation mask of the current process to MASK,
and return the old creation mask. */ and return the old creation mask. */

146
io/tst-fchmodat.c Normal file
View File

@ -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;
}

View File

@ -1,5 +1,5 @@
/* Define ISO C stdio on top of C++ iostreams. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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; extern int rename (__const char *__old, __const char *__new) __THROW;
__END_NAMESPACE_STD __END_NAMESPACE_STD
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
extern int renameat (int __oldfd, __const char *__old, int __newfd, extern int renameat (int __oldfd, __const char *__old, int __newfd,
__const char *__new) __THROW; __const char *__new) __THROW;

View 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> 2006-01-02 Andreas Jaeger <aj@suse.de>
* locales/fi_FI: Fix date_fmt. * locales/fi_FI: Fix date_fmt.

View 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000. Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
@ -345,14 +345,14 @@ punct = %04x alnum = %04x\n",
|| getline (&resline, &reslinelen, stdin) <= 0) || getline (&resline, &reslinelen, stdin) <= 0)
break; break;
inp = strchr (inpline, '\n'); inp = (unsigned char *) strchr (inpline, '\n');
if (inp != NULL) if (inp != NULL)
*inp = '\0'; *inp = '\0';
resp = strchr (resline, '\n'); resp = (unsigned char *) strchr (resline, '\n');
if (resp != NULL) if (resp != NULL)
*resp = '\0'; *resp = '\0';
inp = inpline; inp = (unsigned char *) inpline;
while (*inp != ' ' && *inp != '\t' && *inp && *inp != '\n' while (*inp != ' ' && *inp != '\t' && *inp && *inp != '\n'
&& *inp != '\0') && *inp != '\0')
++inp; ++inp;
@ -371,11 +371,11 @@ punct = %04x alnum = %04x\n",
if (strcmp (inpline, classes[n].name) == 0) if (strcmp (inpline, classes[n].name) == 0)
break; break;
resp = resline; resp = (unsigned char *) resline;
while (*resp == ' ' || *resp == '\t') while (*resp == ' ' || *resp == '\t')
++resp; ++resp;
if (strlen (inp) != strlen (resp)) if (strlen ((char *) inp) != strlen ((char *) resp))
{ {
printf ("lines \"%.20s\"... and \"%.20s\" have not the same length\n", printf ("lines \"%.20s\"... and \"%.20s\" have not the same length\n",
inp, resp); inp, resp);
@ -384,7 +384,7 @@ punct = %04x alnum = %04x\n",
if (n < nclasses) if (n < nclasses)
{ {
if (strspn (resp, "01") != strlen (resp)) if (strspn ((char *) resp, "01") != strlen ((char *) resp))
{ {
printf ("result string \"%s\" malformed\n", resp); printf ("result string \"%s\" malformed\n", resp);
continue; continue;

View File

@ -1,5 +1,5 @@
/* Test restarting behaviour of mbrtowc. /* 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. This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@ilog.fr>. Contributed by Bruno Haible <haible@ilog.fr>.
@ -37,7 +37,7 @@
int int
main (void) 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; mbstate_t state;
wchar_t wc = 42; wchar_t wc = 42;
size_t n; size_t n;
@ -52,12 +52,12 @@ main (void)
memset (&state, '\0', sizeof (state)); memset (&state, '\0', sizeof (state));
show (mbrtowc (&wc, buf + 0, 1, &state), 1, 37); show (mbrtowc (&wc, (const char *) buf + 0, 1, &state), 1, 37);
show (mbrtowc (&wc, buf + 1, 1, &state), -2, 37); show (mbrtowc (&wc, (const char *) buf + 1, 1, &state), -2, 37);
show (mbrtowc (&wc, buf + 2, 3, &state), 2, 8364); show (mbrtowc (&wc, (const char *) buf + 2, 3, &state), 2, 8364);
show (mbrtowc (&wc, buf + 4, 1, &state), -2, 8364); show (mbrtowc (&wc, (const char *) buf + 4, 1, &state), -2, 8364);
show (mbrtowc (&wc, buf + 5, 1, &state), 1, 955); show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), 1, 955);
show (mbrtowc (&wc, buf + 5, 1, &state), -1, 955); show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), -1, 955);
return result; return result;
} }

View 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> 2006-01-03 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Remove #error for * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Remove #error for

View File

@ -324,7 +324,7 @@ crti-objs += $(multidir)/crti.o
crtn-objs += $(multidir)/crtn.o crtn-objs += $(multidir)/crtn.o
omit-deps += $(multidir)/crti $(multidir)/crtn omit-deps += $(multidir)/crti $(multidir)/crtn
$(objpfx)$(multidir): $(objpfx)$(multidir):
mkdir $@ mkdir -p $@
endif endif
extra-objs += $(crti-objs) $(crtn-objs) extra-objs += $(crti-objs) $(crtn-objs)
omit-deps += crti crtn omit-deps += crti crtn

View File

@ -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>

View 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -66,17 +66,33 @@
#define lll_futex_wait(futex, val) \ #define lll_futex_wait(futex, val) \
do { \ ({ \
int __ignore; \ int __status; \
register __typeof (val) _val asm ("edx") = (val); \ register __typeof (val) _val asm ("edx") = (val); \
__asm __volatile (LLL_EBX_LOAD \ __asm __volatile (LLL_EBX_LOAD \
LLL_ENTER_KERNEL \ LLL_ENTER_KERNEL \
LLL_EBX_LOAD \ LLL_EBX_LOAD \
: "=a" (__ignore) \ : "=a" (__status) \
: "0" (SYS_futex), LLL_EBX_REG (futex), "S" (0), \ : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (0), \
"c" (FUTEX_WAIT), "d" (_val), \ "c" (FUTEX_WAIT), "d" (_val), \
"i" (offsetof (tcbhead_t, sysinfo))); \ "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) \ #define lll_futex_wake(futex, nr) \

View File

@ -1,5 +1,5 @@
/* Cancellable system call stubs. Linux/PowerPC version. /* 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. This file is part of the GNU C Library.
Contributed by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, 2003. 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <tls.h> #include <tls.h>
@ -30,7 +30,6 @@
# define PSEUDO(name, syscall_name, args) \ # define PSEUDO(name, syscall_name, args) \
.section ".text"; \ .section ".text"; \
ENTRY (name) \ ENTRY (name) \
cfi_startproc; \
SINGLE_THREAD_P; \ SINGLE_THREAD_P; \
bne- .Lpseudo_cancel; \ bne- .Lpseudo_cancel; \
.type __##syscall_name##_nocancel,@function; \ .type __##syscall_name##_nocancel,@function; \
@ -62,8 +61,7 @@
CGOTRESTORE; \ CGOTRESTORE; \
mtlr 4; \ mtlr 4; \
mtcr 0; \ mtcr 0; \
addi 1,1,48; \ addi 1,1,48;
cfi_endproc;
# define DOCARGS_0 # define DOCARGS_0
# define UNDOCARGS_0 # define UNDOCARGS_0

View File

@ -1,5 +1,5 @@
/* Cancellable system call stubs. Linux/PowerPC64 version. /* 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. This file is part of the GNU C Library.
Contributed by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, 2003. 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <tls.h> #include <tls.h>
@ -36,7 +36,6 @@
# define PSEUDO(name, syscall_name, args) \ # define PSEUDO(name, syscall_name, args) \
.section ".text"; \ .section ".text"; \
ENTRY (name) \ ENTRY (name) \
cfi_startproc; \
SINGLE_THREAD_P; \ SINGLE_THREAD_P; \
bne- .Lpseudo_cancel; \ bne- .Lpseudo_cancel; \
.type DASHDASHPFX(syscall_name##_nocancel),@function; \ .type DASHDASHPFX(syscall_name##_nocancel),@function; \
@ -66,8 +65,7 @@
ld 3,64(1); \ ld 3,64(1); \
mtlr 9; \ mtlr 9; \
mtcr 0; \ mtcr 0; \
addi 1,1,128; \ addi 1,1,128;
cfi_endproc;
# define DOCARGS_0 # define DOCARGS_0
# define UNDOCARGS_0 # define UNDOCARGS_0

View 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -47,16 +47,31 @@
#define lll_futex_wait(futex, val) \ #define lll_futex_wait(futex, val) \
do { \ ({ \
int __ignore; \ int __status; \
register __typeof (val) _val asm ("edx") = (val); \ register __typeof (val) _val asm ("edx") = (val); \
__asm __volatile ("xorq %%r10, %%r10\n\t" \ __asm __volatile ("xorq %%r10, %%r10\n\t" \
"syscall" \ "syscall" \
: "=a" (__ignore) \ : "=a" (__status) \
: "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \ : "0" (SYS_futex), "D" (futex), "S" (FUTEX_WAIT), \
"d" (_val) \ "d" (_val) \
: "memory", "cc", "r10", "r11", "cx"); \ : "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) \ #define lll_futex_wake(futex, nr) \

View File

@ -1,7 +1,7 @@
#include <cstdlib>
#include <cstdio>
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>

View File

@ -431,7 +431,7 @@ extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
#endif /* Use BSD || X/Open Unix. */ #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 /* Change the owner and group of FILE relative to the directory FD is open
on. */ on. */
extern int fchownat (int __fd, __const char *__file, __uid_t __owner, 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) extern int link (__const char *__from, __const char *__to)
__THROW __nonnull ((1, 2)) __wur; __THROW __nonnull ((1, 2)) __wur;
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Like link but relative paths in TO and FROM are interpreted relative /* Like link but relative paths in TO and FROM are interpreted relative
to FROMFD and TOFD respectively. */ to FROMFD and TOFD respectively. */
extern int linkat (int __fromfd, __const char *__from, int __tofd, 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; size_t __len) __THROW __nonnull ((1, 2)) __wur;
#endif /* Use BSD. */ #endif /* Use BSD. */
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD. */ /* Like symlink but a relative path in TO is interpreted relative to TOFD. */
extern int symlinkat (__const char *__from, int __tofd, extern int symlinkat (__const char *__from, int __tofd,
__const char *__to) __THROW __nonnull ((1, 3)) __wur; __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. */ /* Remove the link NAME. */
extern int unlink (__const char *__name) __THROW __nonnull ((1)); extern int unlink (__const char *__name) __THROW __nonnull ((1));
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Remove the link NAME relative to FD. */ /* Remove the link NAME relative to FD. */
extern int unlinkat (int __fd, __const char *__name, int __flag) extern int unlinkat (int __fd, __const char *__name, int __flag)
__THROW __nonnull ((2)); __THROW __nonnull ((2));

View 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. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # 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 \ 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-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-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
tst-timer3 tst-timer4 tst-timer5 \ tst-timer3 tst-timer4 tst-timer5 \
tst-cpuclock1 tst-cpuclock2 \ tst-cpuclock1 tst-cpuclock2 \

119
rt/tst-aio10.c Normal file
View File

@ -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"

View File

@ -1,5 +1,5 @@
/* Test for notification mechanism in lio_listio. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -24,13 +24,18 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
int flag; static pthread_barrier_t b;
static void static void
thrfct (sigval_t arg) 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); unlink (name);
if (pthread_barrier_init (&b, NULL, 2) != 0)
{
puts ("barrier_init failed");
return 1;
}
arr[0] = &cb; arr[0] = &cb;
cb.aio_fildes = fd; cb.aio_fildes = fd;
@ -82,9 +93,10 @@ do_test (int argc, char *argv[])
return 1; 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; return 1;
} }

39
rt/tst-aio8.c Normal file
View File

@ -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"

124
rt/tst-aio9.c Normal file
View File

@ -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"

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF startup code. PowerPC version. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdep.h> #include <sysdep.h>
@ -39,7 +39,7 @@ ENTRY(_start)
bl _dl_start@local bl _dl_start@local
/* FALLTHRU */ /* FALLTHRU */
ENTRY(_dl_start_user) _dl_start_user:
/* Now, we do our main work of calling initialisation procedures. /* Now, we do our main work of calling initialisation procedures.
The ELF ABI doesn't say anything about parameters for these, The ELF ABI doesn't say anything about parameters for these,
so we just pass argc, argv, and the environment. 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 Take the opportunity to clear LR, so anyone who accidentally returns
from _start gets SEGV. Also clear the next few words of the stack. */ from _start gets SEGV. Also clear the next few words of the stack. */
ENTRY(_dl_main_dispatch) _dl_main_dispatch:
li r31,0 li r31,0
stw r31,0(r1) stw r31,0(r1)
mtlr r31 mtlr r31

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
Floating Point Registers (FPRs) restore routine 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 fp30,-16(r1) #restore f30
lfd fp31,-8(r1) #restore f31 lfd fp31,-8(r1) #restore f31
blr #return blr #return
END (_restfpr_all)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
Floating Point Registers (FPRs) save routine 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 stfd fp31,-8(r1) #save f31
stw r0,8(r1) #save LR in callers frame stw r0,8(r1) #save LR in callers frame
blr #return blr #return
END (_savefpr_all)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
General Purpose Register (GPR) restore routine 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 r30,-8(r1) #restore r30
lwz r31,-4(r1) #restore r31 lwz r31,-4(r1) #restore r31
blr #return blr #return
END (_restgpr0_all)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
General Purpose Register (GPR) restore routine 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 r30,-8(r12) #restore r30
lwz r31,-4(r12) #restore r31 lwz r31,-4(r12) #restore r31
blr #return blr #return
END (_restgpr1_all)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
General Purpose Register (GPR) save routine 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 r31,-4(r1) #save r31
stw r0,8(r1) #save LR in callers frame stw r0,8(r1) #save LR in callers frame
blr #return blr #return
END (_savegpr0_all)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
/* /*
General Purpose Register (GPR) save routine 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 r30,-8(r12) #save r30
stw r31,-4(r12) #save r31 stw r31,-4(r12) #save r31
blr #return blr #return
END (_savegpr1_all)

View File

@ -1,5 +1,5 @@
/* Assembly macros for 32-bit PowerPC. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdeps/powerpc/sysdep.h> #include <sysdeps/powerpc/sysdep.h>
@ -31,7 +31,8 @@
for its benefit. */ for its benefit. */
# define CALL_MCOUNT \ # define CALL_MCOUNT \
mflr r0; \ mflr r0; \
stw r0,4(r1); \ stw r0,4(r1); \
cfi_offset (lr, 4); \
bl JUMPTARGET(_mcount); bl JUMPTARGET(_mcount);
#else /* PROF */ #else /* PROF */
# define CALL_MCOUNT /* Do nothing. */ # define CALL_MCOUNT /* Do nothing. */
@ -42,6 +43,7 @@
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
.align ALIGNARG(2); \ .align ALIGNARG(2); \
C_LABEL(name) \ C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT CALL_MCOUNT
#define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_0 /* No words to insert. */
@ -61,6 +63,7 @@
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
.align ALIGNARG(2); \ .align ALIGNARG(2); \
C_LABEL(name) \ C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT \ CALL_MCOUNT \
b 0f; \ b 0f; \
.align ALIGNARG(alignt); \ .align ALIGNARG(alignt); \
@ -72,11 +75,13 @@
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
.align ALIGNARG(alignt); \ .align ALIGNARG(alignt); \
EALIGN_W_##words; \ EALIGN_W_##words; \
C_LABEL(name) C_LABEL(name) \
cfi_startproc;
#endif #endif
#undef END #undef END
#define END(name) \ #define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(name) ASM_SIZE_DIRECTIVE(name)
#define DO_CALL(syscall) \ #define DO_CALL(syscall) \

View File

@ -1,5 +1,5 @@
/* Assembly macros for 64-bit PowerPC. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdeps/powerpc/sysdep.h> #include <sysdeps/powerpc/sysdep.h>
@ -92,7 +92,8 @@ name##: OPD_ENT (name); \
#define ENTRY(name) \ #define ENTRY(name) \
ENTRY_2(name) \ ENTRY_2(name) \
.align ALIGNARG(2); \ .align ALIGNARG(2); \
BODY_LABEL(name): BODY_LABEL(name): \
cfi_startproc;
#define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_0 /* No words to insert. */
#define EALIGN_W_1 nop #define EALIGN_W_1 nop
@ -109,7 +110,8 @@ BODY_LABEL(name):
ENTRY_2(name) \ ENTRY_2(name) \
.align ALIGNARG(alignt); \ .align ALIGNARG(alignt); \
EALIGN_W_##words; \ EALIGN_W_##words; \
BODY_LABEL(name): BODY_LABEL(name): \
cfi_startproc;
/* Local labels stripped out by the linker. */ /* Local labels stripped out by the linker. */
#undef L #undef L
@ -173,11 +175,13 @@ LT_LABELSUFFIX(name,_name_end): ; \
/* END generates Traceback tables */ /* END generates Traceback tables */
#undef END #undef END
#define END(name) \ #define END(name) \
cfi_endproc; \
TRACEBACK(name) \ TRACEBACK(name) \
END_2(name) END_2(name)
/* This form supports more informative traceback tables */ /* This form supports more informative traceback tables */
#define END_GEN_TB(name,mask) \ #define END_GEN_TB(name,mask) \
cfi_endproc; \
TRACEBACK_MASK(name,mask) \ TRACEBACK_MASK(name,mask) \
END_2(name) END_2(name)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -46,7 +46,12 @@ struct waitlist
{ {
struct waitlist *next; struct waitlist *next;
/* The next two fields is used in synchronous `lio_listio' operations. */
#ifndef DONT_NEED_AIO_MISC_COND
pthread_cond_t *cond; pthread_cond_t *cond;
#endif
int *result;
volatile int *counterp; volatile int *counterp;
/* The next field is used in asynchronous `lio_listio' operations. */ /* The next field is used in asynchronous `lio_listio' operations. */
struct sigevent *sigevp; struct sigevent *sigevp;

View File

@ -1,6 +1,5 @@
/* Notify initiator of AIO request. /* Notify initiator of AIO request.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 Copyright (C) 1997-2001, 2003, 2004, 2006 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -144,15 +143,24 @@ __aio_notify (struct requestlist *req)
{ {
struct waitlist *next = waitlist->next; struct waitlist *next = waitlist->next;
/* Decrement the counter. This is used in both cases. */
--*waitlist->counterp;
if (waitlist->sigevp == NULL) 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 else
/* This is part of a asynchronous `lio_listio' operation. If /* This is part of a asynchronous `lio_listio' operation. If
this request is the last one, send the signal. */ this request is the last one, send the signal. */
if (*waitlist->counterp == 0) if (--*waitlist->counterp == 0)
{ {
#ifdef BROKEN_THREAD_SIGNALS #ifdef BROKEN_THREAD_SIGNALS
__aio_notify_only (waitlist->sigevp, waitlist->caller_pid); __aio_notify_only (waitlist->sigevp, waitlist->caller_pid);

View File

@ -1,6 +1,5 @@
/* Suspend until termination of a requests. /* Suspend until termination of a requests.
Copyright (C) 1997,1998,1999,2000,2002,2003,2005 Copyright (C) 1997-2000,2002,2003,2005,2006 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -45,7 +44,9 @@ struct clparam
const struct aiocb *const *list; const struct aiocb *const *list;
struct waitlist *waitlist; struct waitlist *waitlist;
struct requestlist **requestlist; struct requestlist **requestlist;
#ifndef DONT_NEED_AIO_MISC_COND
pthread_cond_t *cond; pthread_cond_t *cond;
#endif
int nent; int nent;
}; };
@ -53,6 +54,12 @@ struct clparam
static void static void
cleanup (void *arg) 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; const struct clparam *param = (const struct clparam *) arg;
/* Now remove the entry in the waiting list for all requests /* Now remove the entry in the waiting list for all requests
@ -76,8 +83,10 @@ cleanup (void *arg)
*listp = (*listp)->next; *listp = (*listp)->next;
} }
#ifndef DONT_NEED_AIO_MISC_COND
/* Release the conditional variable. */ /* Release the conditional variable. */
(void) pthread_cond_destroy (param->cond); (void) pthread_cond_destroy (param->cond);
#endif
/* Release the mutex. */ /* Release the mutex. */
pthread_mutex_unlock (&__aio_requests_mutex); pthread_mutex_unlock (&__aio_requests_mutex);
@ -90,13 +99,21 @@ aio_suspend (list, nent, timeout)
int nent; int nent;
const struct timespec *timeout; const struct timespec *timeout;
{ {
if (__builtin_expect (nent < 0, 0))
{
__set_errno (EINVAL);
return -1;
}
struct waitlist waitlist[nent]; struct waitlist waitlist[nent];
struct requestlist *requestlist[nent]; struct requestlist *requestlist[nent];
#ifndef DONT_NEED_AIO_MISC_COND
pthread_cond_t cond = PTHREAD_COND_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
#endif
int cnt; int cnt;
bool any = false; bool any = false;
int result = 0; int result = 0;
int dummy; int cntr = 1;
/* Request the mutex. */ /* Request the mutex. */
pthread_mutex_lock (&__aio_requests_mutex); pthread_mutex_lock (&__aio_requests_mutex);
@ -112,9 +129,12 @@ aio_suspend (list, nent, timeout)
if (requestlist[cnt] != NULL) if (requestlist[cnt] != NULL)
{ {
#ifndef DONT_NEED_AIO_MISC_COND
waitlist[cnt].cond = &cond; waitlist[cnt].cond = &cond;
#endif
waitlist[cnt].result = NULL;
waitlist[cnt].next = requestlist[cnt]->waiting; waitlist[cnt].next = requestlist[cnt]->waiting;
waitlist[cnt].counterp = &dummy; waitlist[cnt].counterp = &cntr;
waitlist[cnt].sigevp = NULL; waitlist[cnt].sigevp = NULL;
#ifdef BROKEN_THREAD_SIGNALS #ifdef BROKEN_THREAD_SIGNALS
waitlist[cnt].caller_pid = 0; /* Not needed. */ waitlist[cnt].caller_pid = 0; /* Not needed. */
@ -140,12 +160,17 @@ aio_suspend (list, nent, timeout)
.list = list, .list = list,
.waitlist = waitlist, .waitlist = waitlist,
.requestlist = requestlist, .requestlist = requestlist,
#ifndef DONT_NEED_AIO_MISC_COND
.cond = &cond, .cond = &cond,
#endif
.nent = nent .nent = nent
}; };
pthread_cleanup_push (cleanup, &clparam); pthread_cleanup_push (cleanup, &clparam);
#ifdef DONT_NEED_AIO_MISC_COND
AIO_MISC_WAIT (result, cntr, timeout, 1);
#else
if (timeout == NULL) if (timeout == NULL)
result = pthread_cond_wait (&cond, &__aio_requests_mutex); result = pthread_cond_wait (&cond, &__aio_requests_mutex);
else else
@ -167,6 +192,7 @@ aio_suspend (list, nent, timeout)
result = pthread_cond_timedwait (&cond, &__aio_requests_mutex, result = pthread_cond_timedwait (&cond, &__aio_requests_mutex,
&abstime); &abstime);
} }
#endif
pthread_cleanup_pop (0); pthread_cleanup_pop (0);
} }
@ -190,19 +216,23 @@ aio_suspend (list, nent, timeout)
*listp = (*listp)->next; *listp = (*listp)->next;
} }
#ifndef DONT_NEED_AIO_MISC_COND
/* Release the conditional variable. */ /* Release the conditional variable. */
if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0)) if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0))
/* This must never happen. */ /* This must never happen. */
abort (); abort ();
#endif
if (result != 0) 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 the timeout error report of `pthread_cond_timedwait' to the
form expected from `aio_suspend'. */ form expected from `aio_suspend'. */
if (result == ETIMEDOUT) if (result == ETIMEDOUT)
__set_errno (EAGAIN); __set_errno (EAGAIN);
else else
#endif
__set_errno (result); __set_errno (result);
result = -1; result = -1;

View File

@ -122,9 +122,11 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
} }
else if (LIO_MODE (mode) == LIO_WAIT) else if (LIO_MODE (mode) == LIO_WAIT)
{ {
#ifndef DONT_NEED_AIO_MISC_COND
pthread_cond_t cond = PTHREAD_COND_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
struct waitlist waitlist[nent];
int oldstate; int oldstate;
#endif
struct waitlist waitlist[nent];
total = 0; total = 0;
for (cnt = 0; cnt < nent; ++cnt) 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) if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
{ {
#ifndef DONT_NEED_AIO_MISC_COND
waitlist[cnt].cond = &cond; waitlist[cnt].cond = &cond;
#endif
waitlist[cnt].result = &result;
waitlist[cnt].next = requests[cnt]->waiting; waitlist[cnt].next = requests[cnt]->waiting;
waitlist[cnt].counterp = &total; waitlist[cnt].counterp = &total;
waitlist[cnt].sigevp = NULL; 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 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); pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
while (total > 0) while (total > 0)
pthread_cond_wait (&cond, &__aio_requests_mutex); 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); pthread_setcancelstate (oldstate, NULL);
/* Release the conditional variable. */ /* Release the conditional variable. */
if (pthread_cond_destroy (&cond) != 0) if (pthread_cond_destroy (&cond) != 0)
/* This must never happen. */ /* This must never happen. */
abort (); 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 else
{ {
@ -188,7 +204,10 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
if (requests[cnt] != NULL if (requests[cnt] != NULL
&& list[cnt]->aio_lio_opcode != LIO_NOP) && list[cnt]->aio_lio_opcode != LIO_NOP)
{ {
#ifndef DONT_NEED_AIO_MISC_COND
waitlist->list[cnt].cond = NULL; waitlist->list[cnt].cond = NULL;
#endif
waitlist->list[cnt].result = NULL;
waitlist->list[cnt].next = requests[cnt]->waiting; waitlist->list[cnt].next = requests[cnt]->waiting;
waitlist->list[cnt].counterp = &waitlist->counter; waitlist->list[cnt].counterp = &waitlist->counter;
waitlist->list[cnt].sigevp = &waitlist->sigev; waitlist->list[cnt].sigevp = &waitlist->sigev;

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given /* Set flags signalling availability of kernel features based on given
kernel version number. 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -423,8 +423,10 @@
#endif #endif
/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
information as well. */ information as well and in between 2.6.5 and 2.6.8 most compat wrappers
#if __LINUX_KERNEL_VERSION >= 132612 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 # define __ASSUME_GETDENTS32_D_TYPE 1
#endif #endif
@ -435,9 +437,11 @@
#endif #endif
/* Starting with version 2.6.9, the waitid system call is available. /* 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. */ Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12. */
#if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \ #if (__LINUX_KERNEL_VERSION >= 0x020609 \
|| (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__) && !defined __powerpc__ && !defined __s390__) \
|| (__LINUX_KERNEL_VERSION >= 0x02060c \
&& (defined __powerpc__ || defined __s390__))
# define __ASSUME_WAITID_SYSCALL 1 # define __ASSUME_WAITID_SYSCALL 1
#endif #endif

View File

@ -41,7 +41,7 @@ __brk (void *addr)
"syscall" /* Perform the system call. */ "syscall" /* Perform the system call. */
: "=r" (res) : "=r" (res)
: "I" (SYS_ify (brk)), "r" (addr) : "I" (SYS_ify (brk)), "r" (addr)
+ : "$4", "$7", __SYSCALL_CLOBBERS); : "$4", "$7", __SYSCALL_CLOBBERS);
newbrk = (void *) res; newbrk = (void *) res;
} }
__curbrk = newbrk; __curbrk = newbrk;

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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 License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
02111-1307 USA. */ 02110-1301 USA. */
#include <sysdep-cancel.h> #include <sysdep-cancel.h>
#include <socketcall.h> #include <socketcall.h>
@ -53,7 +53,6 @@
.text .text
ENTRY(__socket) ENTRY(__socket)
cfi_startproc
stwu r1,-48(r1) stwu r1,-48(r1)
cfi_adjust_cfa_offset(48) cfi_adjust_cfa_offset(48)
#if NARGS >= 1 #if NARGS >= 1
@ -114,7 +113,6 @@ ENTRY(__socket)
addi r1,r1,48 addi r1,r1,48
PSEUDO_RET PSEUDO_RET
#endif #endif
cfi_endproc
PSEUDO_END (__socket) PSEUDO_END (__socket)

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 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, 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, write to the Free Software Foundation, Inc., 51 Franklin Street,
Boston, MA 02111-1307, USA. */ Fifth Floor, Boston MA 02110-1301, USA. */
#include <sysdep-cancel.h> #include <sysdep-cancel.h>
#include <socketcall.h> #include <socketcall.h>
@ -52,7 +52,6 @@
.text .text
ENTRY(__socket) ENTRY(__socket)
CALL_MCOUNT NARGS CALL_MCOUNT NARGS
cfi_startproc
stdu r1,-144(r1) stdu r1,-144(r1)
cfi_adjust_cfa_offset(144) cfi_adjust_cfa_offset(144)
#if NARGS >= 1 #if NARGS >= 1
@ -117,7 +116,6 @@ ENTRY(__socket)
addi r1,r1,144 addi r1,r1,144
PSEUDO_RET PSEUDO_RET
#endif #endif
cfi_endproc
PSEUDO_END (__socket) PSEUDO_END (__socket)
#ifndef NO_WEAK_ALIAS #ifndef NO_WEAK_ALIAS

View 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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; extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;
#endif #endif
#ifdef __USE_GNU #ifdef __USE_ATFILE
/* Change the access time of FILE relative to FD to TVP[0] and the /* 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 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. */ the current time instead. Returns 0 on success, -1 on errors. */