diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-05-14 14:11:02 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-05-14 14:11:02 +0000 |
commit | ffb7875d03e224584fd1e3dc8bb6e90c79ed606e (patch) | |
tree | 7735bbae8f840773afe241281ae1184cd956acc8 /sysdeps | |
parent | 1bfb72913bf82781ae232d056991362b2b071800 (diff) | |
download | glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.tar glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.tar.gz glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.tar.bz2 glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.zip |
Remove pre-2.2 Linux kernel support.
Diffstat (limited to 'sysdeps')
38 files changed, 191 insertions, 1433 deletions
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index d571d0b62b..8235068a18 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -284,11 +284,11 @@ test -n "$arch_minimum_kernel" || case "$machine" in i386*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; powerpc/powerpc32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; powerpc/powerpc64) arch_minimum_kernel=2.4.21 @@ -311,13 +311,13 @@ case "$machine" in ;; sparc*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; x86_64*) arch_minimum_kernel=2.4.0 ;; *) - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; esac if test -n "$minimum_kernel"; then @@ -331,7 +331,7 @@ $as_echo "$as_me: WARNING: minimum kernel version reset to $arch_minimum_kernel" minimum_kernel=$arch_minimum_kernel fi else - if test $arch_minimum_kernel != '2.0.10'; then + if test $arch_minimum_kernel != '2.2.0'; then minimum_kernel=$arch_minimum_kernel fi fi diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in index 916d64a605..1ce14f294f 100644 --- a/sysdeps/unix/sysv/linux/configure.in +++ b/sysdeps/unix/sysv/linux/configure.in @@ -41,11 +41,11 @@ test -n "$arch_minimum_kernel" || case "$machine" in i386*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; powerpc/powerpc32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; powerpc/powerpc64) arch_minimum_kernel=2.4.21 @@ -68,13 +68,13 @@ case "$machine" in ;; sparc*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; x86_64*) arch_minimum_kernel=2.4.0 ;; *) - arch_minimum_kernel=2.0.10 + arch_minimum_kernel=2.2.0 ;; esac if test -n "$minimum_kernel"; then @@ -87,7 +87,7 @@ if test -n "$minimum_kernel"; then minimum_kernel=$arch_minimum_kernel fi else - if test $arch_minimum_kernel != '2.0.10'; then + if test $arch_minimum_kernel != '2.2.0'; then minimum_kernel=$arch_minimum_kernel fi fi diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c index 6e3c5e0644..8f884808c3 100644 --- a/sysdeps/unix/sysv/linux/getcwd.c +++ b/sysdeps/unix/sysv/linux/getcwd.c @@ -38,27 +38,6 @@ #endif -#if __ASSUME_GETCWD_SYSCALL > 0 -/* Kernel 2.1.92 introduced a third way to get the current working - directory: a syscall. We've got to be careful that even when - compiling under 2.1.92+ the libc still runs under older kernels. */ -# define no_syscall_getcwd 0 -# define have_new_dcache 1 -#else -# if __NR_getcwd -/* Kernel 2.1.92 introduced a third way to get the current working - directory: a syscall. We've got to be careful that even when - compiling under 2.1.92+ the libc still runs under older kernels. - An additional problem is that the system call does not return - the path of directories longer than one page. */ -static int no_syscall_getcwd; -static int have_new_dcache; -# else -# define no_syscall_getcwd 1 -static int have_new_dcache = 1; -# endif -#endif - /* The "proc" filesystem provides an easy method to retrieve the value. For each process, the corresponding directory contains a symbolic link named `cwd'. Reading the content of this link immediate gives us the @@ -73,9 +52,6 @@ __getcwd (char *buf, size_t size) int n; char *result; - if (no_syscall_getcwd && !have_new_dcache) - return generic_getcwd (buf, size); - #ifndef NO_ALLOCATION size_t alloc_size = size; if (size == 0) @@ -101,138 +77,59 @@ __getcwd (char *buf, size_t size) #endif path = buf; -#if defined __NR_getcwd || __LINUX_GETCWD_SYSCALL > 0 - if (!no_syscall_getcwd) - { - int retval; - - retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size); - if (retval >= 0) - { -# ifndef NO_ALLOCATION - if (buf == NULL && size == 0) - /* Ensure that the buffer is only as large as necessary. */ - buf = realloc (path, (size_t) retval); - - if (buf == NULL) - /* Either buf was NULL all along, or `realloc' failed but - we still have the original string. */ - buf = path; -# endif - - return buf; - } - - /* The system call cannot handle paths longer than a page. - Neither can the magic symlink in /proc/self. Just use the - generic implementation right away. */ - if (errno == ENAMETOOLONG) - { -# ifndef NO_ALLOCATION - if (buf == NULL && size == 0) - { - free (path); - path = NULL; - } -# endif - - result = generic_getcwd (path, size); - -# ifndef NO_ALLOCATION - if (result == NULL && buf == NULL && size != 0) - free (path); -# endif - - return result; - } + int retval; -# if __ASSUME_GETCWD_SYSCALL - /* It should never happen that the `getcwd' syscall failed because - the buffer is too small if we allocated the buffer ourselves - large enough. */ - assert (errno != ERANGE || buf != NULL || size != 0); + retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size); + if (retval >= 0) + { +#ifndef NO_ALLOCATION + if (buf == NULL && size == 0) + /* Ensure that the buffer is only as large as necessary. */ + buf = realloc (path, (size_t) retval); -# ifndef NO_ALLOCATION if (buf == NULL) - free (path); -# endif + /* Either buf was NULL all along, or `realloc' failed but + we still have the original string. */ + buf = path; +#endif - return NULL; -# else - if (errno == ENOSYS) - { - no_syscall_getcwd = 1; - have_new_dcache = 1; /* Now we will try the /proc method. */ - } - else if (errno != ERANGE || buf != NULL) - { -# ifndef NO_ALLOCATION - if (buf == NULL) - free (path); -# endif - return NULL; - } -# endif + return buf; } -#endif - n = __readlink ("/proc/self/cwd", path, alloc_size - 1); - if (n != -1) + /* The system call cannot handle paths longer than a page. + Neither can the magic symlink in /proc/self. Just use the + generic implementation right away. */ + if (errno == ENAMETOOLONG) { - if (path[0] == '/') - { - if ((size_t) n >= alloc_size - 1) - { #ifndef NO_ALLOCATION - if (buf == NULL) - free (path); -#endif - return NULL; - } - - path[n] = '\0'; -#ifndef NO_ALLOCATION - if (buf == NULL && size == 0) - /* Ensure that the buffer is only as large as necessary. */ - buf = realloc (path, (size_t) n + 1); - if (buf == NULL) - /* Either buf was NULL all along, or `realloc' failed but - we still have the original string. */ - buf = path; -#endif - - return buf; + if (buf == NULL && size == 0) + { + free (path); + path = NULL; } -#ifndef have_new_dcache - else - have_new_dcache = 0; #endif - } -#if __ASSUME_GETCWD_SYSCALL == 0 - /* Set to have_new_dcache only if error indicates that proc doesn't - exist. */ - if (errno != EACCES && errno != ENAMETOOLONG) - have_new_dcache = 0; -#endif + result = generic_getcwd (path, size); #ifndef NO_ALLOCATION - /* Don't put restrictions on the length of the path unless the user does. */ - if (buf == NULL && size == 0) - { - free (path); - path = NULL; - } + if (result == NULL && buf == NULL && size != 0) + free (path); #endif - result = generic_getcwd (path, size); + return result; + } + + /* It should never happen that the `getcwd' syscall failed because + the buffer is too small if we allocated the buffer ourselves + large enough. */ + assert (errno != ERANGE || buf != NULL || size != 0); #ifndef NO_ALLOCATION - if (result == NULL && buf == NULL && size != 0) + if (buf == NULL) free (path); #endif - return result; + return NULL; } weak_alias (__getcwd, getcwd) diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c index b87605f602..c8e53e4e00 100644 --- a/sysdeps/unix/sysv/linux/i386/chown.c +++ b/sysdeps/unix/sysv/linux/i386/chown.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1998,1999,2000,2002,2003,2004,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1998-2012 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 @@ -42,64 +41,22 @@ extern int __chown_is_lchown (const char *__file, uid_t __owner, extern int __real_chown (const char *__file, uid_t __owner, gid_t __group); -#if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0 -/* Running under Linux > 2.1.80. */ - -# ifdef __NR_chown32 +#ifdef __NR_chown32 # if __ASSUME_32BITUIDS == 0 /* This variable is shared with all files that need to check for 32bit uids. */ extern int __libc_missing_32bit_uids; -# endif -# endif /* __NR_chown32 */ +# endif +#endif /* __NR_chown32 */ int __real_chown (const char *file, uid_t owner, gid_t group) { -# if __ASSUME_LCHOWN_SYSCALL == 0 - static int __libc_old_chown; - int result; - - if (!__libc_old_chown) - { - int saved_errno = errno; -# ifdef __NR_chown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_chown32 */ - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); - - if (result >= 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_old_chown = 1; - } - - return __lchown (file, owner, group); -# elif __ASSUME_32BITUIDS - /* This implies __ASSUME_LCHOWN_SYSCALL. */ +#if __ASSUME_32BITUIDS return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); -# else - /* !__ASSUME_32BITUIDS && ASSUME_LCHOWN_SYSCALL */ -# ifdef __NR_chown32 +#else + /* !__ASSUME_32BITUIDS */ +# ifdef __NR_chown32 if (__libc_missing_32bit_uids <= 0) { int result; @@ -112,7 +69,7 @@ __real_chown (const char *file, uid_t owner, gid_t group) __set_errno (saved_errno); __libc_missing_32bit_uids = 1; } -# endif /* __NR_chown32 */ +# endif /* __NR_chown32 */ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) { @@ -121,19 +78,11 @@ __real_chown (const char *file, uid_t owner, gid_t group) } return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); -# endif -} #endif +} -#if !defined __NR_lchown && __ASSUME_LCHOWN_SYSCALL == 0 -/* Compiling under older kernels. */ -int -__chown_is_lchown (const char *file, uid_t owner, gid_t group) -{ - return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); -} -#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) /* Compiling for compatibiity. */ int attribute_compat_text_section @@ -147,12 +96,6 @@ __chown_is_lchown (const char *file, uid_t owner, gid_t group) compat_symbol (libc, __chown_is_lchown, chown, GLIBC_2_0); #endif -#ifdef __NR_lchown versioned_symbol (libc, __real_chown, chown, GLIBC_2_1); strong_alias (__real_chown, __chown) -#else -strong_alias (__chown_is_lchown, __chown_is_lchown21) -versioned_symbol (libc, __chown_is_lchown21, chown, GLIBC_2_1); -strong_alias (__chown_is_lchown, __chown) -#endif libc_hidden_def (__chown) diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c index 573a9b33c8..6b748d16ba 100644 --- a/sysdeps/unix/sysv/linux/i386/fchownat.c +++ b/sysdeps/unix/sysv/linux/i386/fchownat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005-2012 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 @@ -84,7 +84,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag) } # if __ASSUME_32BITUIDS > 0 - /* This implies __ASSUME_LCHOWN_SYSCALL. */ INTERNAL_SYSCALL_DECL (err); if (flag & AT_SYMLINK_NOFOLLOW) diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 6424c7c24b..df5c235e5a 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/i386. - Copyright (C) 1991,1995-2000,2002-2005,2006 Free Software Foundation, Inc. + Copyright (C) 1991-2012 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 @@ -37,12 +37,6 @@ #define SA_RESTORER 0x04000000 -#if __ASSUME_REALTIME_SIGNALS == 0 -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. */ -int __libc_missing_rt_sigs; -#endif - /* Using the hidden attribute here does not change the code but it helps to avoid warnings. */ #ifdef __NR_rt_sigaction @@ -56,92 +50,39 @@ extern void restore (void) asm ("__restore") attribute_hidden; int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { -#if __ASSUME_REALTIME_SIGNALS == 0 - struct old_kernel_sigaction k_newact, k_oldact; -#endif int result; -#ifdef __NR_rt_sigaction + struct kernel_sigaction kact, koact; - /* First try the RT signals. */ -# if __ASSUME_REALTIME_SIGNALS == 0 - if (!__libc_missing_rt_sigs) -# endif + if (act) { - struct kernel_sigaction kact, koact; -# if __ASSUME_REALTIME_SIGNALS == 0 - int saved_errno = errno; -# endif + kact.k_sa_handler = act->sa_handler; + kact.sa_flags = act->sa_flags; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - if (act) + if (GLRO(dl_sysinfo_dso) == NULL) { - kact.k_sa_handler = act->sa_handler; - kact.sa_flags = act->sa_flags; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + kact.sa_flags |= SA_RESTORER; - if (GLRO(dl_sysinfo_dso) == NULL) - { - kact.sa_flags |= SA_RESTORER; - - kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) - ? &restore_rt : &restore); - } - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = INLINE_SYSCALL (rt_sigaction, 4, - sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); - -# if __ASSUME_REALTIME_SIGNALS == 0 - if (result >= 0 || errno != ENOSYS) -# endif - { - if (oact && result >= 0) - { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); - oact->sa_flags = koact.sa_flags; - oact->sa_restorer = koact.sa_restorer; - } - return result; + kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) + ? &restore_rt : &restore); } - -# if __ASSUME_REALTIME_SIGNALS == 0 - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; -# endif - } -#endif - -#if __ASSUME_REALTIME_SIGNALS == 0 - if (act) - { - k_newact.k_sa_handler = act->sa_handler; - k_newact.sa_mask = act->sa_mask.__val[0]; - k_newact.sa_flags = act->sa_flags | SA_RESTORER; - - k_newact.sa_restorer = &restore; } - result = INLINE_SYSCALL (sigaction, 3, sig, - act ? __ptrvalue (&k_newact) : 0, - oact ? __ptrvalue (&k_oldact) : 0); - - if (result < 0) - return -1; + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = INLINE_SYSCALL (rt_sigaction, 4, + sig, act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); - if (oact) + if (oact && result >= 0) { - oact->sa_handler = k_oldact.k_sa_handler; - oact->sa_mask.__val[0] = k_oldact.sa_mask; - oact->sa_flags = k_oldact.sa_flags; - oact->sa_restorer = k_oldact.sa_restorer; + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + oact->sa_flags = koact.sa_flags; + oact->sa_restorer = koact.sa_restorer; } - - return 0; -#endif + return result; } libc_hidden_def (__libc_sigaction) diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 8d9b4871ec..3c86bb8654 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2007 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 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 @@ -32,14 +31,6 @@ #include "netlinkaccess.h" -/* Variable to signal whether SIOCGIFCONF is not available. */ -# if __ASSUME_SIOCGIFNAME == 0 -static int old_siocgifconf; -#else -# define old_siocgifconf 0 -#endif - - unsigned int if_nametoindex (const char *ifname) { @@ -101,38 +92,20 @@ if_nameindex_ioctl (void) /* We may be able to get the needed buffer size directly, rather than guessing. */ - if (! old_siocgifconf) - { - ifc.ifc_buf = NULL; - ifc.ifc_len = 0; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - old_siocgifconf = 1; -# endif - rq_len = RQ_IFS * sizeof (struct ifreq); - } - else - rq_len = ifc.ifc_len; - } - else + ifc.ifc_buf = NULL; + ifc.ifc_len = 0; + if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) rq_len = RQ_IFS * sizeof (struct ifreq); + else + rq_len = ifc.ifc_len; /* Read all the interfaces out of the kernel. */ ifc.ifc_buf = alloca (rq_len); ifc.ifc_len = rq_len; - while (1) + if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0) { - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0) - { - close_not_cancel_no_status (fd); - return NULL; - } - if (ifc.ifc_len < rq_len || ! old_siocgifconf) - break; - - ifc.ifc_buf = extend_alloca (ifc.ifc_buf, rq_len, 2 * rq_len); - ifc.ifc_len = rq_len; + close_not_cancel_no_status (fd); + return NULL; } nifs = ifc.ifc_len / sizeof (struct ifreq); @@ -314,161 +287,31 @@ libc_hidden_def (if_nameindex) char * if_indextoname (unsigned int ifindex, char *ifname) { -#if !defined SIOCGIFINDEX && __ASSUME_SIOCGIFNAME == 0 - __set_errno (ENOSYS); - return NULL; -#else -# if __ASSUME_SIOCGIFNAME == 0 - struct if_nameindex *idx; - struct if_nameindex *p; - char *result = NULL; -# endif - -# if defined SIOCGIFNAME || __ASSUME_SIOCGIFNAME > 0 /* We may be able to do the conversion directly, rather than searching a list. This ioctl is not present in kernels before version 2.1.50. */ struct ifreq ifr; int fd; -# if __ASSUME_SIOCGIFNAME == 0 - static int siocgifname_works_not; - - if (!siocgifname_works_not) -# endif - { -# if __ASSUME_SIOCGIFNAME == 0 - int serrno = errno; -# endif - int status; - - fd = __opensock (); - - if (fd < 0) - return NULL; - - ifr.ifr_ifindex = ifindex; - status = __ioctl (fd, SIOCGIFNAME, &ifr); - - close_not_cancel_no_status (fd); + int status; - if (status < 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - if (errno == EINVAL) - siocgifname_works_not = 1; /* Don't make the same mistake twice. */ - else -# endif - { - if (errno == ENODEV) - /* POSIX requires ENXIO. */ - __set_errno (ENXIO); + fd = __opensock (); - return NULL; - } - } - else - return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); + if (fd < 0) + return NULL; -# if __ASSUME_SIOCGIFNAME == 0 - __set_errno (serrno); -# endif - } -# endif + ifr.ifr_ifindex = ifindex; + status = __ioctl (fd, SIOCGIFNAME, &ifr); -# if __ASSUME_SIOCGIFNAME == 0 - idx = if_nameindex (); + close_not_cancel_no_status (fd); - if (idx != NULL) + if (status < 0) { - for (p = idx; p->if_index || p->if_name; ++p) - if (p->if_index == ifindex) - { - result = strncpy (ifname, p->if_name, IFNAMSIZ); - break; - } - - if_freenameindex (idx); - - if (result == NULL) + if (errno == ENODEV) + /* POSIX requires ENXIO. */ __set_errno (ENXIO); - } - return result; -# endif -#endif -} -libc_hidden_def (if_indextoname) - - -#if 0 -void -internal_function -__protocol_available (int *have_inet, int *have_inet6) -{ - int fd = __opensock (); - unsigned int nifs; - int rq_len; - struct ifconf ifc; -# define RQ_IFS 4 - /* Wirst case assumption. */ - *have_inet = 0; - *have_inet6 = 0; - - if (fd < 0) - /* We cannot open the socket. No networking at all? */ - return; - - /* We may be able to get the needed buffer size directly, rather than - guessing. */ - if (! old_siocgifconf) - { - ifc.ifc_buf = NULL; - ifc.ifc_len = 0; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - old_siocgifconf = 1; -# endif - rq_len = RQ_IFS * sizeof (struct ifreq); - } - else - rq_len = ifc.ifc_len; + return NULL; } else - rq_len = RQ_IFS * sizeof (struct ifreq); - - /* Read all the interfaces out of the kernel. */ - do - { - ifc.ifc_buf = alloca (ifc.ifc_len = rq_len); - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0) - { - close_not_cancel_no_status (fd); - return; - } - rq_len *= 2; - } - while (ifc.ifc_len == rq_len && old_siocgifconf); - - nifs = ifc.ifc_len / sizeof (struct ifreq); - - /* Go through all the interfaces and get the address. */ - while (nifs-- > 0) - if (__ioctl (fd, SIOCGIFADDR, &ifc.ifc_req[nifs]) >= 0) - { - /* We successfully got information about this interface. Now - test whether it is an IPv4 or IPv6 address. */ - if (ifc.ifc_req[nifs].ifr_addr.sa_family == AF_INET) - *have_inet = 1; - else if (ifc.ifc_req[nifs].ifr_addr.sa_family == AF_INET6) - *have_inet6 = 1; - - /* Note, this is & not &&. It works since the values are always - 0 or 1. */ - if (*have_inet & *have_inet6) - /* We can stop early. */ - break; - } - - close_not_cancel_no_status (fd); + return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); } -#endif +libc_hidden_def (if_indextoname) diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c index bd0d17e5d5..551af725b0 100644 --- a/sysdeps/unix/sysv/linux/ifreq.c +++ b/sysdeps/unix/sysv/linux/ifreq.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999,2002,2003,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -19,13 +19,6 @@ #include "ifreq.h" #include <kernel-features.h> -/* Variable to signal whether SIOCGIFCONF is not available. */ -#if __ASSUME_SIOCGIFNAME == 0 || 1 -static int old_siocgifconf; -#else -# define old_siocgifconf 0 -#endif - void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) @@ -49,45 +42,27 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) /* We may be able to get the needed buffer size directly, rather than guessing. */ - if (! old_siocgifconf) - { - ifc.ifc_buf = NULL; - ifc.ifc_len = 0; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - old_siocgifconf = 1; -# endif - rq_len = RQ_IFS * sizeof (struct ifreq); - } - else - rq_len = ifc.ifc_len; - } - else + ifc.ifc_buf = NULL; + ifc.ifc_len = 0; + if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) rq_len = RQ_IFS * sizeof (struct ifreq); + else + rq_len = ifc.ifc_len; /* Read all the interfaces out of the kernel. */ - while (1) + ifc.ifc_len = rq_len; + void *newp = realloc (ifc.ifc_buf, ifc.ifc_len); + if (newp == NULL + || (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0) { - ifc.ifc_len = rq_len; - void *newp = realloc (ifc.ifc_buf, ifc.ifc_len); - if (newp == NULL - || (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0) - { - free (ifc.ifc_buf); + free (ifc.ifc_buf); - if (fd != sockfd) - __close (fd); + if (fd != sockfd) + __close (fd); - *num_ifs = 0; - *ifreqs = NULL; - return; - } - - if (!old_siocgifconf || ifc.ifc_len < rq_len) - break; - - rq_len *= 2; + *num_ifs = 0; + *ifreqs = NULL; + return; } nifs = ifc.ifc_len / sizeof (struct ifreq); diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index ffaae5d144..1090f8a809 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -35,60 +35,16 @@ version given by __LINUX_KERNEL_VERSION. We are not always exactly recording the correct versions in which the features were introduced. If somebody cares these values can afterwards be - corrected. Most of the numbers here are set corresponding to - 2.2.0. */ + corrected. */ -/* `getcwd' system call. */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_GETCWD_SYSCALL 1 -#endif - -/* Real-time signal became usable in 2.1.70. */ -#if __LINUX_KERNEL_VERSION >= 131398 -# define __ASSUME_REALTIME_SIGNALS 1 -#endif - -/* When were the `pread'/`pwrite' syscalls introduced? */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_PREAD_SYSCALL 1 -# define __ASSUME_PWRITE_SYSCALL 1 -#endif - -/* When was `poll' introduced? */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_POLL_SYSCALL 1 -#endif - -/* The `lchown' syscall was introduced in 2.1.80. */ -#if __LINUX_KERNEL_VERSION >= 131408 -# define __ASSUME_LCHOWN_SYSCALL 1 -#endif - -/* When did the `setresuid' syscall became available? */ -#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__ +/* When did the `setresuid' syscall became available? By 2.2.0 except + on SPARC. */ +#if !defined __sparc__ # define __ASSUME_SETRESUID_SYSCALL 1 #endif -/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */ -#if __LINUX_KERNEL_VERSION >= 131408 -# define __ASSUME_SIOCGIFNAME 1 -#endif - -/* MSG_NOSIGNAL was at least available with Linux 2.2.0. */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_MSG_NOSIGNAL 1 -#endif - /* The sendfile syscall was introduced in 2.2.0. */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_SENDFILE 1 -#endif - -/* Only very old kernels had no real symlinks for terminal descriptors - in /proc/self/fd. */ -#if __LINUX_KERNEL_VERSION >= 131584 -# define __ASSUME_PROC_SELF_FD_SYMLINK 1 -#endif +#define __ASSUME_SENDFILE 1 /* On x86 another `getrlimit' syscall was added in 2.3.25. */ #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c index c8f5e6deb1..0abdad0399 100644 --- a/sysdeps/unix/sysv/linux/poll.c +++ b/sysdeps/unix/sysv/linux/poll.c @@ -1,6 +1,5 @@ -/* Poll system call, with emulation if it is not available. - Copyright (C) 1997,1998,1999,2000,2001,2002,2006 - Free Software Foundation, Inc. +/* Poll system call. + Copyright (C) 1997-2012 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 @@ -26,58 +25,12 @@ #include <kernel-features.h> -#if defined __NR_poll || __ASSUME_POLL_SYSCALL > 0 - -# if __ASSUME_POLL_SYSCALL == 0 -static int __emulate_poll (struct pollfd *fds, nfds_t nfds, - int timeout) internal_function; -# endif - - -# if __ASSUME_POLL_SYSCALL == 0 -/* For loser kernels. */ -static int -loser_poll (struct pollfd *fds, nfds_t nfds, int timeout) -{ - static int must_emulate; - - if (!must_emulate) - { - int errno_saved = errno; - int retval = INLINE_SYSCALL (poll, 3, CHECK_N (fds, nfds), nfds, - timeout); - - if (retval >= 0 || errno != ENOSYS) - return retval; - - __set_errno (errno_saved); - must_emulate = 1; - } - - return __emulate_poll (fds, nfds, timeout); -} -# endif - - -/* The real implementation. */ int __poll (fds, nfds, timeout) struct pollfd *fds; nfds_t nfds; int timeout; { -# if __ASSUME_POLL_SYSCALL == 0 - if (SINGLE_THREAD_P) - return loser_poll (CHECK_N (fds, nfds), nfds, timeout); - - int oldtype = LIBC_CANCEL_ASYNC (); - - int result = loser_poll (CHECK_N (fds, nfds), nfds, timeout); - - LIBC_CANCEL_RESET (oldtype); - - return result; -# else if (SINGLE_THREAD_P) return INLINE_SYSCALL (poll, 3, CHECK_N (fds, nfds), nfds, timeout); @@ -88,17 +41,7 @@ __poll (fds, nfds, timeout) LIBC_CANCEL_RESET (oldtype); return result; -# endif } libc_hidden_def (__poll) weak_alias (__poll, poll) strong_alias (__poll, __libc_poll) - -/* Get the emulation code. */ -# define __poll(fds, nfds, timeout) \ - static internal_function __emulate_poll (fds, nfds, timeout) -#endif - -#if __ASSUME_POLL_SYSCALL == 0 -# include <sysdeps/unix/bsd/poll.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/chown.c b/sysdeps/unix/sysv/linux/powerpc/chown.c index 33bb4921c6..be6a828f9b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/chown.c +++ b/sysdeps/unix/sysv/linux/powerpc/chown.c @@ -1,5 +1,5 @@ /* chown() compatibility. - Copyright (C) 1998, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1998-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,95 +35,7 @@ int __chown (const char *file, uid_t owner, gid_t group) { -#if __ASSUME_LCHOWN_SYSCALL return INLINE_SYSCALL (chown, 3, file, owner, group); -#else - int err; - int old_errno; - char link[PATH_MAX + 2]; - char path[2 * PATH_MAX + 4]; - int loopct; - size_t filelen; - static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */; - - if (libc_old_chown == 1) - return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group); - - old_errno = errno; - -# ifdef __NR_lchown - if (libc_old_chown == 0) - { - err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group); - if (err != -1 || errno != ENOSYS) - { - libc_old_chown = 1; - return err; - } - libc_old_chown = -1; - } -# endif - - err = __readlink (file, link, PATH_MAX + 1); - if (err == -1) - { - __set_errno (old_errno); - return __lchown (file, owner, group); - } - - filelen = strlen (file) + 1; - if (filelen > sizeof (path)) - { - __set_errno (ENAMETOOLONG); - return -1; - } - memcpy (path, file, filelen); - - /* 'The system has an arbitrary limit...' In practise, we'll hit - ENAMETOOLONG before this, usually. */ - for (loopct = 0; loopct < 128; ++loopct) - { - size_t linklen; - - if (err >= PATH_MAX + 1) - { - __set_errno (ENAMETOOLONG); - return -1; - } - - link[err] = 0; /* Null-terminate string, just-in-case. */ - - linklen = strlen (link) + 1; - - if (link[0] == '/') - memcpy (path, link, linklen); - else - { - filelen = strlen (path); - - while (filelen > 1 && path[filelen - 1] == '/') - --filelen; - while (filelen > 0 && path[filelen - 1] != '/') - --filelen; - if (filelen + linklen > sizeof (path)) - { - errno = ENAMETOOLONG; - return -1; - } - memcpy (path + filelen, link, linklen); - } - - err = __readlink (path, link, PATH_MAX + 1); - - if (err == -1) - { - __set_errno (old_errno); - return __lchown (path, owner, group); - } - } - __set_errno (ELOOP); - return -1; -#endif } libc_hidden_def (__chown) diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c index 16aacb36f7..b92e35a9e7 100644 --- a/sysdeps/unix/sysv/linux/powerpc/fchownat.c +++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005-2012 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 @@ -86,7 +86,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag) file = buf; } -# if __ASSUME_LCHOWN_SYSCALL INTERNAL_SYSCALL_DECL (err); if (flag & AT_SYMLINK_NOFOLLOW) @@ -99,15 +98,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag) __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf); return -1; } -# else - /* Don't inline the rest to avoid unnecessary code duplication. */ - if (flag & AT_SYMLINK_NOFOLLOW) - result = __lchown (file, owner, group); - else - result = __chown (file, owner, group); - if (result < 0) - __atfct_seterrno (errno, fd, buf); -# endif return result; diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c index 9229aa4c7f..364834f1d0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -27,14 +26,6 @@ #include <kernel-features.h> -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread (int fd, void *buf, size_t count, - off_t offset) internal_function; -# endif - - ssize_t __libc_pread (fd, buf, count, offset) int fd; @@ -49,11 +40,6 @@ __libc_pread (fd, buf, count, offset) /* On PPC32 64bit values are aligned in odd/even register pairs. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, offset >> 31, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif return result; } @@ -63,11 +49,6 @@ __libc_pread (fd, buf, count, offset) /* On PPC32 64bit values are aligned in odd/even register pairs. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, offset >> 31, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -76,11 +57,3 @@ __libc_pread (fd, buf, count, offset) strong_alias (__libc_pread, __pread) weak_alias (__libc_pread, pread) - -# define __libc_pread(fd, buf, count, offset) \ - static internal_function __emulate_pread (fd, buf, count, offset) -#endif - -#if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c index 21c1f7b95c..5b1445ff23 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,13 +25,6 @@ #include <kernel-features.h> -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, - off64_t offset) internal_function; -# endif - ssize_t __libc_pread64 (fd, buf, count, offset) @@ -49,11 +41,6 @@ __libc_pread64 (fd, buf, count, offset) result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, (long) (offset >> 32), (long) offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif return result; } @@ -64,11 +51,6 @@ __libc_pread64 (fd, buf, count, offset) result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, (long) (offset >> 32), (long) offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -77,11 +59,3 @@ __libc_pread64 (fd, buf, count, offset) weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64) - -# define __libc_pread64(fd, buf, count, offset) \ - static internal_function __emulate_pread64 (fd, buf, count, offset) -#endif - -# if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c index bf0e3414c2..ed1878bc5e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -27,13 +26,6 @@ #include <kernel-features.h> -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, - off_t offset) internal_function; -# endif - ssize_t __libc_pwrite (fd, buf, count, offset) @@ -49,11 +41,6 @@ __libc_pwrite (fd, buf, count, offset) /* On PPC32 64bit values are aligned in odd/even register pairs. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, offset >> 31, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif return result; } @@ -63,11 +50,6 @@ __libc_pwrite (fd, buf, count, offset) /* On PPC32 64bit values are aligned in odd/even register pairs. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, offset >> 31, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -76,11 +58,3 @@ __libc_pwrite (fd, buf, count, offset) strong_alias (__libc_pwrite, __pwrite) weak_alias (__libc_pwrite, pwrite) - -# define __libc_pwrite(fd, buf, count, offset) \ - static internal_function __emulate_pwrite (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c index 0162d88395..dedeb7e97d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,13 +25,6 @@ #include <kernel-features.h> -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, - off64_t offset) internal_function; -# endif - ssize_t __libc_pwrite64 (fd, buf, count, offset) @@ -49,11 +41,6 @@ __libc_pwrite64 (fd, buf, count, offset) result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, (long) (offset >> 32), (long) offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif return result; } @@ -64,11 +51,6 @@ __libc_pwrite64 (fd, buf, count, offset) result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, (long) (offset >> 32), (long) offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -78,11 +60,3 @@ __libc_pwrite64 (fd, buf, count, offset) weak_alias (__libc_pwrite64, __pwrite64) libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64) - -# define __libc_pwrite64(fd, buf, count, offset) \ - static internal_function __emulate_pwrite64 (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c index 6b8f3ea4f1..e06de3bfe4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -27,13 +26,6 @@ #include <kernel-features.h> -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread (int fd, void *buf, size_t count, - off_t offset) internal_function; -# endif - ssize_t __libc_pread (fd, buf, count, offset) @@ -48,11 +40,6 @@ __libc_pread (fd, buf, count, offset) { result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif return result; } @@ -61,11 +48,6 @@ __libc_pread (fd, buf, count, offset) result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -74,11 +56,3 @@ __libc_pread (fd, buf, count, offset) strong_alias (__libc_pread, __pread) weak_alias (__libc_pread, pread) - -# define __libc_pread(fd, buf, count, offset) \ - static internal_function __emulate_pread (fd, buf, count, offset) -#endif - -#if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c index 0933806b07..80c2d2c8a3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,13 +25,6 @@ #include <kernel-features.h> -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, - off64_t offset) internal_function; -# endif - ssize_t __libc_pread64 (fd, buf, count, offset) @@ -47,11 +39,6 @@ __libc_pread64 (fd, buf, count, offset) { result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif return result; } @@ -60,11 +47,6 @@ __libc_pread64 (fd, buf, count, offset) result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -73,11 +55,3 @@ __libc_pread64 (fd, buf, count, offset) weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64) - -# define __libc_pread64(fd, buf, count, offset) \ - static internal_function __emulate_pread64 (fd, buf, count, offset) -#endif - -# if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c index b956b48ba0..57458b43c5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -27,13 +26,6 @@ #include <kernel-features.h> -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, - off_t offset) internal_function; -# endif - ssize_t __libc_pwrite (fd, buf, count, offset) @@ -48,11 +40,6 @@ __libc_pwrite (fd, buf, count, offset) { result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif return result; } @@ -61,11 +48,6 @@ __libc_pwrite (fd, buf, count, offset) result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -74,11 +56,3 @@ __libc_pwrite (fd, buf, count, offset) strong_alias (__libc_pwrite, __pwrite) weak_alias (__libc_pwrite, pwrite) - -# define __libc_pwrite(fd, buf, count, offset) \ - static internal_function __emulate_pwrite (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite.c> -#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c index ec9bba53cb..75344dfd26 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,13 +25,6 @@ #include <kernel-features.h> -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, - off64_t offset) internal_function; -# endif - ssize_t __libc_pwrite64 (fd, buf, count, offset) @@ -47,11 +39,6 @@ __libc_pwrite64 (fd, buf, count, offset) { result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif return result; } @@ -60,11 +47,6 @@ __libc_pwrite64 (fd, buf, count, offset) result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -74,11 +56,3 @@ __libc_pwrite64 (fd, buf, count, offset) weak_alias (__libc_pwrite64, __pwrite64) libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64) - -# define __libc_pwrite64(fd, buf, count, offset) \ - static internal_function __emulate_pwrite64 (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c index dd8c5e767e..4ea67fcb0b 100644 --- a/sysdeps/unix/sysv/linux/pread.c +++ b/sysdeps/unix/sysv/linux/pread.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,13 +34,6 @@ # define __NR_pread __NR_pread64 #endif -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread (int fd, void *buf, size_t count, - off_t offset) internal_function; -# endif - static ssize_t #ifdef NO_CANCELLATION @@ -50,15 +43,9 @@ do_pread (int fd, void *buf, size_t count, off_t offset) { ssize_t result; - /* First try the syscall. */ assert (sizeof (offset) == 4); result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif return result; } @@ -85,11 +72,3 @@ __libc_pread (fd, buf, count, offset) strong_alias (__libc_pread, __pread) weak_alias (__libc_pread, pread) - -# define __libc_pread(fd, buf, count, offset) \ - static internal_function __emulate_pread (fd, buf, count, offset) -#endif - -#if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread.c> -#endif diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c index 8d2d02bfe5..897b5674a7 100644 --- a/sysdeps/unix/sysv/linux/pread64.c +++ b/sysdeps/unix/sysv/linux/pread64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,28 +33,15 @@ # define __NR_pread __NR_pread64 #endif -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, - off64_t offset) internal_function; -# endif - static ssize_t do_pread64 (int fd, void *buf, size_t count, off64_t offset) { ssize_t result; - /* First try the syscall. */ result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif return result; } @@ -82,11 +68,3 @@ __libc_pread64 (fd, buf, count, offset) weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64) - -# define __libc_pread64(fd, buf, count, offset) \ - static internal_function __emulate_pread64 (fd, buf, count, offset) -#endif - -# if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c index fb097698fb..bf8ca864a2 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c +++ b/sysdeps/unix/sysv/linux/ptsname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1998-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. @@ -127,12 +127,6 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) } ptyno = minor (stp->st_rdev); -#if __LINUX_KERNEL_VERSION < 131443 - /* This is for the old BSD pseudo terminals. As of Linux - 2.1.115 these are no longer supported. */ - if (major (stp->st_rdev) == 4) - ptyno -= 128; -#endif if (ptyno / 16 >= strlen (__libc_ptyname1)) { diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c index 6d1ab86242..c4940fcdd0 100644 --- a/sysdeps/unix/sysv/linux/pwrite.c +++ b/sysdeps/unix/sysv/linux/pwrite.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,13 +34,6 @@ # define __NR_pwrite __NR_pwrite64 #endif -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, - off_t offset) internal_function; -# endif - static ssize_t #ifdef NO_CANCELLATION @@ -50,15 +43,9 @@ do_pwrite (int fd, const void *buf, size_t count, off_t offset) { ssize_t result; - /* First try the syscall. */ assert (sizeof (offset) == 4); result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif return result; } @@ -85,11 +72,3 @@ __libc_pwrite (fd, buf, count, offset) strong_alias (__libc_pwrite, __pwrite) weak_alias (__libc_pwrite, pwrite) - -# define __libc_pwrite(fd, buf, count, offset) \ - static internal_function __emulate_pwrite (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite.c> -#endif diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c index 5deab9d649..ad945a2903 100644 --- a/sysdeps/unix/sysv/linux/pwrite64.c +++ b/sysdeps/unix/sysv/linux/pwrite64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,28 +33,15 @@ # define __NR_pwrite __NR_pwrite64 #endif -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, - off64_t offset) internal_function; -# endif - static ssize_t do_pwrite64 (int fd, const void *buf, size_t count, off64_t offset) { ssize_t result; - /* First try the syscall. */ result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif return result; } @@ -83,11 +69,3 @@ __libc_pwrite64 (fd, buf, count, offset) weak_alias (__libc_pwrite64, __pwrite64) libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64) - -# define __libc_pwrite64(fd, buf, count, offset) \ - static internal_function __emulate_pwrite64 (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/sysdeps/unix/sysv/linux/sh/pread.c index 30cbec63a0..3e7702f10d 100644 --- a/sysdeps/unix/sysv/linux/sh/pread.c +++ b/sysdeps/unix/sysv/linux/sh/pread.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -35,12 +34,6 @@ # define __NR_pread __NR_pread64 #endif -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread (int fd, void *buf, size_t count, - off_t offset) internal_function; -# endif ssize_t __libc_pread (fd, buf, count, offset) @@ -53,27 +46,15 @@ __libc_pread (fd, buf, count, offset) if (SINGLE_THREAD_P) { - /* First try the syscall. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif return result; } int oldtype = LIBC_CANCEL_ASYNC (); - /* First try the syscall. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -82,11 +63,3 @@ __libc_pread (fd, buf, count, offset) strong_alias (__libc_pread, __pread) weak_alias (__libc_pread, pread) - -# define __libc_pread(fd, buf, count, offset) \ - static internal_function __emulate_pread (fd, buf, count, offset) -#endif - -#if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/sysdeps/unix/sysv/linux/sh/pread64.c index 6c0bf5d2f6..523ed7f82f 100644 --- a/sysdeps/unix/sysv/linux/sh/pread64.c +++ b/sysdeps/unix/sysv/linux/sh/pread64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,12 +33,6 @@ # define __NR_pread __NR_pread64 #endif -#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 - -# if __ASSUME_PREAD_SYSCALL == 0 -static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, - off64_t offset) internal_function; -# endif ssize_t __libc_pread64 (fd, buf, count, offset) @@ -52,29 +45,17 @@ __libc_pread64 (fd, buf, count, offset) if (SINGLE_THREAD_P) { - /* First try the syscall. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif return result; } int oldtype = LIBC_CANCEL_ASYNC (); - /* First try the syscall. */ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PREAD_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pread64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -83,11 +64,3 @@ __libc_pread64 (fd, buf, count, offset) weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64) - -# define __libc_pread64(fd, buf, count, offset) \ - static internal_function __emulate_pread64 (fd, buf, count, offset) -#endif - -#if __ASSUME_PREAD_SYSCALL == 0 -# include <sysdeps/posix/pread64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c index 75e0e9850b..e8052757aa 100644 --- a/sysdeps/unix/sysv/linux/sh/pwrite.c +++ b/sysdeps/unix/sysv/linux/sh/pwrite.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -35,12 +34,6 @@ # define __NR_pwrite __NR_pwrite64 #endif -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, - off_t offset) internal_function; -# endif ssize_t __libc_pwrite (fd, buf, count, offset) @@ -53,27 +46,15 @@ __libc_pwrite (fd, buf, count, offset) if (SINGLE_THREAD_P) { - /* First try the syscall. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif return result; } int oldtype = LIBC_CANCEL_ASYNC (); - /* First try the syscall. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR (offset >> 31, offset)); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -82,11 +63,3 @@ __libc_pwrite (fd, buf, count, offset) strong_alias (__libc_pwrite, __pwrite) weak_alias (__libc_pwrite, pwrite) - -# define __libc_pwrite(fd, buf, count, offset) \ - static internal_function __emulate_pwrite (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/sysdeps/unix/sysv/linux/sh/pwrite64.c index 0fd21af12f..8f80fea495 100644 --- a/sysdeps/unix/sysv/linux/sh/pwrite64.c +++ b/sysdeps/unix/sysv/linux/sh/pwrite64.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>, 1998. @@ -34,12 +33,6 @@ # define __NR_pwrite __NR_pwrite64 #endif -#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 - -# if __ASSUME_PWRITE_SYSCALL == 0 -static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, - off64_t offset) internal_function; -# endif ssize_t __libc_pwrite64 (fd, buf, count, offset) @@ -52,30 +45,18 @@ __libc_pwrite64 (fd, buf, count, offset) if (SINGLE_THREAD_P) { - /* First try the syscall. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif return result; } int oldtype = LIBC_CANCEL_ASYNC (); - /* First try the syscall. */ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0, __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff))); -# if __ASSUME_PWRITE_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use the emulation. */ - result = __emulate_pwrite64 (fd, buf, count, offset); -# endif LIBC_CANCEL_RESET (oldtype); @@ -85,11 +66,3 @@ __libc_pwrite64 (fd, buf, count, offset) weak_alias (__libc_pwrite64, __pwrite64) libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64) - -# define __libc_pwrite64(fd, buf, count, offset) \ - static internal_function __emulate_pwrite64 (fd, buf, count, offset) -#endif - -#if __ASSUME_PWRITE_SYSCALL == 0 -# include <sysdeps/posix/pwrite64.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c index 37f7a2c149..01fb16e557 100644 --- a/sysdeps/unix/sysv/linux/sigaction.c +++ b/sysdeps/unix/sysv/linux/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2000,2002,2003,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 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,12 +29,6 @@ translate it here. */ #include <kernel_sigaction.h> -#if __ASSUME_REALTIME_SIGNALS == 0 -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. This is the definition. */ -int __libc_missing_rt_sigs; -#endif - /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -44,87 +38,36 @@ __libc_sigaction (sig, act, oact) const struct sigaction *act; struct sigaction *oact; { -#if __ASSUME_REALTIME_SIGNALS == 0 - struct old_kernel_sigaction k_sigact, k_osigact; -#endif int result; -#if defined __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0 - /* First try the RT signals. */ -# if __ASSUME_REALTIME_SIGNALS == 0 - if (!__libc_missing_rt_sigs) -# endif - { - struct kernel_sigaction kact, koact; - /* Save the current error value for later. We need not do this - if we are guaranteed to have realtime signals. */ -# if __ASSUME_REALTIME_SIGNALS == 0 - int saved_errno = errno; -# endif - - if (act) - { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - kact.sa_flags = act->sa_flags; -# ifdef HAVE_SA_RESTORER - kact.sa_restorer = act->sa_restorer; -# endif - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = INLINE_SYSCALL (rt_sigaction, 4, sig, - act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + struct kernel_sigaction kact, koact; -# if __ASSUME_REALTIME_SIGNALS == 0 - if (result >= 0 || errno != ENOSYS) -# endif - { - if (oact && result >= 0) - { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); - oact->sa_flags = koact.sa_flags; -# ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; -# endif - } - return result; - } - -# if __ASSUME_REALTIME_SIGNALS == 0 - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; -# endif - } -#endif - -#if __ASSUME_REALTIME_SIGNALS == 0 if (act) { - k_sigact.k_sa_handler = act->sa_handler; - k_sigact.sa_mask = act->sa_mask.__val[0]; - k_sigact.sa_flags = act->sa_flags; -# ifdef HAVE_SA_RESTORER - k_sigact.sa_restorer = act->sa_restorer; -# endif + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + kact.sa_flags = act->sa_flags; +#ifdef HAVE_SA_RESTORER + kact.sa_restorer = act->sa_restorer; +#endif } - result = INLINE_SYSCALL (sigaction, 3, sig, - act ? __ptrvalue (&k_sigact) : NULL, - oact ? __ptrvalue (&k_osigact) : NULL); + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = INLINE_SYSCALL (rt_sigaction, 4, sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + if (oact && result >= 0) { - oact->sa_handler = k_osigact.k_sa_handler; - oact->sa_mask.__val[0] = k_osigact.sa_mask; - oact->sa_flags = k_osigact.sa_flags; -# ifdef HAVE_SA_RESTORER - oact->sa_restorer = k_osigact.sa_restorer; -# endif + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + oact->sa_flags = koact.sa_flags; +#ifdef HAVE_SA_RESTORER + oact->sa_restorer = koact.sa_restorer; +#endif } return result; -#endif } libc_hidden_def (__libc_sigaction) diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c index 91d08db17d..7174b4ae3a 100644 --- a/sysdeps/unix/sysv/linux/sigpending.c +++ b/sysdeps/unix/sysv/linux/sigpending.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 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 @@ -27,37 +26,11 @@ #include <kernel-features.h> -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. The definition is in sigaction.c. */ -extern int __libc_missing_rt_sigs; - - /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ int sigpending (set) sigset_t *set; { -#if __ASSUME_REALTIME_SIGNALS > 0 return INLINE_SYSCALL (rt_sigpending, 2, CHECK_SIGSET (set), _NSIG / 8); -#else -# ifdef __NR_rt_sigpending - /* First try the RT signals. */ - if (!__libc_missing_rt_sigs) - { - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int saved_errno = errno; - int result = INLINE_SYSCALL (rt_sigpending, 2, CHECK_SIGSET (set), _NSIG / 8); - - if (result >= 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; - } -# endif - - return INLINE_SYSCALL (sigpending, 1, CHECK_SIGSET (set)); -#endif } diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c index 2e91660f9b..a5ac4dd501 100644 --- a/sysdeps/unix/sysv/linux/sigprocmask.c +++ b/sysdeps/unix/sysv/linux/sigprocmask.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2001,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 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 @@ -27,11 +27,6 @@ #include <kernel-features.h> -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. The definition is in sigaction.c. */ -extern int __libc_missing_rt_sigs; - - /* Get and/or change the set of blocked signals. */ int __sigprocmask (how, set, oset) @@ -60,31 +55,7 @@ __sigprocmask (how, set, oset) } #endif -#if __ASSUME_REALTIME_SIGNALS > 0 return INLINE_SYSCALL (rt_sigprocmask, 4, how, CHECK_SIGSET_NULL_OK (set), CHECK_SIGSET_NULL_OK (oset), _NSIG / 8); -#else -# ifdef __NR_rt_sigprocmask - /* First try the RT signals. */ - if (!__libc_missing_rt_sigs) - { - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int saved_errno = errno; - int result = INLINE_SYSCALL (rt_sigprocmask, 4, how, - CHECK_SIGSET_NULL_OK (set), - CHECK_SIGSET_NULL_OK (oset), _NSIG / 8); - - if (result >= 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; - } -# endif - - return INLINE_SYSCALL (sigprocmask, 3, how, CHECK_SIGSET_NULL_OK (set), - CHECK_SIGSET_NULL_OK (oset)); -#endif } weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c index 30b8b585b1..e1ee87b29f 100644 --- a/sysdeps/unix/sysv/linux/sigsuspend.c +++ b/sysdeps/unix/sysv/linux/sigsuspend.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1996-2012 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 @@ -27,41 +26,11 @@ #include <kernel-features.h> -#if !__ASSUME_REALTIME_SIGNALS -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. The definition is in sigaction.c. */ -extern int __libc_missing_rt_sigs; - - -static int -do_sigsuspend (const sigset_t *set) -{ -# ifdef __NR_rt_sigsuspend - /* First try the RT signals. */ - if (!__libc_missing_rt_sigs) - { - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int saved_errno = errno; - int result = INLINE_SYSCALL (rt_sigsuspend, 2, - CHECK_SIGSET (set), _NSIG / 8); - if (result >= 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; - } -# endif - - return INLINE_SYSCALL (sigsuspend, 3, 0, 0, set->__val[0]); -} -#else static inline int __attribute__ ((always_inline)) do_sigsuspend (const sigset_t *set) { return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8); } -#endif /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c index c3201b8a9e..7bdf5e0bdd 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c @@ -27,106 +27,40 @@ static void __rt_sigreturn_stub (void); static void __sigreturn_stub (void); -/* The variable is shared between all wrappers around signal handling - functions which have RT equivalents. */ -int __libc_missing_rt_sigs; - int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { struct old_kernel_sigaction k_sigact, k_osigact; int ret; -#ifdef __NR_rt_sigaction - /* First try the RT signals. */ - if (!__libc_missing_rt_sigs) - { - struct kernel_sigaction kact, koact; - unsigned long stub = 0; - int saved_errno = errno; - - if (act) - { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - if (((kact.sa_flags = act->sa_flags) & SA_SIGINFO) != 0) - stub = (unsigned long) &__rt_sigreturn_stub; - else - stub = (unsigned long) &__sigreturn_stub; - stub -= 8; - kact.sa_restorer = NULL; - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - ret = INLINE_SYSCALL (rt_sigaction, 5, sig, act ? &kact : 0, - oact ? &koact : 0, stub, _NSIG / 8); - - if (ret >= 0 || errno != ENOSYS) - { - if (oact && ret >= 0) - { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); - oact->sa_flags = koact.sa_flags; - oact->sa_restorer = koact.sa_restorer; - } - return ret; - } - - __set_errno (saved_errno); - __libc_missing_rt_sigs = 1; - } -#endif - - /* Magic to tell the kernel we are using "new-style" signals, in that - the signal table is not kept in userspace. Not the same as the - really-new-style rt signals. */ - sig = -sig; + struct kernel_sigaction kact, koact; + unsigned long stub = 0; if (act) { - k_sigact.k_sa_handler = act->sa_handler; - k_sigact.sa_mask = act->sa_mask.__val[0]; - k_sigact.sa_flags = act->sa_flags; - k_sigact.sa_restorer = NULL; + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + if (((kact.sa_flags = act->sa_flags) & SA_SIGINFO) != 0) + stub = (unsigned long) &__rt_sigreturn_stub; + else + stub = (unsigned long) &__sigreturn_stub; + stub -= 8; + kact.sa_restorer = NULL; } - { - register int r_syscallnr __asm__("%g1") = __NR_sigaction; - register int r_sig __asm__("%o0") = sig; - register struct old_kernel_sigaction *r_act __asm__("%o1"); - register struct old_kernel_sigaction *r_oact __asm__("%o2"); - - r_act = act ? &k_sigact : NULL; - r_oact = oact ? &k_osigact : NULL; + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + ret = INLINE_SYSCALL (rt_sigaction, 5, sig, act ? &kact : 0, + oact ? &koact : 0, stub, _NSIG / 8); - __asm__ __volatile__("t 0x10\n\t" - "bcc 1f\n\t" - " nop\n\t" - "sub %%g0,%%o0,%%o0\n" - "1:" - : "=r"(r_sig) - : "r"(r_syscallnr), "r"(r_act), "r"(r_oact), - "0"(r_sig)); - - ret = r_sig; - } - - if (ret >= 0) + if (oact && ret >= 0) { - if (oact) - { - oact->sa_handler = k_osigact.k_sa_handler; - oact->sa_mask.__val[0] = k_osigact.sa_mask; - oact->sa_flags = k_osigact.sa_flags; - oact->sa_restorer = NULL; - } - return ret; + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + oact->sa_flags = koact.sa_flags; + oact->sa_restorer = koact.sa_restorer; } - - __set_errno (-ret); - return -1; + return ret; } libc_hidden_def (__libc_sigaction) diff --git a/sysdeps/unix/sysv/linux/syslog.c b/sysdeps/unix/sysv/linux/syslog.c index 145e22b520..d01a91ad66 100644 --- a/sysdeps/unix/sysv/linux/syslog.c +++ b/sysdeps/unix/sysv/linux/syslog.c @@ -1,10 +1,6 @@ #include <kernel-features.h> -#if __ASSUME_MSG_NOSIGNAL -# define NO_SIGPIPE -# define send_flags MSG_NOSIGNAL -#else -# define send_flags 0 -#endif +#define NO_SIGPIPE +#define send_flags MSG_NOSIGNAL #include <misc/syslog.c> diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h index cab587b094..f7650ccf3e 100644 --- a/sysdeps/unix/sysv/linux/testrtsig.h +++ b/sysdeps/unix/sysv/linux/testrtsig.h @@ -1,5 +1,5 @@ /* Test whether RT signals are really available. - Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,11 +25,5 @@ static int kernel_has_rtsig (void) { -#if __ASSUME_REALTIME_SIGNALS return 1; -#else - struct utsname name; - - return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0; -#endif } diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index 0cfb4740b8..3dacd40c23 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c +++ b/sysdeps/unix/sysv/linux/ttyname.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991-1993,1996-2002,2006,2009,2010 - Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 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 @@ -155,12 +154,7 @@ ttyname (int fd) return NULL; } - if (__builtin_expect (len != -1 -#ifndef __ASSUME_PROC_SELF_FD_SYMLINK - /* This is for Linux 2.0. */ - && ttyname_buf[0] != '[' -#endif - , 1)) + if (__builtin_expect (len != -1, 1)) { if ((size_t) len >= buflen) return NULL; diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index f097311a15..2dd6781348 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c +++ b/sysdeps/unix/sysv/linux/ttyname_r.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991-1993,1995-2001,2003,2006,2010 - Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 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 @@ -141,12 +140,7 @@ __ttyname_r (int fd, char *buf, size_t buflen) return ERANGE; } - if (__builtin_expect (ret != -1 -#ifndef __ASSUME_PROC_SELF_FD_SYMLINK - /* This is for Linux 2.0. */ - && buf[0] != '[' -#endif - , 1)) + if (__builtin_expect (ret != -1, 1)) { #define UNREACHABLE_LEN strlen ("(unreachable)") if (ret > UNREACHABLE_LEN |