summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/alpha/sysdep.h40
-rw-r--r--sysdeps/unix/fdopendir.c3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fxstatat.c5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h5
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c62
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c25
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c24
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c30
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c10
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c184
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/i386/call_pselect6.S65
-rw-r--r--sysdeps/unix/sysv/linux/i386/pselect.c18
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/setjmp.h7
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h31
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c24
-rw-r--r--sysdeps/unix/sysv/linux/openat.c108
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Implies4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h19
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure135
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure.in37
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h8
-rw-r--r--sysdeps/unix/sysv/linux/ppoll.c76
-rw-r--r--sysdeps/unix/sysv/linux/pselect.c100
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c107
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h10
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/setjmp.h16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/wordsize.h20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c24
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c23
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c34
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h8
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c38
44 files changed, 1089 insertions, 300 deletions
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index a154db8e41..2260ec5480 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004
+/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -397,4 +397,42 @@ __LABEL(name) \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
+/* Pointer mangling support. Note that tls access is slow enough that
+ we don't deoptimize things by placing the pointer check value there. */
+
+#include <stdint.h>
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#endif
+
#endif /* ASSEMBLER */
diff --git a/sysdeps/unix/fdopendir.c b/sysdeps/unix/fdopendir.c
index 23d08fd7fd..528f180fcb 100644
--- a/sysdeps/unix/fdopendir.c
+++ b/sysdeps/unix/fdopendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -36,6 +36,7 @@ fdopendir (int fd)
__set_errno (ENOTDIR);
return NULL;
}
+
/* Make sure the descriptor allows for reading. */
int flags = __fcntl (fd, F_GETFL);
if (__builtin_expect (flags == -1, 0))
diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
index 127f7f3c57..4cb304cb40 100644
--- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -94,4 +94,5 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
return -1;
}
-strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat, __fxstatat64)
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index c3de78f4bb..a22da71d60 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -22,10 +22,8 @@
#define _LINUX_ALPHA_SYSDEP_H 1
#ifdef __ASSEMBLER__
-
#include <asm/pal.h>
#include <alpha/regdef.h>
-
#endif
/* There is some commonality. */
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 69462bf61c..2ca7df0d13 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -1,6 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-1999,2001-2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999,2001-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
@@ -29,6 +29,9 @@
#define SCHED_OTHER 0
#define SCHED_FIFO 1
#define SCHED_RR 2
+#ifdef __USE_GNU
+# define SCHED_BATCH 3
+#endif
#ifdef __USE_MISC
/* Cloning flags. */
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 80b3b240f7..10b903d076 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -25,8 +25,10 @@
#include <unistd.h>
#include <sys/types.h>
#include <alloca.h>
+#include <kernel-features.h>
#include <sysdep.h>
+
int
faccessat (fd, file, mode, flag)
int fd;
@@ -40,42 +42,59 @@ faccessat (fd, file, mode, flag)
return -1;
}
- char *buf = NULL;
-
- if (fd != AT_FDCWD && file[0] != '/')
+#ifdef __NR_faccessat
+ if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure))
+# ifndef __ASSUME_ATFCTS
+ && __have_atfcts >= 0
+# endif
+ )
{
- 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 = INLINE_SYSCALL (faccessat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
}
+#endif
+#ifndef __ASSUME_ATFCTS
if ((!(flag & AT_EACCESS) || ! __libc_enable_secure)
-#ifndef __NR_laccess /* Linux so far has no laccess syscall. */
+# ifndef __NR_laccess /* Linux so far has no laccess syscall. */
&& !(flag & AT_SYMLINK_NOFOLLOW)
-#endif
+# endif
)
{
/* If we are not set-uid or set-gid, access does the same. */
+ 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_laccess
+# ifdef __NR_laccess
if (flag & AT_SYMLINK_NOFOLLOW)
result = INTERNAL_SYSCALL (laccess, err, 2, file, mode);
else
-#endif
+# endif
result = INTERNAL_SYSCALL (access, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
@@ -86,6 +105,7 @@ faccessat (fd, file, mode, flag)
return result;
}
+#endif
struct stat64 stats;
if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index de35e4376f..8b420153f1 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <alloca.h>
+#include <kernel-features.h>
#include <sysdep.h>
int
@@ -47,6 +48,24 @@ fchmodat (fd, file, mode, flag)
}
#endif
+ int result;
+
+#ifdef __NR_fchmodat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (fchmodat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -67,14 +86,13 @@ fchmodat (fd, file, mode, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_lchmod
+# ifdef __NR_lchmod
if (flag & AT_SYMLINK_NOFOLLOW)
result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode);
else
-#endif
+# endif
result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
@@ -84,4 +102,5 @@ fchmodat (fd, file, mode, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index 10d87e87fc..0f731775b3 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -25,6 +25,8 @@
#include <sys/types.h>
#include <alloca.h>
#include <sysdep.h>
+#include <kernel-features.h>
+
/* Change the owner and group of FILE. */
int
@@ -35,6 +37,24 @@ fchownat (fd, file, owner, group, flag)
gid_t group;
int flag;
{
+ int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
if (flag & ~AT_SYMLINK_NOFOLLOW)
{
__set_errno (EINVAL);
@@ -61,7 +81,6 @@ fchownat (fd, file, owner, group, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_SYMLINK_NOFOLLOW)
@@ -76,4 +95,5 @@ fchownat (fd, file, owner, group, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index be148b8d7a..514f456927 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -35,6 +35,24 @@ futimesat (fd, file, tvp)
const char *file;
const struct timeval tvp[2];
{
+ int result;
+
+#ifdef __NR_futimesat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (file == NULL)
@@ -70,24 +88,23 @@ futimesat (fd, file, tvp)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_utimes
+# ifdef __NR_utimes
result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
-# ifndef __ASSUME_UTIMES
+# ifndef __ASSUME_UTIMES
if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
goto fail;
+# endif
# endif
-#endif
/* The utimes() syscall does not exist or is not available in the
used kernel. Use utime(). For this we have to convert to the
data format utime() expects. */
-#ifndef __ASSUME_UTIMES
+# ifndef __ASSUME_UTIMES
struct utimbuf tmp;
struct utimbuf *times;
@@ -105,9 +122,10 @@ futimesat (fd, file, tvp)
return result;
fail:
-#endif
+# endif
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
return -1;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 9bc3dbc459..c73037b805 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -78,10 +78,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
}
-
#ifdef STAT_IS_KERNEL_STAT
- __set_errno (EINVAL);
- return -1;
+ else
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
#else
struct kernel_stat kst;
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index 83a8816697..220d4abfcf 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -134,3 +134,4 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
return -1;
}
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 985a0860cb..d655ba3b27 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
/* Determine various system internal values, Linux version.
- Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -34,75 +34,6 @@
#include <atomic.h>
-/* The default value for the /proc filesystem mount point. */
-static const char path_proc[] = "/proc";
-
-/* Actual mount point of /proc filesystem. */
-libc_freeres_ptr (static char *mount_proc);
-
-/* Determine the path to the /proc filesystem if available. */
-static const char *
-internal_function
-get_proc_path (char *buffer, size_t bufsize)
-{
- struct mntent mount_point;
- struct mntent *entry;
- char *result = NULL;
- char *copy_result;
- FILE *fp;
-
- /* First find the mount point of the proc filesystem. */
- fp = __setmntent (_PATH_MOUNTED, "r");
- if (fp == NULL)
- fp = __setmntent (_PATH_MNTTAB, "r");
- if (fp != NULL)
- {
- /* We don't need locking. */
- (void) __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- while ((entry = __getmntent_r (fp, &mount_point, buffer, bufsize))
- != NULL)
- if (strcmp (mount_point.mnt_type, "proc") == 0)
- {
- result = mount_point.mnt_dir;
- break;
- }
- __endmntent (fp);
- }
-
- /* If we haven't found anything this is generally a bad sign but we
- handle it gracefully. We return what is hopefully the right
- answer (/proc) but we don't remember this. This will enable
- programs which started before the system is fully running to
- adjust themselves. */
- if (result == NULL)
- return path_proc;
-
- /* Make a copy we can keep around. */
- copy_result = __strdup (result);
- if (copy_result == NULL)
- return result;
-
- /* Now store the copied value. But do it atomically. */
- assert (sizeof (long int) == sizeof (void *__unbounded));
- if (atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
- /* Replacing the value failed. This means another thread was
- faster and we don't need the copy anymore. */
- free (copy_result);
-#if __BOUNDED_POINTERS__
- else
- {
- /* compare_and_swap only copied the pointer value, so we must
- now copy the bounds as well. */
- __ptrlow (mount_proc) = __ptrlow (copy_result);
- __ptrhigh (mount_proc) = __ptrhigh (copy_result);
- }
-#endif
-
- return mount_proc;
-}
-
-
/* How we can determine the number of available processors depends on
the configuration. There is currently (as of version 2.0.21) no
system call to determine the number. It is planned for the 2.1.x
@@ -136,50 +67,35 @@ get_proc_path (char *buffer, size_t bufsize)
int
__get_nprocs ()
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
int result = 1;
/* XXX Here will come a test for the new system call. */
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
- /* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ /* The /proc/stat format is more uniform, use it by default. */
+ FILE *fp = fopen ("/proc/stat", "rc");
+ if (fp != NULL)
{
- char *proc_fname = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
- /* The /proc/stat format is more uniform, use it by default. */
- __stpcpy (__stpcpy (proc_fname, proc_path), "/stat");
+ result = 0;
+ while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
+ if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
+ ++result;
- fp = fopen (proc_fname, "rc");
+ fclose (fp);
+ }
+ else
+ {
+ fp = fopen ("/proc/cpuinfo", "rc");
if (fp != NULL)
{
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- result = 0;
- while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
- if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
- ++result;
-
+ GET_NPROCS_PARSER (fp, buffer, result);
fclose (fp);
}
- else
- {
- __stpcpy (__stpcpy (proc_fname, proc_path), "/cpuinfo");
-
- fp = fopen (proc_fname, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
- GET_NPROCS_PARSER (fp, buffer, result);
- fclose (fp);
- }
- }
}
return result;
@@ -193,30 +109,19 @@ weak_alias (__get_nprocs, get_nprocs)
int
__get_nprocs_conf ()
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
int result = 1;
/* XXX Here will come a test for the new system call. */
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
/* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ FILE *fp = fopen ("/proc/cpuinfo", "rc");
+ if (fp != NULL)
{
- char *proc_cpuinfo = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
- __stpcpy (__stpcpy (proc_cpuinfo, proc_path), "/cpuinfo");
-
- fp = fopen (proc_cpuinfo, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
- GET_NPROCS_CONF_PARSER (fp, buffer, result);
- fclose (fp);
- }
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+ GET_NPROCS_CONF_PARSER (fp, buffer, result);
+ fclose (fp);
}
return result;
@@ -235,40 +140,29 @@ static long int
internal_function
phys_pages_info (const char *format)
{
- FILE *fp;
char buffer[8192];
- const char *proc_path;
long int result = -1;
- /* Get mount point of proc filesystem. */
- proc_path = get_proc_path (buffer, sizeof buffer);
-
/* If we haven't found an appropriate entry return 1. */
- if (proc_path != NULL)
+ FILE *fp = fopen ("/proc/meminfo", "rc");
+ if (fp != NULL)
{
- char *proc_meminfo = alloca (strlen (proc_path) + sizeof ("/meminfo"));
- __stpcpy (__stpcpy (proc_meminfo, proc_path), "/meminfo");
-
- fp = fopen (proc_meminfo, "rc");
- if (fp != NULL)
- {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- result = 0;
- /* Read all lines and count the lines starting with the
- string "processor". We don't have to fear extremely long
- lines since the kernel will not generate them. 8192
- bytes are really enough. */
- while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
- if (sscanf (buffer, format, &result) == 1)
- {
- result /= (__getpagesize () / 1024);
- break;
- }
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+ result = 0;
+ /* Read all lines and count the lines starting with the
+ string "processor". We don't have to fear extremely long
+ lines since the kernel will not generate them. 8192
+ bytes are really enough. */
+ while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
+ if (sscanf (buffer, format, &result) == 1)
+ {
+ result /= (__getpagesize () / 1024);
+ break;
+ }
- fclose (fp);
- }
+ fclose (fp);
}
if (result == -1)
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 7db3e3eeac..9e84975635 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,5 +1,5 @@
ifeq ($(subdir),misc)
-sysdep_routines += ioperm iopl vm86
+sysdep_routines += ioperm iopl vm86 call_pselect6
sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
endif
diff --git a/sysdeps/unix/sysv/linux/i386/call_pselect6.S b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
new file mode 100644
index 0000000000..a356f1dfa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
@@ -0,0 +1,65 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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 <sysdep.h>
+
+#ifdef __NR_pselect6
+ .text
+ENTRY(__call_pselect6)
+ .hidden __call_pselect6
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ pushl %esi
+ cfi_adjust_cfa_offset (4)
+ pushl %edi
+ cfi_adjust_cfa_offset (4)
+ pushl %ebp
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebp, 0)
+ cfi_rel_offset (edi, 4)
+ cfi_rel_offset (esi, 8)
+ cfi_rel_offset (ebx, 12)
+
+ movl $__NR_pselect6, %eax
+ movl 20(%esp), %ebx
+ movl 24(%esp), %ecx
+ movl 28(%esp), %edx
+ movl 32(%esp), %esi
+ movl 36(%esp), %edi
+ movl 40(%esp), %ebp
+
+ /* The syscall handling cannot handle 6 parameters. Yet. */
+ int $0x80
+
+ popl %ebp
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebp)
+ popl %edi
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (edi)
+ popl %esi
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (esi)
+ popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+
+ ret
+END(__call_pselect6)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/pselect.c b/sysdeps/unix/sysv/linux/i386/pselect.c
new file mode 100644
index 0000000000..2646608786
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/pselect.c
@@ -0,0 +1,18 @@
+#include <sys/select.h>
+
+extern int __call_pselect6 (int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, const struct timespec *timeout,
+ void *data) attribute_hidden;
+
+
+#define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+ ({ int r = __call_pselect6 (nfds, readfds, writefds, exceptfds, timeout, \
+ data); \
+ if (r < 0 && r > -4096) \
+ { \
+ __set_errno (-r); \
+ r = -1; \
+ } \
+ r; })
+
+#include "../pselect.c"
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
index 80543976bb..8bd675e4ec 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version.
- Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
@@ -32,9 +32,4 @@
/* the __jmp_buf element type should be __float80 per ABI... */
typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
- variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
- ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
-
#endif /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index b28cb73626..837a1c14fb 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -456,3 +456,34 @@
&& defined __arch64__
# define __ASSUME_STAT64_SYSCALL 1
#endif
+
+/* Early kernel used "shm" as the filesystem name for the filesystem used
+ for shm_open etc. Later it is "tmpfs". 2.4.20 is a safe bet for the
+ cutover. */
+#if __LINUX_KERNEL_VERSION >= 0x02041a
+# define __ASSUME_TMPFS_NAME 1
+#endif
+
+/* pselect was introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __powerpc__)
+# define __ASSUME_PSELECT 1
+#endif
+
+/* ppoll was introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __powerpc__)
+# define __ASSUME_PPOLL 1
+#endif
+
+/* The *at syscalls were introduced just after 2.6.16-rc1. Due to the way the
+ kernel versions are advertised we can only rely on 2.6.17 to have
+ the code. */
+#if __LINUX_KERNEL_VERSION >= 0x020611 \
+ && (defined __i386__ || defined __x86_64__)
+# define __ASSUME_ATFCTS 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index 8ebff74215..5485b3f61c 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Make a link to FROM named TO but relative paths in TO and FROM are
@@ -33,6 +34,24 @@ linkat (fromfd, from, tofd, to)
int tofd;
const char *to;
{
+ int result;
+
+#ifdef __NR_linkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (linkat, 4, fromfd, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
static const char procfd[] = "/proc/self/fd/%d/%s";
char *buffrom = NULL;
@@ -74,7 +93,7 @@ linkat (fromfd, from, tofd, to)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (link, err, 2, from, to);
+ result = INTERNAL_SYSCALL (link, err, 2, from, to);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -84,4 +103,5 @@ linkat (fromfd, from, tofd, to)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 367441b05b..3c190085ce 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <kernel-features.h>
#include <sysdep-cancel.h>
@@ -33,6 +34,24 @@ mkdirat (fd, file, mode)
const char *file;
mode_t mode;
{
+ int res;
+
+#ifdef __NR_mkdirat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && res == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -54,7 +73,7 @@ mkdirat (fd, file, mode)
}
INTERNAL_SYSCALL_DECL (err);
- int res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
+ res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
{
@@ -63,4 +82,5 @@ mkdirat (fd, file, mode)
}
return res;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index d5d976cbc4..67e9df2e45 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -23,36 +23,54 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <kernel-features.h>
#include <sysdep-cancel.h>
-#ifndef OPENAT
+#if !defined OPENAT && !defined __ASSUME_ATFCTS
# define OPENAT openat
-# define MORE_OFLAGS 0
void
attribute_hidden
__atfct_seterrno (int errval, int fd, const char *buf)
{
- if (buf != NULL && errval == ENOTDIR)
+ if (buf != NULL)
{
- /* This can mean either the file descriptor is invalid or
- /proc is not mounted. */
struct stat64 st;
- if (__fxstat64 (_STAT_VER, fd, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
- errval = ENOSYS;
+
+ if (errval == ENOTDIR)
+ {
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+ else if (errval == ENOENT)
+ {
+ /* This could mean the file descriptor is not valid. We
+ reuse BUF for the stat call. Find the slash after the
+ file descriptor number. */
+ *(char *) strchr (buf + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ errval = EBADF;
+ }
}
__set_errno (errval);
}
+
+int __have_atfcts;
#endif
/* Open FILE with access OFLAG. Interpret relative paths relative to
@@ -64,6 +82,49 @@ OPENAT (fd, file, oflag)
const char *file;
int oflag;
{
+ mode_t mode = 0;
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
+ }
+
+ /* We have to add the O_LARGEFILE flag for openat64. */
+#ifdef MORE_OFLAGS
+ oflag |= MORE_OFLAGS;
+#endif
+
+ INTERNAL_SYSCALL_DECL (err);
+ int res;
+
+#ifdef __NR_openat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ if (SINGLE_THREAD_P)
+ res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -84,25 +145,13 @@ OPENAT (fd, file, oflag)
file = buf;
}
- mode_t mode = 0;
- if (oflag & O_CREAT)
- {
- va_list arg;
- va_start (arg, oflag);
- mode = va_arg (arg, mode_t);
- va_end (arg);
- }
-
- INTERNAL_SYSCALL_DECL (err);
- int res;
-
if (SINGLE_THREAD_P)
- res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
else
{
int oldtype = LIBC_CANCEL_ASYNC ();
- res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
LIBC_CANCEL_RESET (oldtype);
}
@@ -114,4 +163,5 @@ OPENAT (fd, file, oflag)
}
return res;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/Implies b/sysdeps/unix/sysv/linux/powerpc/Implies
new file mode 100644
index 0000000000..ff27cdb568
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Implies
@@ -0,0 +1,4 @@
+# Make sure these routines come before ldbl-opt.
+ieee754/ldbl-128ibm
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
new file mode 100644
index 0000000000..cf934234f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Determine the wordsize from the preprocessor defines. */
+
+#if defined __powerpc64__
+# define __WORDSIZE 64
+# define __WORDSIZE_COMPAT32 1
+#else
+# define __WORDSIZE 32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal the glibc ABI didn't used to have a `long double'.
+ The changes all the `long double' function variants to be redirects
+ to the double functions. */
+# define __LONG_DOUBLE_MATH_OPTIONAL 1
+# ifndef __LONG_DOUBLE_128__
+# define __NO_LONG_DOUBLE_MATH 1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure
new file mode 100644
index 0000000000..070bf5caeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure
@@ -0,0 +1,135 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128ibm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mlong_double_128ibm=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128ibm=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128ibm" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128ibm" >&6
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+ echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... $ECHO_C" >&6
+if test "${libc_cv_mabi_ibmlongdouble+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mabi_ibmlongdouble=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mabi_ibmlongdouble=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mabi_ibmlongdouble" >&5
+echo "${ECHO_T}$libc_cv_mabi_ibmlongdouble" >&6
+
+ if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+ CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+ else
+ { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 IBM extended format support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 IBM extended format support" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.in b/sysdeps/unix/sysv/linux/powerpc/configure.in
new file mode 100644
index 0000000000..1768ab1f99
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure.in
@@ -0,0 +1,37 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
+ libc_cv_mlong_double_128ibm, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mlong_double_128ibm=yes,
+ libc_cv_mlong_double_128ibm=no)
+CFLAGS="$save_CFLAGS"])
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+ AC_CACHE_CHECK(whether $CC $CFLAGS supports -mabi=ibmlongdouble,
+ libc_cv_mabi_ibmlongdouble, [dnl
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+ AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mabi_ibmlongdouble=yes,
+ libc_cv_mabi_ibmlongdouble=no)
+ CFLAGS="$save_CFLAGS"])
+
+ if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+ CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+ else
+ AC_MSG_ERROR([this configuration requires -mlong-double-128 IBM extended format support])
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+ This is used by the Versions and math_ldbl_opt.h files in
+ sysdeps/ieee754/ldbl-opt/. It gives the ABI version where
+ long double == double was replaced with proper long double
+ for libm *l functions and libc functions using long double. */
+
+#define NLDBL_VERSION GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
new file mode 100644
index 0000000000..9f70f795bc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc32 specific routines.
+powerpc/powerpc32/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
new file mode 100644
index 0000000000..6243d2ef27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc64 specific routines.
+powerpc/powerpc64/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 858b5c4757..fd67f56983 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005
+/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -303,7 +303,7 @@
# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
# else
# define PTR_MANGLE(var) \
- (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index bb9a08b3f6..d2d5972411 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 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
@@ -38,7 +38,11 @@ __BEGIN_DECLS
#ifndef __PPC64_ELF_H
#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
#define ELF_NFPREG 33 /* includes fpscr */
-#define ELF_NVRREG 33 /* includes vscr */
+#if __WORDSIZE == 32
+# define ELF_NVRREG 33 /* includes vscr */
+#else
+# define ELF_NVRREG 34 /* includes vscr */
+#endif
typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
new file mode 100644
index 0000000000..cfc86ba806
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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 <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_ppoll
+static int __generic_ppoll (struct pollfd *fds, nfds_t nfds,
+ const struct timespec *timeout,
+ const sigset_t *sigmask);
+
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
+ const sigset_t *sigmask)
+{
+ /* The Linux kernel can in some situations update the timeout value.
+ We do not want that so use a local variable. */
+ struct timespec tval;
+ if (timeout != NULL)
+ {
+ tval = *timeout;
+ timeout = &tval;
+ }
+
+ int result;
+
+ if (SINGLE_THREAD_P)
+ result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask,
+ _NSIG / 8);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_PPOLL
+ if (result == -1 && errno == ENOSYS)
+ result = __generic_ppoll (fds, nfds, timeout, sigmask);
+# endif
+
+ return result;
+}
+
+# ifndef __ASSUME_PPOLL
+# define ppoll static __generic_ppoll
+# endif
+#endif
+
+#ifndef __ASSUME_PPOLL
+# include <io/ppoll.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
new file mode 100644
index 0000000000..0dd744f527
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+ 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 <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_pselect6
+static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds,
+ const struct timespec *timeout,
+ const sigset_t *sigmask);
+
+
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ /* The Linux kernel can in some situations update the timeout value.
+ We do not want that so use a local variable. */
+ struct timespec tval;
+ if (timeout != NULL)
+ {
+ tval = *timeout;
+ timeout = &tval;
+ }
+
+ /* Note: the system call expects 7 values but on most architectures
+ we can only pass in 6 directly. If there is an architecture with
+ support for more parameters a new version of this file needs to
+ be created. */
+ struct
+ {
+ const sigset_t *ss;
+ size_t ss_len;
+ } data;
+
+ data.ss = sigmask;
+ data.ss_len = _NSIG / 8;
+
+ int result;
+
+#ifndef CALL_PSELECT6
+# define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+ INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds, \
+ timeout, data)
+#endif
+
+ if (SINGLE_THREAD_P)
+ result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+ &data);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+ &data);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+# ifndef __ASSUME_PSELECT
+ if (result == -1 && errno == ENOSYS)
+ result = __generic_pselect (nfds, readfds, writefds, exceptfds, timeout,
+ sigmask);
+# endif
+
+ return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+
+# ifndef __ASSUME_PSELECT
+# define __pselect static __generic_pselect
+# endif
+#endif
+
+#ifndef __ASSUME_PSELECT
+# include <misc/pselect.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 42c3877bd7..c2f21ee4ca 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -24,6 +24,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Read the contents of the symbolic link PATH relative to FD into no
@@ -35,6 +36,24 @@ readlinkat (fd, path, buf, len)
char *buf;
size_t len;
{
+ int result;
+
+#ifdef __NR_readlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *pathbuf = NULL;
if (fd != AT_FDCWD && path[0] != '/')
@@ -57,7 +76,7 @@ readlinkat (fd, path, buf, len)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
+ result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -66,4 +85,5 @@ readlinkat (fd, path, buf, len)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 849c67b5d6..86bb75a7b0 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -20,53 +20,87 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <kernel-features.h>
#include <sysdep.h>
+#ifndef __ASSUME_ATFCTS
void
attribute_hidden
__atfct_seterrno_2 (int errval, int fd1, const char *buf1, int fd2,
const char *buf2)
{
- if (errval == ENOTDIR && (buf1 != NULL || buf2 != NULL))
+ if (buf1 != NULL || buf2 != NULL)
{
- /* This can mean either the file descriptor is invalid or
- /proc is not mounted. */
struct stat64 st;
- if (buf1 != NULL)
+ if (errval == ENOTDIR)
{
- if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ if (buf1 != NULL)
{
- errval = ENOSYS;
- goto out;
+ if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ {
+ errval = ENOSYS;
+ goto out;
+ }
}
- }
- if (buf2 != NULL)
+ if (buf2 != NULL)
+ {
+ if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+ }
+ else if (errval == ENOENT)
{
- if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
- /* errno is already set correctly. */
- return;
-
- /* If /proc is not mounted there is nothing we can do. */
- if (S_ISDIR (st.st_mode)
- && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
- || !S_ISDIR (st.st_mode)))
- errval = ENOSYS;
+ /* This could mean the file descriptor is not valid. We
+ reuse BUF for the stat call. Find the slash after the
+ file descriptor number. */
+ if (buf1 != NULL)
+ {
+ *(char *) strchr (buf1 + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf1, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ {
+ errval = EBADF;
+ goto out;
+ }
+ }
+
+ if (buf2 != NULL)
+ {
+ *(char *) strchr (buf2 + sizeof "/proc/self/fd", '/') = '\0';
+
+ int e = __lxstat64 (_STAT_VER, buf2, &st);
+ if ((e == -1 && errno == ENOENT)
+ ||(e == 0 && !S_ISLNK (st.st_mode)))
+ errval = EBADF;
+ }
}
}
out:
__set_errno (errval);
}
+#endif
/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
@@ -77,6 +111,24 @@ renameat (oldfd, old, newfd, new)
int newfd;
const char *new;
{
+ int result;
+
+#ifdef __NR_renameat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
static const char procfd[] = "/proc/self/fd/%d/%s";
char *bufold = NULL;
@@ -118,7 +170,7 @@ renameat (oldfd, old, newfd, new)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (rename, err, 2, old, new);
+ result = INTERNAL_SYSCALL (rename, err, 2, old, new);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -128,4 +180,5 @@ renameat (oldfd, old, newfd, new)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index b41236299d..f0be37edc8 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,5 @@
/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
- 2005 Free Software Foundation, Inc.
+ 2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -376,9 +376,11 @@
is too complicated here since we have no PC-relative addressing mode. */
#else
# ifdef __ASSEMBLER__
-# define PTR_MANGLE(reg) \
- stc gbr,r1; mov.l @(POINTER_GUARD,r1),r1; xor r1,reg
-# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# define PTR_MANGLE(reg, tmp) \
+ stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
+# define PTR_MANGLE2(reg, tmp) xor tmp,reg
+# define PTR_DEMANGLE(reg, tmp) PTR_MANGLE (reg, tmp)
+# define PTR_DEMANGLE2(reg, tmp) PTR_MANGLE2 (reg, tmp)
# else
# define PTR_MANGLE(var) \
(var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 2e94b76cdb..0d40632e5f 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,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
@@ -29,6 +29,8 @@
#include <bits/libc-lock.h>
#include "linux_fsinfo.h"
+#include <kernel-features.h>
+
/* Mount point of the shared memory filesystem. */
static struct
@@ -81,7 +83,10 @@ where_is_shmfs (void)
/* The original name is "shm" but this got changed in early Linux
2.4.x to "tmpfs". */
if (strcmp (mp->mnt_type, "tmpfs") == 0
- || strcmp (mp->mnt_type, "shm") == 0)
+#ifndef __ASSUME_TMPFS_NAME
+ || strcmp (mp->mnt_type, "shm") == 0
+#endif
+ )
{
/* Found it. There might be more than one place where the
filesystem is mounted but one is enough for us. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
index 4fb7c90fd5..b44cc0fcd5 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
@@ -58,28 +58,12 @@ typedef struct __sparc64_jmp_buf
} __jmp_buf[1];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp + 2047)
-
#else
-#if defined __USE_MISC || defined _ASM
-# define JB_SP 0
-# define JB_FP 1
-# define JB_PC 2
-#endif
-
#ifndef _ASM
typedef int __jmp_buf[3];
#endif
-/* Test if longjmp to JMPBUF would unwind the frame
- containing a local variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
- ((int) (address) < demangle ((jmpbuf)[JB_SP]))
-
#endif
#endif /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
new file mode 100644
index 0000000000..2d958d29e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -0,0 +1,20 @@
+/* Determine the wordsize from the preprocessor defines. */
+
+#if defined __arch64__ || defined __sparcv9
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+# if __WORDSIZE == 32
+/* Signal that in 32bit ABI we didn't used to have a `long double'.
+ The changes all the `long double' function variants to be redirects
+ to the double functions. */
+# define __LONG_DOUBLE_MATH_OPTIONAL 1
+# ifndef __LONG_DOUBLE_128__
+# define __NO_LONG_DOUBLE_MATH 1
+# endif
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+ This is used by the Versions and math_ldbl_opt.h files in
+ sysdeps/ieee754/ldbl-opt/. It gives the ABI version where
+ long double == double was replaced with proper long double
+ for libm *l functions and libc functions using long double. */
+
+#define NLDBL_VERSION GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index 211b49c299..4cfc924bfc 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -24,6 +24,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Make a symbolic link to FROM named TO relative to TOFD. */
@@ -33,6 +34,24 @@ symlinkat (from, tofd, to)
int tofd;
const char *to;
{
+ int result;
+
+#ifdef __NR_symlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (symlinkat, 3, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (tofd != AT_FDCWD && to[0] != '/')
@@ -55,7 +74,7 @@ symlinkat (from, tofd, to)
INTERNAL_SYSCALL_DECL (err);
- int result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
+ result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
{
@@ -64,4 +83,5 @@ symlinkat (from, tofd, to)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 821029f5e5..0a07a8a875 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -1,5 +1,5 @@
/* unlinkat -- Remove a link by relative name.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -25,6 +25,7 @@
#include <string.h>
#include <sysdep.h>
#include <unistd.h>
+#include <kernel-features.h>
/* Remove the link named NAME. */
@@ -34,6 +35,24 @@ unlinkat (fd, file, flag)
const char *file;
int flag;
{
+ int result;
+
+#ifdef __NR_unlinkat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INLINE_SYSCALL (unlinkat, 3, fd, file, flag);
+# ifndef __ASSUME_ATFCTS
+ if (result == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return result;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
if (flag & ~AT_REMOVEDIR)
{
__set_errno (EINVAL);
@@ -60,7 +79,6 @@ unlinkat (fd, file, flag)
file = buf;
}
- int result;
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_REMOVEDIR)
@@ -75,4 +93,5 @@ unlinkat (fd, file, flag)
}
return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index faa028cf26..0c37495575 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -28,15 +28,40 @@
#include <sys/stat.h>
#include <sysdep.h>
+#include <kernel-features.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+
/* Get information about the file NAME relative to FD in ST. */
int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
- if ((vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
- || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ if (vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ int res;
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ res = INLINE_SYSCALL (newfstatat, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+ if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
{
__set_errno (EINVAL);
return -1;
@@ -63,7 +88,6 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
}
INTERNAL_SYSCALL_DECL (err);
- int res;
if (flag & AT_SYMLINK_NOFOLLOW)
res = INTERNAL_SYSCALL (lstat, err, 2, file, CHECK_1 (st));
@@ -77,6 +101,8 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
}
return res;
+#endif
}
#undef __fxstatat64
strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
index 08d4c52b2f..c0d5fe72d4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
@@ -70,6 +70,14 @@ struct _fpstate
__uint32_t padding[56];
};
+#ifndef sigcontext_struct
+/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
+ we need sigcontext. Some packages have come to rely on
+ sigcontext_struct being defined on 32-bit x86, so define this for
+ their benefit. */
+# define sigcontext_struct sigcontext
+#endif
+
struct sigcontext
{
unsigned short gs, __gsh;
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index 9332ae683e..ef27b686cc 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -25,9 +25,11 @@
#include <sys/sysmacros.h>
#include <sysdep.h>
+#include <kernel-features.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+
/* Create a device file named PATH relative to FD, with permission and
special bits MODE and device number DEV (which can be constructed
from major and minor device numbers with the `makedev' macro above). */
@@ -40,6 +42,31 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
return -1;
}
+ /* We must convert the value to dev_t type used by the kernel. */
+ unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1);
+ if (k_dev != *dev)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+#ifdef __NR_mknodat
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ int res = INLINE_SYSCALL (mknodat, 4, fd, file, mode,
+ (unsigned int) k_dev);
+# ifndef __ASSUME_ATFCTS
+ if (res == -1 && errno == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ return res;
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
char *buf = NULL;
if (fd != AT_FDCWD && file[0] != '/')
@@ -60,16 +87,9 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
file = buf;
}
- /* We must convert the value to dev_t type used by the kernel. */
- unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1);
- if (k_dev != *dev)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
return INLINE_SYSCALL (mknod, 3, CHECK_STRING (file), mode,
(unsigned int) k_dev);
+#endif
}
libc_hidden_def (__xmknodat)