From 89a00bff19086cb0fe6b694dd82d485e3c732e4d Mon Sep 17 00:00:00 2001 From: joseph Date: Tue, 28 Aug 2012 14:14:43 +0000 Subject: Merge changes between r20213 and r20391 from /fsf/trunk. git-svn-id: svn://svn.eglibc.org/trunk@20392 7b3dc134-2b1b-0410-93df-9e9f96275f8d --- libc/sysdeps/unix/alarm.c | 50 ------------- libc/sysdeps/unix/inet/syscalls.list | 23 ------ libc/sysdeps/unix/mkfifo.c | 29 -------- libc/sysdeps/unix/mkfifoat.c | 31 -------- libc/sysdeps/unix/nice.c | 52 -------------- libc/sysdeps/unix/syscalls.list | 21 ++++++ libc/sysdeps/unix/sysv/linux/bits/param.h | 42 +++++++++++ libc/sysdeps/unix/sysv/linux/check_pf.c | 38 ++++++---- libc/sysdeps/unix/sysv/linux/dl-fxstatat64.c | 2 +- libc/sysdeps/unix/sysv/linux/fxstat64.c | 47 ++----------- libc/sysdeps/unix/sysv/linux/fxstatat64.c | 58 +-------------- libc/sysdeps/unix/sysv/linux/i386/fxstat.c | 41 +---------- libc/sysdeps/unix/sysv/linux/i386/fxstatat.c | 46 +----------- libc/sysdeps/unix/sysv/linux/i386/lxstat.c | 40 +---------- libc/sysdeps/unix/sysv/linux/i386/mmap.S | 23 ------ libc/sysdeps/unix/sysv/linux/i386/mmap64.S | 44 ------------ .../sysdeps/unix/sysv/linux/i386/posix_fadvise64.S | 69 +----------------- libc/sysdeps/unix/sysv/linux/i386/xstat.c | 39 +--------- libc/sysdeps/unix/sysv/linux/kernel-features.h | 61 ++-------------- libc/sysdeps/unix/sysv/linux/lxstat64.c | 47 ++----------- libc/sysdeps/unix/sysv/linux/mmap64.c | 68 +++++------------- libc/sysdeps/unix/sysv/linux/nice.c | 2 +- libc/sysdeps/unix/sysv/linux/posix_fadvise64.c | 27 +------ .../unix/sysv/linux/powerpc/powerpc32/getcontext.S | 4 -- .../sysv/linux/powerpc/powerpc32/posix_fadvise64.c | 26 +------ .../unix/sysv/linux/powerpc/powerpc32/setcontext.S | 6 +- .../sysv/linux/powerpc/powerpc32/swapcontext.S | 6 +- .../unix/sysv/linux/s390/s390-32/getrlimit.c | 1 - libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S | 15 +--- libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S | 37 +--------- .../unix/sysv/linux/s390/s390-32/posix_fadvise64.c | 27 +------ libc/sysdeps/unix/sysv/linux/sparc/sparc64/time.c | 2 +- libc/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c | 9 --- libc/sysdeps/unix/sysv/linux/sys/param.h | 82 ---------------------- libc/sysdeps/unix/sysv/linux/time.c | 4 +- libc/sysdeps/unix/sysv/linux/xstat64.c | 49 ++----------- libc/sysdeps/unix/sysv/linux/xstatconv.c | 5 +- libc/sysdeps/unix/time.c | 41 ----------- libc/sysdeps/unix/utime.c | 49 ------------- 39 files changed, 150 insertions(+), 1113 deletions(-) delete mode 100644 libc/sysdeps/unix/alarm.c delete mode 100644 libc/sysdeps/unix/inet/syscalls.list delete mode 100644 libc/sysdeps/unix/mkfifo.c delete mode 100644 libc/sysdeps/unix/mkfifoat.c delete mode 100644 libc/sysdeps/unix/nice.c create mode 100644 libc/sysdeps/unix/sysv/linux/bits/param.h delete mode 100644 libc/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c delete mode 100644 libc/sysdeps/unix/sysv/linux/sys/param.h delete mode 100644 libc/sysdeps/unix/time.c delete mode 100644 libc/sysdeps/unix/utime.c (limited to 'libc/sysdeps/unix') diff --git a/libc/sysdeps/unix/alarm.c b/libc/sysdeps/unix/alarm.c deleted file mode 100644 index 730f2c4c7..000000000 --- a/libc/sysdeps/unix/alarm.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1991,1992,1994,1997,2002,2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. - If SECONDS is zero, any currently scheduled alarm will be cancelled. - The function returns the number of seconds remaining until the last - alarm scheduled would have signaled, or zero if there wasn't one. - There is no return value to indicate an error, but you can set `errno' - to 0 and check its value after calling `alarm', and this might tell you. - The signal may come late due to processor scheduling. */ -unsigned int -alarm (seconds) - unsigned int seconds; -{ - struct itimerval old, new; - unsigned int retval; - - new.it_interval.tv_usec = 0; - new.it_interval.tv_sec = 0; - new.it_value.tv_usec = 0; - new.it_value.tv_sec = (long int) seconds; - if (__setitimer (ITIMER_REAL, &new, &old) < 0) - return 0; - - retval = old.it_value.tv_sec; - /* Round to the nearest second, but never report zero seconds when - the alarm is still set. */ - if (old.it_value.tv_usec >= 500000 - || (retval == 0 && old.it_value.tv_usec > 0)) - ++retval; - return retval; -} -libc_hidden_def (alarm) diff --git a/libc/sysdeps/unix/inet/syscalls.list b/libc/sysdeps/unix/inet/syscalls.list deleted file mode 100644 index aafafd1df..000000000 --- a/libc/sysdeps/unix/inet/syscalls.list +++ /dev/null @@ -1,23 +0,0 @@ -# File name Caller Syscall name # args Strong name Weak names - -accept - accept Ci:iBN __libc_accept accept -bind - bind i:ipi __bind bind -connect - connect Ci:ipi __libc_connect __connect connect -gethostid - gethostid i: gethostid -gethostname - gethostname i:bn __gethostname gethostname -getpeername - getpeername i:ibN __getpeername getpeername -getsockname - getsockname i:ibN __getsockname getsockname -getsockopt - getsockopt i:iiiBN getsockopt -listen - listen i:ii __listen listen -recv - recv Ci:ibni __libc_recv recv -recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom -recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg -send - send Ci:ibni __libc_send __send send -sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg -sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto -sethostid - sethostid i:i sethostid -sethostname - sethostname i:pi sethostname -setsockopt - setsockopt i:iiibn setsockopt __setsockopt -shutdown - shutdown i:ii shutdown -socket - socket i:iii __socket socket -socketpair - socketpair i:iiif socketpair diff --git a/libc/sysdeps/unix/mkfifo.c b/libc/sysdeps/unix/mkfifo.c deleted file mode 100644 index 70329bd12..000000000 --- a/libc/sysdeps/unix/mkfifo.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - -/* Create a named pipe (FIFO) named PATH with protections MODE. */ -int -mkfifo (const char *path, mode_t mode) -{ - dev_t dev = 0; - return __xmknod (_MKNOD_VER, path, mode | S_IFIFO, &dev); -} diff --git a/libc/sysdeps/unix/mkfifoat.c b/libc/sysdeps/unix/mkfifoat.c deleted file mode 100644 index 33fa6bde7..000000000 --- a/libc/sysdeps/unix/mkfifoat.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - - -/* Create a new FIFO with permission bits MODE. But interpret - relative PATH names relative to the directory associated with FD. */ -int -mkfifoat (fd, file, mode) - int fd; - const char *file; - mode_t mode; -{ - dev_t dev = 0; - return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev); -} diff --git a/libc/sysdeps/unix/nice.c b/libc/sysdeps/unix/nice.c deleted file mode 100644 index b986ffbf3..000000000 --- a/libc/sysdeps/unix/nice.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1992, 1996, 1997, 2001, 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 - 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, see - . */ - -#include -#include -#include - -/* Increment the scheduling priority of the calling process by INCR. - The superuser may use a negative INCR to decrement the priority. */ -int -nice (int incr) -{ - int save; - int prio; - int result; - - /* -1 is a valid priority, so we use errno to check for an error. */ - save = errno; - __set_errno (0); - prio = getpriority (PRIO_PROCESS, 0); - if (prio == -1) - { - if (errno != 0) - return -1; - else - __set_errno (save); - } - - result = setpriority (PRIO_PROCESS, 0, prio + incr); - if (result == -1) - { - if (errno == EACCES) - errno = EPERM; - return -1; - } - return getpriority (PRIO_PROCESS, 0); -} diff --git a/libc/sysdeps/unix/syscalls.list b/libc/sysdeps/unix/syscalls.list index bd780f569..b38b03e19 100644 --- a/libc/sysdeps/unix/syscalls.list +++ b/libc/sysdeps/unix/syscalls.list @@ -1,13 +1,16 @@ # File name Caller Syscall name Args Strong name Weak names +accept - accept Ci:iBN __libc_accept accept access - access i:si __access access acct - acct i:S acct adjtime - adjtime i:pp __adjtime adjtime +bind - bind i:ipi __bind bind chdir - chdir i:s __chdir chdir chmod - chmod i:si __chmod chmod chown - chown i:sii __chown __chown_internal chown chroot - chroot i:s chroot close - close Ci:i __libc_close __close close +connect - connect Ci:ipi __libc_connect __connect connect dup - dup i:i __dup dup dup2 - dup2 i:ii __dup2 dup2 dup3 - dup3 i:iii __dup3 dup3 @@ -21,16 +24,22 @@ ftruncate - ftruncate i:ii __ftruncate ftruncate getdomain - getdomainname i:si getdomainname getgid - getgid Ei: __getgid getgid getgroups - getgroups i:ip __getgroups getgroups +gethostid - gethostid i: gethostid +gethostname - gethostname i:bn __gethostname gethostname getitimer - getitimer i:ip __getitimer getitimer +getpeername - getpeername i:ibN __getpeername getpeername getpid - getpid Ei: __getpid getpid getpriority - getpriority i:ii getpriority getrlimit - getrlimit i:ip __getrlimit getrlimit getrusage - getrusage i:ip __getrusage getrusage +getsockname - getsockname i:ibN __getsockname getsockname +getsockopt - getsockopt i:iiiBN getsockopt gettimeofday - gettimeofday i:pP __gettimeofday gettimeofday getuid - getuid Ei: __getuid getuid ioctl - ioctl i:iiI __ioctl ioctl kill - kill i:ii __kill kill link - link i:ss __link link +listen - listen i:ii __listen listen lseek - lseek i:iii __libc_lseek __lseek lseek madvise - madvise i:pii madvise mkdir - mkdir i:si __mkdir mkdir @@ -45,14 +54,22 @@ read - read Ci:ibn __libc_read __read read readlink - readlink i:spi __readlink readlink readv - readv Ci:ipi __readv readv reboot - reboot i:i reboot +recv - recv Ci:ibni __libc_recv recv +recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom +recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg rename - rename i:ss rename rmdir - rmdir i:s __rmdir rmdir select - select Ci:iPPPP __select __libc_select select +send - send Ci:ibni __libc_send __send send +sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg +sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto setdomain - setdomainname i:si setdomainname setegid - setegid i:i __setegid setegid seteuid - seteuid i:i __seteuid seteuid setgid - setgid i:i __setgid setgid setgroups - setgroups i:ip setgroups +sethostid - sethostid i:i sethostid +sethostname - sethostname i:pi sethostname setitimer - setitimer i:ipp __setitimer setitimer setpgid - setpgrp i:ii __setpgid setpgid setpriority - setpriority i:iii setpriority @@ -60,10 +77,14 @@ setregid - setregid i:ii __setregid setregid setreuid - setreuid i:ii __setreuid setreuid setrlimit - setrlimit i:ip __setrlimit setrlimit setsid - setsid i: __setsid setsid +setsockopt - setsockopt i:iiibn setsockopt __setsockopt settimeofday - settimeofday i:PP __settimeofday settimeofday setuid - setuid i:i __setuid setuid +shutdown - shutdown i:ii shutdown sigaction - sigaction i:ipp __sigaction sigaction sigsuspend - sigsuspend Ci:p sigsuspend +socket - socket i:iii __socket socket +socketpair - socketpair i:iiif socketpair sstk - sstk b:i sstk statfs - statfs i:sp __statfs statfs swapoff - swapoff i:s swapoff diff --git a/libc/sysdeps/unix/sysv/linux/bits/param.h b/libc/sysdeps/unix/sysv/linux/bits/param.h new file mode 100644 index 000000000..36ca088e5 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/bits/param.h @@ -0,0 +1,42 @@ +/* Old-style Unix parameters and limits. Linux version. + Copyright (C) 1995-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 + 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, see + . */ + +#ifndef _SYS_PARAM_H +# error "Never use directly; include instead." +#endif + +#ifndef ARG_MAX +# define __undef_ARG_MAX +#endif + +#include +#include + +/* The kernel headers define ARG_MAX. The value is wrong, though. */ +#ifdef __undef_ARG_MAX +# undef ARG_MAX +# undef __undef_ARG_MAX +#endif + +#define MAXSYMLINKS 20 + +/* The following are not really correct but it is a value we used for a + long time and which seems to be usable. People should not use NOFILE + and NCARGS anyway. */ +#define NOFILE 256 +#define NCARGS 131072 diff --git a/libc/sysdeps/unix/sysv/linux/check_pf.c b/libc/sysdeps/unix/sysv/linux/check_pf.c index 950498acd..eebb3a483 100644 --- a/libc/sysdeps/unix/sysv/linux/check_pf.c +++ b/libc/sysdeps/unix/sysv/linux/check_pf.c @@ -78,6 +78,29 @@ __bump_nl_timestamp (void) } #endif +static inline uint32_t +get_nl_timestamp (void) +{ +#ifdef IS_IN_nscd + return nl_timestamp; +#elif defined USE_NSCD + return __nscd_get_nl_timestamp (); +#else + return 0; +#endif +} + +static inline bool +cache_valid_p (void) +{ + if (cache != NULL) + { + uint32_t timestamp = get_nl_timestamp (); + return timestamp != 0 && cache->timestamp == timestamp; + } + return false; +} + static struct cached_data * make_request (int fd, pid_t pid) @@ -253,11 +276,7 @@ make_request (int fd, pid_t pid) if (result == NULL) goto out_fail; -#ifdef IS_IN_nscd - result->timestamp = nl_timestamp; -#else - result->timestamp = __nscd_get_nl_timestamp (); -#endif + result->timestamp = get_nl_timestamp (); result->usecnt = 2; result->seen_ipv4 = seen_ipv4; result->seen_ipv6 = true; @@ -302,14 +321,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6, __libc_lock_lock (lock); -#ifdef IS_IN_nscd -# define cache_valid() nl_timestamp != 0 && cache->timestamp == nl_timestamp -#else -# define cache_valid() \ - ({ uint32_t val = __nscd_get_nl_timestamp (); \ - val != 0 && cache->timestamp == val; }) -#endif - if (cache != NULL && cache_valid ()) + if (cache_valid_p ()) { data = cache; atomic_increment (&cache->usecnt); diff --git a/libc/sysdeps/unix/sysv/linux/dl-fxstatat64.c b/libc/sysdeps/unix/sysv/linux/dl-fxstatat64.c index 9a17a9b73..1f8c2e641 100644 --- a/libc/sysdeps/unix/sysv/linux/dl-fxstatat64.c +++ b/libc/sysdeps/unix/sysv/linux/dl-fxstatat64.c @@ -3,4 +3,4 @@ function in this case. */ #undef __ASSUME_ATFCTS #define __ASSUME_ATFCTS 1 -#include "fxstatat64.c" +#include diff --git a/libc/sysdeps/unix/sysv/linux/fxstat64.c b/libc/sysdeps/unix/sysv/linux/fxstat64.c index dc7864792..b2ad48bdb 100644 --- a/libc/sysdeps/unix/sysv/linux/fxstat64.c +++ b/libc/sysdeps/unix/sysv/linux/fxstat64.c @@ -1,5 +1,5 @@ -/* fxstat64 using old-style Unix fstat system call. - Copyright (C) 1997-2002, 2003, 2006 Free Software Foundation, Inc. +/* fxstat64 using Linux fstat64 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 @@ -27,57 +27,18 @@ #include -#if __ASSUME_STAT64_SYSCALL == 0 -# include -#endif - -#ifdef __NR_fstat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file FD in BUF. */ int ___fxstat64 (int vers, int fd, struct stat64 *buf) { int result; -#if __ASSUME_STAT64_SYSCALL > 0 result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf)); -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 +#if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; -# endif - return result; -#else - struct kernel_stat kbuf; -# if defined __NR_fstat64 - if (! __have_no_stat64) - { - int saved_errno = errno; - result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf)); - - if (result != -1 || errno != ENOSYS) - { -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 - if (!result && buf->__st_ino != (__ino_t)buf->st_ino) - buf->st_ino = buf->__st_ino; -# endif - return result; - } - - __set_errno (saved_errno); - __have_no_stat64 = 1; - } -# endif - result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; #endif + return result; } #include diff --git a/libc/sysdeps/unix/sysv/linux/fxstatat64.c b/libc/sysdeps/unix/sysv/linux/fxstatat64.c index fff9444f0..4aa60df7a 100644 --- a/libc/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/libc/sysdeps/unix/sysv/linux/fxstatat64.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 @@ -29,18 +29,6 @@ #include -#if __ASSUME_STAT64_SYSCALL == 0 -# include -#endif - -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. - This is the definition. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME in BUF. */ int @@ -110,7 +98,6 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) file = buf; } -# if __ASSUME_STAT64_SYSCALL > 0 if (flag & AT_SYMLINK_NOFOLLOW) result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file), CHECK_1 (st)); @@ -119,51 +106,12 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) CHECK_1 (st)); if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) { -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 +# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (st->__st_ino != (__ino_t) st->st_ino) st->st_ino = st->__st_ino; -# endif +# endif return result; } -# else - struct kernel_stat kst; -# ifdef __NR_stat64 - if (! __have_no_stat64) - { - if (flag & AT_SYMLINK_NOFOLLOW) - result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file), - CHECK_1 (st)); - else - result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file), - CHECK_1 (st)); - - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) - { -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 - if (st->__st_ino != (__ino_t) st->st_ino) - st->st_ino = st->__st_ino; -# endif - return result; - } - if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - goto fail; - - __have_no_stat64 = 1; - } -# endif - - if (flag & AT_SYMLINK_NOFOLLOW) - result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file), - __ptrvalue (&kst)); - else - result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file), - __ptrvalue (&kst)); - - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) - return __xstat64_conv (vers, &kst, st); - - fail: -# endif __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf); return -1; diff --git a/libc/sysdeps/unix/sysv/linux/i386/fxstat.c b/libc/sysdeps/unix/sysv/linux/i386/fxstat.c index 5077780f0..a1a950ee7 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/fxstat.c +++ b/libc/sysdeps/unix/sysv/linux/i386/fxstat.c @@ -1,6 +1,5 @@ /* fxstat using old-style Unix fstat system call. - Copyright (C) 1991,1995-1998,2000,2002,2003,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 @@ -34,26 +33,15 @@ #include -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file FD in BUF. */ int __fxstat (int vers, int fd, struct stat *buf) { -#if __ASSUME_STAT64_SYSCALL == 0 - struct kernel_stat kbuf; -#endif int result; if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (fstat, 2, fd, CHECK_1 ((struct kernel_stat *) buf)); -#if __ASSUME_STAT64_SYSCALL > 0 { struct stat64 buf64; @@ -62,33 +50,6 @@ __fxstat (int vers, int fd, struct stat *buf) result = __xstat32_conv (vers, &buf64, buf); return result; } -#else - -# if defined __NR_stat64 - /* To support 32 bit UIDs, we have to use stat64. The normal stat call only returns - 16 bit UIDs. */ - if (! __have_no_stat64) - { - struct stat64 buf64; - - result = INLINE_SYSCALL (fstat64, 2, fd, __ptrvalue (&buf64)); - - if (result == 0) - result = __xstat32_conv (vers, &buf64, buf); - - if (result != -1 || errno != ENOSYS) - return result; - - __have_no_stat64 = 1; - } -# endif - - result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; -#endif /* __ASSUME_STAT64_SYSCALL */ } hidden_def (__fxstat) diff --git a/libc/sysdeps/unix/sysv/linux/i386/fxstatat.c b/libc/sysdeps/unix/sysv/linux/i386/fxstatat.c index 7aae336e0..d1e81e081 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/fxstatat.c +++ b/libc/sysdeps/unix/sysv/linux/i386/fxstatat.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 @@ -35,13 +35,6 @@ #include -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME relative to FD in ST. */ int @@ -106,9 +99,6 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) file = buf; } -# if __ASSUME_STAT64_SYSCALL == 0 - struct kernel_stat kst; -# endif if (vers == _STAT_VER_KERNEL) { if (flag & AT_SYMLINK_NOFOLLOW) @@ -120,8 +110,6 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) goto out; } -# if __ASSUME_STAT64_SYSCALL > 0 - if (flag & AT_SYMLINK_NOFOLLOW) result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file), __ptrvalue (&st64)); @@ -130,38 +118,6 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) __ptrvalue (&st64)); if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) return __xstat32_conv (vers, &st64, st); -# else -# if defined __NR_stat64 - /* To support 32 bit UIDs, we have to use stat64. The normal stat - call only returns 16 bit UIDs. */ - if (! __have_no_stat64) - { - if (flag & AT_SYMLINK_NOFOLLOW) - result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file), - __ptrvalue (&st64)); - else - result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file), - __ptrvalue (&st64)); - - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) - result = __xstat32_conv (vers, &st64, st); - - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - goto out; - - __have_no_stat64 = 1; - } -# endif - if (flag & AT_SYMLINK_NOFOLLOW) - result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file), - __ptrvalue (&kst)); - else - result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file), - __ptrvalue (&kst)); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) - return __xstat_conv (vers, &kst, st); -# endif /* __ASSUME_STAT64_SYSCALL */ out: if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) diff --git a/libc/sysdeps/unix/sysv/linux/i386/lxstat.c b/libc/sysdeps/unix/sysv/linux/i386/lxstat.c index 8994e1700..2b1ecaa0d 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/lxstat.c +++ b/libc/sysdeps/unix/sysv/linux/i386/lxstat.c @@ -1,6 +1,5 @@ /* lxstat using old-style Unix lstat system call. - Copyright (C) 1991,1995,1996,1997,1998,2000,2002,2003,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 @@ -34,27 +33,16 @@ #include -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME in BUF. */ int __lxstat (int vers, const char *name, struct stat *buf) { -#if __ASSUME_STAT64_SYSCALL == 0 - struct kernel_stat kbuf; -#endif int result; if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), CHECK_1 ((struct kernel_stat *) buf)); -#if __ASSUME_STAT64_SYSCALL > 0 { struct stat64 buf64; @@ -63,32 +51,6 @@ __lxstat (int vers, const char *name, struct stat *buf) result = __xstat32_conv (vers, &buf64, buf); return result; } -#else - -# if defined __NR_stat64 - /* To support 32 bit UIDs, we have to use stat64. The normal stat call only returns - 16 bit UIDs. */ - if (! __have_no_stat64) - { - struct stat64 buf64; - result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); - - if (result == 0) - result = __xstat32_conv (vers, &buf64, buf); - - if (result != -1 || errno != ENOSYS) - return result; - - __have_no_stat64 = 1; - } -# endif - - result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; -#endif } hidden_def (__lxstat) diff --git a/libc/sysdeps/unix/sysv/linux/i386/mmap.S b/libc/sysdeps/unix/sysv/linux/i386/mmap.S index c8bf3e108..1f79bde28 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/mmap.S +++ b/libc/sysdeps/unix/sysv/linux/i386/mmap.S @@ -25,10 +25,6 @@ ENTRY (__mmap) -/* I don't think it is worthwhile trying to use mmap2 whenever it - is available. Only use it when we are sure the syscall exists. */ -#ifdef __ASSUME_MMAP2_SYSCALL - /* Save registers. */ pushl %ebp cfi_adjust_cfa_offset (4) @@ -73,25 +69,6 @@ L(skip): cfi_adjust_cfa_offset (-4) cfi_restore (ebp) -#else - - /* Save registers. */ - movl %ebx, %edx - cfi_register (ebx, edx) - - movl $SYS_ify(mmap), %eax /* System call number in %eax. */ - - lea 4(%esp), %ebx /* Address of args is 1st arg. */ - - /* Do the system call trap. */ - int $0x80 - - /* Restore registers. */ - movl %edx, %ebx - cfi_restore (ebx) - -#endif - /* If 0 > %eax > -4096 there was an error. */ cmpl $-4096, %eax ja SYSCALL_ERROR_LABEL diff --git a/libc/sysdeps/unix/sysv/linux/i386/mmap64.S b/libc/sysdeps/unix/sysv/linux/i386/mmap64.S index 7599b8544..8855109ff 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/mmap64.S +++ b/libc/sysdeps/unix/sysv/linux/i386/mmap64.S @@ -37,8 +37,6 @@ .text ENTRY (BP_SYM (__mmap64)) -#ifdef __NR_mmap2 - /* Save registers. */ pushl %ebp cfi_adjust_cfa_offset (4) @@ -88,12 +86,6 @@ L(do_syscall): cfi_adjust_cfa_offset (-4) cfi_restore (ebp) -#ifndef __ASSUME_MMAP2_SYSCALL -2: - cmp $-ENOSYS, %eax - je 3f -#endif - /* If 0 > %eax > -4096 there was an error. */ cmpl $-4096, %eax ja SYSCALL_ERROR_LABEL @@ -122,42 +114,6 @@ L(einval): cfi_restore (ebp) movl $-EINVAL, %eax jmp SYSCALL_ERROR_LABEL -#endif - -#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2 -3: - /* Save registers. */ - movl %ebx, %edx - cfi_register (ebx, edx) - - cmpl $0, OFFHI-SVRSP(%esp) - jne L(einval2) - - movl $SYS_ify(mmap), %eax /* System call number in %eax. */ - - lea ADDR-SVRSP(%esp), %ebx /* Address of args is 1st arg. */ - - /* Do the system call trap. */ - ENTER_KERNEL - - /* Restore registers. */ - movl %edx, %ebx - cfi_restore (ebx) - - /* If 0 > %eax > -4096 there was an error. */ - cmpl $-4096, %eax - ja SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - ret - - cfi_register (ebx, edx) -L(einval2): - movl %edx, %ebx - cfi_restore (ebx) - movl $-EINVAL, %eax - jmp SYSCALL_ERROR_LABEL -#endif PSEUDO_END (BP_SYM (__mmap64)) diff --git a/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S b/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S index 79fc071d2..00e6a4194 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S @@ -1,5 +1,4 @@ -/* Copyright (C) 1995-2000,2002,2003,2004,2005,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1995-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 @@ -20,8 +19,6 @@ #include #include -#include - #define EINVAL 22 #define ENOSYS 38 #define EOVERFLOW 75 @@ -38,8 +35,6 @@ .text ENTRY (BP_SYM (__posix_fadvise64_l64)) -#ifdef __NR_fadvise64_64 - /* Save registers. */ pushl %ebp cfi_adjust_cfa_offset (4) @@ -78,11 +73,6 @@ ENTRY (BP_SYM (__posix_fadvise64_l64)) cfi_adjust_cfa_offset (-4) cfi_restore (ebp) -#ifndef __ASSUME_FADVISE64_64_SYSCALL - cmpl $-ENOSYS, %eax - je 1f -#endif - /* The function returns zero, or the error number. So all we have to do is negate the value passed back from the kernel. */ /* If 0 > %eax > -4096 there was an error. */ @@ -90,72 +80,15 @@ ENTRY (BP_SYM (__posix_fadvise64_l64)) /* Successful; return the syscall's value. */ ret -#endif - -#if defined __NR_fadvise64 \ - && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64) -1: /* Save registers. */ - pushl %ebx - cfi_adjust_cfa_offset (4) - pushl %esi - cfi_adjust_cfa_offset (4) - pushl %edi - cfi_adjust_cfa_offset (4) - - /* Overflow check. */ - cmpl $0, LENHI(%esp) - movl $-EOVERFLOW, %eax - jne L(overflow) - - movl FD(%esp), %ebx - cfi_rel_offset (ebx, 8) - movl OFFLO(%esp), %ecx - movl OFFHI(%esp), %edx - movl LENLO(%esp), %esi - cfi_rel_offset (esi, 4) - movl FLAGS(%esp), %edi - cfi_rel_offset (edi, 0) - - movl $SYS_ify(fadvise64), %eax - ENTER_KERNEL - - /* Restore registers. */ -L(overflow): - 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) - - /* If 0 > %eax > -4096 there was an error. */ - negl %eax - - /* Successful; return the syscall's value. */ - ret -#else - movl $ENOSYS, %eax - ret -#endif END (BP_SYM (__posix_fadvise64_l64)) -#ifdef __NR_fadvise64 .section .text.compat, "ax" ENTRY (__posix_fadvise64_l32) DO_CALL (fadvise64, 5) negl %eax ret PSEUDO_END_ERRVAL (__posix_fadvise64_l32) -#else -ENTRY (BP_SYM (__posix_fadvise64_l32)) - movl $ENOSYS, %eax - ret -END (BP_SYM (__posix_fadvise64_l32)) -#endif default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3) symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2) diff --git a/libc/sysdeps/unix/sysv/linux/i386/xstat.c b/libc/sysdeps/unix/sysv/linux/i386/xstat.c index 236ec748f..0fe7a9dcd 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/xstat.c +++ b/libc/sysdeps/unix/sysv/linux/i386/xstat.c @@ -1,6 +1,5 @@ /* xstat using old-style Unix stat system call. - Copyright (C) 1991,95,96,97,98,2000,2002,2003,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 @@ -34,27 +33,16 @@ #include -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME in BUF. */ int __xstat (int vers, const char *name, struct stat *buf) { -#if __ASSUME_STAT64_SYSCALL == 0 - struct kernel_stat kbuf; -#endif int result; if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (stat, 2, CHECK_STRING (name), CHECK_1 ((struct kernel_stat *) buf)); -#if __ASSUME_STAT64_SYSCALL > 0 { struct stat64 buf64; @@ -63,31 +51,6 @@ __xstat (int vers, const char *name, struct stat *buf) result = __xstat32_conv (vers, &buf64, buf); return result; } -#else -# if defined __NR_stat64 - /* To support 32 bit UIDs, we have to use stat64. The normal stat call only returns - 16 bit UIDs. */ - if (! __have_no_stat64) - { - struct stat64 buf64; - - result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); - - if (result == 0) - result = __xstat32_conv (vers, &buf64, buf); - - if (result != -1 || errno != ENOSYS) - return result; - - __have_no_stat64 = 1; - } -# endif - result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; -#endif /* __ASSUME_STAT64_SYSCALL */ } hidden_def (__xstat) weak_alias (__xstat, _xstat); diff --git a/libc/sysdeps/unix/sysv/linux/kernel-features.h b/libc/sysdeps/unix/sysv/linux/kernel-features.h index 6b0eb95c5..33fca5c4f 100644 --- a/libc/sysdeps/unix/sysv/linux/kernel-features.h +++ b/libc/sysdeps/unix/sysv/linux/kernel-features.h @@ -40,29 +40,6 @@ /* The sendfile syscall was introduced in 2.2.0. */ #define __ASSUME_SENDFILE 1 -/* On x86 the mmap2 syscall was introduced in 2.3.31. */ -#ifdef __i386__ -# define __ASSUME_MMAP2_SYSCALL 1 -#endif - -/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ -#ifdef __i386__ -# define __ASSUME_STAT64_SYSCALL 1 -#endif - -/* On sparc the mmap2/stat64/lstat64/fstat64 syscalls were introduced - in 2.3.35. */ -#if defined __sparc__ && !defined __arch64__ -# define __ASSUME_MMAP2_SYSCALL 1 -# define __ASSUME_STAT64_SYSCALL 1 -#endif - -/* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not - support separate 64-bit syscalls, already 64-bit. */ -#if defined __powerpc__ && !defined __powerpc64__ -# define __ASSUME_STAT64_SYSCALL 1 -#endif - /* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not support a separate 64-bit syscall, already 64-bit. */ @@ -70,12 +47,6 @@ # define __ASSUME_IPC64 1 #endif -/* SH kernels got stat64 and mmap2 during 2.4.0-test. */ -#ifdef __sh__ -# define __ASSUME_MMAP2_SYSCALL 1 -# define __ASSUME_STAT64_SYSCALL 1 -#endif - /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame, and still does not have a 64-bit inode field. */ #ifndef __sh__ @@ -86,12 +57,6 @@ MIPS n32). */ #define __ASSUME_GETDENTS64_SYSCALL 1 -/* Starting with 2.4.5 kernels the mmap2 syscall made it into the official - kernel. But PowerPC64 does not support a separate MMAP2 call. */ -#if defined __powerpc__ && !defined __powerpc64__ -# define __ASSUME_MMAP2_SYSCALL 1 -#endif - /* Beginning with 2.6.12 the clock and timer supports CPU clocks. */ #define __ASSUME_POSIX_CPU_TIMERS 1 @@ -100,35 +65,17 @@ /* The utimes syscall has been available for some architectures forever. For x86 it was introduced after 2.5.75, for x86-64, - ppc, and ppc64 it was introduced in 2.6.0-test3. */ + ppc, and ppc64 it was introduced in 2.6.0-test3, for s390 it was + introduced in 2.6.21-rc5. */ #if defined __sparc__ \ || defined __i386__ \ || defined __x86_64__ \ || defined __powerpc__ \ - || defined __sh__ + || defined __sh__ \ + || (defined __s390__ && __LINUX_KERNEL_VERSION >= 0x020616) # define __ASSUME_UTIMES 1 #endif -/* The fixed version of the posix_fadvise64 syscall appeared in - 2.6.0-test3. At least for x86 and sparc. Powerpc support appeared - in 2.6.2, but for 32-bit userspace only. */ -#if (defined __i386__ || defined __sparc__ \ - || (defined __powerpc__ && !defined __powerpc64__)) -# define __ASSUME_FADVISE64_64_SYSCALL 1 -#endif - -/* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector - SIMD (AKA Altivec, VMX) instructions and register state. This changes - the overall size of the sigcontext and adds the swapcontext syscall. */ -#ifdef __powerpc__ -# define __ASSUME_SWAPCONTEXT_SYSCALL 1 -#endif - -/* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12. */ -#if defined __sparc__ && defined __arch64__ -# define __ASSUME_STAT64_SYSCALL 1 -#endif - /* pselect/ppoll 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. On x86_64 and SH this appeared first in 2.6.19-rc1, diff --git a/libc/sysdeps/unix/sysv/linux/lxstat64.c b/libc/sysdeps/unix/sysv/linux/lxstat64.c index c6920b47c..765b195c6 100644 --- a/libc/sysdeps/unix/sysv/linux/lxstat64.c +++ b/libc/sysdeps/unix/sysv/linux/lxstat64.c @@ -1,5 +1,5 @@ -/* lxstat64 using old-style Unix lstat system call. - Copyright (C) 1997-2002,2003,2006 Free Software Foundation, Inc. +/* lxstat64 using Linux lstat64 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 @@ -27,56 +27,17 @@ #include -#if __ASSUME_STAT64_SYSCALL == 0 -# include -#endif - -#ifdef __NR_lstat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. */ -extern int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME in BUF. */ int ___lxstat64 (int vers, const char *name, struct stat64 *buf) { int result; -#ifdef __ASSUME_STAT64_SYSCALL result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), CHECK_1 (buf)); -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 +#if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; -# endif - return result; -#else - struct kernel_stat kbuf; -# ifdef __NR_lstat64 - if (! __have_no_stat64) - { - int saved_errno = errno; - result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), CHECK_1 (buf)); - - if (result != -1 || errno != ENOSYS) - { -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 - if (!result && buf->__st_ino != (__ino_t) buf->st_ino) - buf->st_ino = buf->__st_ino; -# endif - return result; - } - - __set_errno (saved_errno); - __have_no_stat64 = 1; - } -# endif - result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; #endif + return result; } #include diff --git a/libc/sysdeps/unix/sysv/linux/mmap64.c b/libc/sysdeps/unix/sysv/linux/mmap64.c index 495d77768..bca15f9c5 100644 --- a/libc/sysdeps/unix/sysv/linux/mmap64.c +++ b/libc/sysdeps/unix/sysv/linux/mmap64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999,2000,2001,2002,2006,2010 Free Software Foundation, Inc. +/* Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 1999. @@ -26,76 +26,42 @@ #include -#ifdef __NR_mmap2 - /* This is always 12, even on architectures where PAGE_SHIFT != 12. */ -# if MMAP2_PAGE_SHIFT == -1 +#if MMAP2_PAGE_SHIFT == -1 static int page_shift; -# else -# ifndef MMAP2_PAGE_SHIFT -# define MMAP2_PAGE_SHIFT 12 -# endif -# define page_shift MMAP2_PAGE_SHIFT -# endif - -# ifndef __ASSUME_MMAP2_SYSCALL -static int have_no_mmap2; +#else +# ifndef MMAP2_PAGE_SHIFT +# define MMAP2_PAGE_SHIFT 12 # endif +#define page_shift MMAP2_PAGE_SHIFT #endif void * __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) { -#ifdef __NR_mmap2 -# if MMAP2_PAGE_SHIFT == -1 +#if MMAP2_PAGE_SHIFT == -1 if (page_shift == 0) { int page_size = getpagesize (); while ((1 << ++page_shift) != page_size) ; } -# endif - if (offset & ((1 << page_shift) - 1)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } -# ifndef __ASSUME_MMAP2_SYSCALL - if (! have_no_mmap2) -# endif - { -# ifndef __ASSUME_MMAP2_SYSCALL - int saved_errno = errno; -# endif - void *result; - __ptrvalue (result) = (void *__unbounded) - INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), - len, prot, flags, fd, - (off_t) (offset >> MMAP2_PAGE_SHIFT)); -# if __BOUNDED_POINTERS__ - __ptrlow (result) = __ptrvalue (result); - __ptrhigh (result) = __ptrvalue (result) + len; -# endif -# ifndef __ASSUME_MMAP2_SYSCALL - if (result != MAP_FAILED || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_MMAP2_SYSCALL - __set_errno (saved_errno); - have_no_mmap2 = 1; -# endif - } #endif -#ifndef __ASSUME_MMAP2_SYSCALL - if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) + if (offset & ((1 << page_shift) - 1)) { __set_errno (EINVAL); return MAP_FAILED; } - - return __mmap (addr, len, prot, flags, fd, (off_t) offset); + void *result; + __ptrvalue (result) = (void *__unbounded) + INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), + len, prot, flags, fd, + (off_t) (offset >> MMAP2_PAGE_SHIFT)); +#if __BOUNDED_POINTERS__ + __ptrlow (result) = __ptrvalue (result); + __ptrhigh (result) = __ptrvalue (result) + len; #endif + return result; } weak_alias (__mmap64, mmap64) diff --git a/libc/sysdeps/unix/sysv/linux/nice.c b/libc/sysdeps/unix/sysv/linux/nice.c index 46a6da80c..3bcbb1e89 100644 --- a/libc/sysdeps/unix/sysv/linux/nice.c +++ b/libc/sysdeps/unix/sysv/linux/nice.c @@ -1 +1 @@ -#include +#include diff --git a/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c b/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c index 5d51cf243..3eea6deac 100644 --- a/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c +++ b/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003-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 @@ -18,7 +18,6 @@ #include #include #include -#include int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise); int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); @@ -29,7 +28,6 @@ int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { -#ifdef __NR_fadvise64_64 INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, __LONG_LONG_PAIR ((long) (offset >> 32), @@ -39,28 +37,7 @@ __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) advise); if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) return 0; -# ifndef __ASSUME_FADVISE64_64_SYSCALL - if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS) -# endif - return INTERNAL_SYSCALL_ERRNO (ret, err); -#endif -#ifndef __ASSUME_FADVISE64_64_SYSCALL -# ifdef __NR_fadvise64 - if (len != (off_t) len) - return EOVERFLOW; - - INTERNAL_SYSCALL_DECL (err2); - int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd, - __LONG_LONG_PAIR ((long) (offset >> 32), - (long) offset), - (off_t) len, advise); - if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2)) - return 0; - return INTERNAL_SYSCALL_ERRNO (ret2, err2); -# else - return ENOSYS; -# endif -#endif + return INTERNAL_SYSCALL_ERRNO (ret, err); } #include diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S index 2d36df458..27f2348da 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S @@ -32,7 +32,6 @@ /* Size of ucontext in GLIBC_2.3.4 and later. */ #define _UC_SIZE_2_3_4 1184 -#ifdef __ASSUME_SWAPCONTEXT_SYSCALL .section ".text"; ENTRY (__getcontext) li r4,0 @@ -45,9 +44,6 @@ ENTRY (__getcontext) 1: b __syscall_error@local END(__getcontext) -#else -# include "getcontext-common.S" -#endif versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4) diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c index 2ffaec675..5b11e28ba 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003-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 @@ -18,7 +18,6 @@ #include #include #include -#include int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise); int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); @@ -29,34 +28,13 @@ int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { -#ifdef __NR_fadvise64_64 INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advise, __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset), __LONG_LONG_PAIR ((long)(len >> 32), (long)len)); if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) return 0; -# ifndef __ASSUME_FADVISE64_64_SYSCALL - if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS) -# endif - return INTERNAL_SYSCALL_ERRNO (ret, err); -#endif -#ifndef __ASSUME_FADVISE64_64_SYSCALL -# ifdef __NR_fadvise64 - if (len != (off_t) len) - return EOVERFLOW; - - INTERNAL_SYSCALL_DECL (err2); - int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 6, fd, 0, - __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset), - (off_t) len, advise); - if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2)) - return 0; - return INTERNAL_SYSCALL_ERRNO (ret2, err2); -# else - return ENOSYS; -# endif -#endif + return INTERNAL_SYSCALL_ERRNO (ret, err); } #include diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S index fa7d05f70..b96b04040 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S @@ -1,5 +1,5 @@ /* Jump to a new context. - Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002-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,7 +32,6 @@ /* Size of ucontext in GLIBC_2.3.4 and later. */ #define _UC_SIZE_2_3_4 1184 -#ifdef __ASSUME_SWAPCONTEXT_SYSCALL .section ".text"; ENTRY (__setcontext) mr r4,r3 @@ -46,9 +45,6 @@ ENTRY (__setcontext) 1: b __syscall_error@local END(__setcontext) -#else -# include "setcontext-common.S" -#endif versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4) diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S index 0189af8e2..556c8020d 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S @@ -1,5 +1,5 @@ /* Save current context and jump to a new context. - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002-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,7 +32,6 @@ /* Size of ucontext in GLIBC_2.3.4 and later. */ #define _UC_SIZE_2_3_4 1184 -#ifdef __ASSUME_SWAPCONTEXT_SYSCALL .section ".text"; ENTRY (__swapcontext) li r5,_UC_SIZE_2_3_4; @@ -44,9 +43,6 @@ ENTRY (__swapcontext) 1: b __syscall_error@local END(__swapcontext) -#else -# include "swapcontext-common.S" -#endif versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4) diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c deleted file mode 100644 index fc06dbd64..000000000 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S b/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S index 6e5ba94c1..0357ab461 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S +++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2000-2012 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -40,8 +40,8 @@ ENTRY(__mmap) cfi_adjust_cfa_offset (120) st %r1,0(%r15) /* store back chain */ - /* Store parameters on stack, because old_mmap/mmap2 - * take only one parameter: a pointer to the parameter area + /* Store parameters on stack, because mmap2 + * takes only one parameter: a pointer to the parameter area */ st %r6,0x70(%r15) /* Store 'fd'. */ st %r5,0x6C(%r15) /* Store 'flags'. */ @@ -50,10 +50,6 @@ ENTRY(__mmap) st %r2,0x60(%r15) /* Store 'start'. */ l %r1,216(%r15) /* Load offset. */ -#ifdef __ASSUME_MMAP2_SYSCALL - /* I don't think it is worthwhile trying to use mmap2 whenever - * it is available. Only use it when we are sure the syscall - * exists. */ tml %r1,0x0fff /* Offset page aligned ? */ lhi %r2,-EINVAL jnz 1f /* No -> EINVAL. */ @@ -61,11 +57,6 @@ ENTRY(__mmap) st %r1,0x74(%r15) /* Store page offset. */ la %r2,0x60(%r15) /* Load address of parameter list. */ svc SYS_ify(mmap2) /* Do the system call trap. */ -#else - st %r1,0x74(%r15) /* Store offset unmodified. */ - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap) /* Do the system call trap. */ -#endif 1: l %r15,0(%r15) /* Load back chain. */ cfi_adjust_cfa_offset (-120) diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S b/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S index ad6d254db..8b4bd4556 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S +++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2000-2012 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -41,15 +41,14 @@ ENTRY(__mmap64) cfi_adjust_cfa_offset (120) st %r1,0(%r15) /* Store back chain. */ - /* Store parameters on stack, because mmap2 and old_mmap - * take only one parameter: a pointer to the parameter area. */ + /* Store parameters on stack, because mmap2 + * takes only one parameter: a pointer to the parameter area. */ st %r6,0x70(%r15) /* Store 'fd'. */ st %r5,0x6C(%r15) /* Store 'flags'. */ st %r4,0x68(%r15) /* Store 'prot'. */ st %r3,0x64(%r15) /* Store 'length'. */ st %r2,0x60(%r15) /* Store 'start'. */ -#ifdef __NR_mmap2 lm %r0,%r1,216(%r15) /* Load 64 bit offset. */ tml %r1,0x0fff /* Offset page aligned ? */ jnz 2f /* No -> EINVAL. */ @@ -61,11 +60,6 @@ ENTRY(__mmap64) la %r2,0x60(%r15) /* Load address of parameter list. */ svc SYS_ify(mmap2) /* Do the system call trap. */ -#ifndef __ASSUME_MMAP2_SYSCALL - chi %r2,-ENOSYS - je 1f -#endif - l %r15,0(%r15) /* Load back chain. */ cfi_adjust_cfa_offset (-120) lm %r6,%r15,24(%r15) /* Load registers. */ @@ -78,31 +72,6 @@ ENTRY(__mmap64) /* Successful; return the syscall's value. */ br %r14 -#endif - -#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2 -1: lm %r0,%r1,216(%r15) /* Load 64 bit offset. */ - st %r1,0x74(%r15) /* Store lower word of offset. */ - ltr %r0,%r0 /* Offset > 2^32 ? */ - jnz 2f - alr %r1,%r3 /* Add length to offset. */ - brc 3,2f /* Carry -> EINVAL. */ - - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap) /* Do the system call trap. */ - - l %r15,0(%r15) /* Load back chain. */ - lm %r6,%r15,24(%r15) /* Load registers. */ - - /* Check gpr 2 for error. */ - lhi %r0,-4096 - clr %r2,%r0 - jnl SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - br %r14 -#endif - 2: lhi %r2,-EINVAL l %r15,0(%r15) /* Load back chain. */ lm %r6,%r15,24(%r15) /* Load registers. */ diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c b/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c index 05b81ecbc..480b92fcb 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c +++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003-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 @@ -18,7 +18,6 @@ #include #include #include -#include int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise); int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); @@ -37,7 +36,6 @@ struct fadvise64_64_layout int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { -#ifdef __NR_fadvise64_64 struct fadvise64_64_layout parameters; INTERNAL_SYSCALL_DECL (err); @@ -48,28 +46,7 @@ __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, ¶meters); if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) return 0; -# ifndef __ASSUME_FADVISE64_64_SYSCALL - if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS) -# endif - return INTERNAL_SYSCALL_ERRNO (ret, err); -#endif -#ifndef __ASSUME_FADVISE64_64_SYSCALL -# ifdef __NR_fadvise64 - if (len != (off_t) len) - return EOVERFLOW; - - INTERNAL_SYSCALL_DECL (err2); - int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd, - __LONG_LONG_PAIR ((long) (offset >> 32), - (long) offset), - (off_t) len, advise); - if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2)) - return 0; - return INTERNAL_SYSCALL_ERRNO (ret2, err2); -# else - return ENOSYS; -# endif -#endif + return INTERNAL_SYSCALL_ERRNO (ret, err); } #include diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/time.c b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/time.c index 3a64ef195..509b580c5 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/time.c +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/time.c @@ -1 +1 @@ -#include +#include diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c index 71a51ccd8..c3b00cb1d 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c @@ -1,10 +1 @@ -#include - #include "../../i386/xstat.c" - -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat{,64} calls. */ -int __have_no_stat64; -# endif -#endif diff --git a/libc/sysdeps/unix/sysv/linux/sys/param.h b/libc/sysdeps/unix/sysv/linux/sys/param.h deleted file mode 100644 index c419b8640..000000000 --- a/libc/sysdeps/unix/sysv/linux/sys/param.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 1995-1997,2000,2001,2003,2008,2011 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H 1 - -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -#include -#include -#include - -/* The kernel headers defines ARG_MAX. The value is wrong, though. */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* BSD names for some values. */ - -#define NBBY CHAR_BIT -#ifndef NGROUPS -# define NGROUPS NGROUPS_MAX -#endif -#define MAXSYMLINKS 20 -#define CANBSIZ MAX_CANON -#define MAXPATHLEN PATH_MAX -/* The following are not really correct but it is a value we used for a - long time and which seems to be usable. People should not use NOFILE - and NCARGS anyway. */ -#define NOFILE 256 -#define NCARGS 131072 - - -#include - -/* Bit map related macros. */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) - -/* Macros for counting and rounding. */ -#ifndef howmany -# define howmany(x, y) (((x) + ((y) - 1)) / (y)) -#endif -#ifdef __GNUC__ -# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ - ? (((x) + (y) - 1) & ~((y) - 1)) \ - : ((((x) + ((y) - 1)) / (y)) * (y))) -#else -# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#endif -#define powerof2(x) ((((x) - 1) & (x)) == 0) - -/* Macros for min/max. */ -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - - -/* Unit of `st_blocks'. */ -#define DEV_BSIZE 512 - - -#endif /* sys/param.h */ diff --git a/libc/sysdeps/unix/sysv/linux/time.c b/libc/sysdeps/unix/sysv/linux/time.c index f01d5753f..a73783e36 100644 --- a/libc/sysdeps/unix/sysv/linux/time.c +++ b/libc/sysdeps/unix/sysv/linux/time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 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 @@ -37,6 +37,6 @@ libc_hidden_def (time) #else -# include +# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/xstat64.c b/libc/sysdeps/unix/sysv/linux/xstat64.c index c83d2b77e..dd0f99676 100644 --- a/libc/sysdeps/unix/sysv/linux/xstat64.c +++ b/libc/sysdeps/unix/sysv/linux/xstat64.c @@ -1,5 +1,5 @@ -/* xstat64 using old-style Unix stat system call. - Copyright (C) 1991,1995-2002,2003,2006 Free Software Foundation, Inc. +/* xstat64 using Linux stat64 system call. + 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 @@ -27,59 +27,18 @@ #include -#if __ASSUME_STAT64_SYSCALL == 0 -# include -#endif - -#ifdef __NR_stat64 -# if __ASSUME_STAT64_SYSCALL == 0 -/* The variable is shared between all wrappers around *stat64 calls. - This is the definition. */ -int __have_no_stat64; -# endif -#endif - /* Get information about the file NAME in BUF. */ int ___xstat64 (int vers, const char *name, struct stat64 *buf) { int result; -#if __ASSUME_STAT64_SYSCALL > 0 result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), CHECK_1 (buf)); -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 +#if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; -# endif - return result; -#else - struct kernel_stat kbuf; -# if defined __NR_stat64 - if (! __have_no_stat64) - { - int saved_errno = errno; - result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), CHECK_1 (buf)); - - if (result != -1 || errno != ENOSYS) - { -# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 - if (!result && buf->__st_ino != (__ino_t) buf->st_ino) - buf->st_ino = buf->__st_ino; -# endif - return result; - } - - __set_errno (saved_errno); - __have_no_stat64 = 1; - } -# endif - - result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; #endif + return result; } diff --git a/libc/sysdeps/unix/sysv/linux/xstatconv.c b/libc/sysdeps/unix/sysv/linux/xstatconv.c index bf1dae08c..2e5a1a151 100644 --- a/libc/sysdeps/unix/sysv/linux/xstatconv.c +++ b/libc/sysdeps/unix/sysv/linux/xstatconv.c @@ -1,6 +1,5 @@ /* Convert between the kernel's `struct stat' format, and libc's. - Copyright (C) 1991,1995-1997,2000,2002,2003,2007 - 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 @@ -32,7 +31,7 @@ struct kernel_stat; #include -#if !defined __ASSUME_STAT64_SYSCALL || defined XSTAT_IS_XSTAT64 +#ifdef XSTAT_IS_XSTAT64 int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) { diff --git a/libc/sysdeps/unix/time.c b/libc/sysdeps/unix/time.c deleted file mode 100644 index e026a384d..000000000 --- a/libc/sysdeps/unix/time.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991,92,97,2001,02 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include /* For NULL. */ -#include -#include - - -/* Return the current time as a `time_t' and also put it in *T if T is - not NULL. Time is represented as seconds from Jan 1 00:00:00 1970. */ -time_t -time (t) - time_t *t; -{ - struct timeval tv; - time_t result; - - if (__gettimeofday (&tv, (struct timezone *) NULL)) - result = (time_t) -1; - else - result = (time_t) tv.tv_sec; - - if (t != NULL) - *t = result; - return result; -} -libc_hidden_def (time) diff --git a/libc/sysdeps/unix/utime.c b/libc/sysdeps/unix/utime.c deleted file mode 100644 index a750ecc29..000000000 --- a/libc/sysdeps/unix/utime.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991,94,97,2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include -#include - - -/* Set the access and modification times of FILE to those given in TIMES. - If TIMES is NULL, set them to the current time. */ -int -utime (file, times) - const char *file; - const struct utimbuf *times; -{ - struct timeval timevals[2]; - struct timeval *tvp; - - if (times != NULL) - { - timevals[0].tv_sec = (time_t) times->actime; - timevals[0].tv_usec = 0L; - timevals[1].tv_sec = (time_t) times->modtime; - timevals[1].tv_usec = 0L; - tvp = timevals; - } - else - tvp = NULL; - - return __utimes (file, tvp); -} -libc_hidden_def (utime) -- cgit v1.2.3