diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-16 01:07:23 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:37 +0200 |
commit | e21479da34bbe39fb9d99e2f6e323fd1a942d9cb (patch) | |
tree | f1240e0f522f2515cf27b48fe11c38eecaa00a90 | |
parent | a4b93f0bef877d6e996037696ecb1779bfe46074 (diff) |
*64.[cS]: use _lfs_64.h instead of features.h and remove LFS guard
_lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard.
Reorganize to include only the minimal necessary headers.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
21 files changed, 86 insertions, 143 deletions
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index 707154124..bc9d4f152 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -16,13 +16,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> +#include <_lfs_64.h> #define _ERRNO_H #include <bits/errno.h> #include <sys/syscall.h> #include <bits/arm_asm.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 +#ifdef __NR_mmap2 /* The mmap2 system call takes six arguments, all in registers. */ .text diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index e8782e967..09291e5d7 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -7,13 +7,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <stdarg.h> -#include <fcntl.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - -#define __NR___syscall_fcntl64 __NR_fcntl64 +#ifdef __NR_fcntl64 +# include <stdarg.h> +# include <fcntl.h> +# define __NR___syscall_fcntl64 __NR_fcntl64 static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg) int fcntl64(int fd, int cmd, ...) { diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 577ad14b5..550e88aab 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -17,14 +17,10 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#ifdef __UCLIBC_HAS_LFS__ #include <fcntl.h> -#include <sys/types.h> /* Create FILE with protections MODE. */ int creat64(const char *file, mode_t mode) { return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode); } -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 60613433b..7460c26f6 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -7,17 +7,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64 -#include <unistd.h> -#include <sys/stat.h> -#include "xstatconv.h" - - -#define __NR___syscall_fstat64 __NR_fstat64 -static __inline__ _syscall2(int, __syscall_fstat64, - int, filedes, struct kernel_stat64 *, buf) +#ifdef __NR_fstat64 +# include <unistd.h> +# include <sys/stat.h> +# include "xstatconv.h" +# define __NR___syscall_fstat64 __NR_fstat64 +static __always_inline _syscall2(int, __syscall_fstat64, + int, filedes, struct kernel_stat64 *, buf) int fstat64(int fd, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c index 95627afaf..6be8ba4b5 100644 --- a/libc/sysdeps/linux/common/fstatat64.c +++ b/libc/sysdeps/linux/common/fstatat64.c @@ -6,11 +6,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <sys/stat.h> -#include "xstatconv.h" - -#ifdef __UCLIBC_HAS_LFS__ /* 64bit ports tend to favor newfstatat() */ #ifdef __NR_newfstatat @@ -18,6 +15,8 @@ #endif #ifdef __NR_fstatat64 +# include <sys/stat.h> +# include "xstatconv.h" int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) { int ret; @@ -32,5 +31,3 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) #else /* should add emulation with fstat64() and /proc/self/fd/ ... */ #endif - -#endif diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index c5a616007..012a1f4ed 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -10,47 +10,42 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include <features.h> +#include <_lfs_64.h> +#include <sys/syscall.h> +#include <unistd.h> -#ifdef __UCLIBC_HAS_LFS__ +#ifdef __NR_ftruncate64 +# include <bits/wordsize.h> -# include <unistd.h> -# include <errno.h> -# include <endian.h> -# include <stdint.h> -# include <sys/types.h> -# include <sys/syscall.h> - - -# ifdef __NR_ftruncate64 - -# if __WORDSIZE == 64 +# if __WORDSIZE == 64 /* For a 64 bit machine, life is simple... */ _syscall2(int, ftruncate64, int, fd, __off64_t, length) -# elif __WORDSIZE == 32 +# elif __WORDSIZE == 32 +# include <endian.h> +# include <stdint.h> /* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); -# else +# else return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); -# endif +# endif } -# else /* __WORDSIZE */ -# error Your machine is not 64 bit or 32 bit, I am dazed and confused. -# endif /* __WORDSIZE */ - -# else /* __NR_ftruncate64 */ +# else /* __WORDSIZE */ +# error Your machine is not 64 bit or 32 bit, I am dazed and confused. +# endif /* __WORDSIZE */ +#else /* __NR_ftruncate64 */ +# include <errno.h> int ftruncate64 (int fd, __off64_t length) { @@ -65,7 +60,5 @@ int ftruncate64 (int fd, __off64_t length) return -1; } -# endif /* __NR_ftruncate64 */ +#endif /* __NR_ftruncate64 */ libc_hidden_def(ftruncate64) - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index e1133fffa..aacbe97cc 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -4,7 +4,11 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> +#include <_lfs_64.h> +#include <sys/syscall.h> + +#ifdef __NR_getdents64 + #include <assert.h> #include <errno.h> #include <dirent.h> @@ -12,19 +16,10 @@ #include <stdint.h> #include <string.h> #include <unistd.h> -#include <dirent.h> #include <sys/param.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <bits/kernel_types.h> +#include <bits/wordsize.h> #include <bits/uClibc_alloc.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 - -# ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -# endif - struct kernel_dirent64 { uint64_t d_ino; diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index d537241eb..2945e6da7 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include <sys/types.h> -#include <sys/resource.h> #include <bits/wordsize.h> /* the regular getrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include <sys/resource.h> /* Put the soft and hard limits for RESOURCE in *RLIMITS. Returns 0 if successful, -1 if not (and sets errno). */ diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index 235b76d4a..85e269819 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -7,17 +7,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64 +#ifdef __NR_lstat64 # include <unistd.h> # include <sys/stat.h> # include "xstatconv.h" - # define __NR___syscall_lstat64 __NR_lstat64 -static __inline__ _syscall2(int, __syscall_lstat64, const char *, file_name, - struct kernel_stat64 *, buf) +static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name, + struct kernel_stat64 *, buf) int lstat64(const char *file_name, struct stat64 *buf) { @@ -31,5 +31,4 @@ int lstat64(const char *file_name, struct stat64 *buf) return result; } libc_hidden_def(lstat64) - #endif diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index c1f5400b8..91931fa70 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -4,7 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> +#include <_lfs_64.h> #include <fcntl.h> #include <stdarg.h> #ifdef __UCLIBC_HAS_THREADS_NATIVE__ @@ -12,8 +12,6 @@ #include <sysdep-cancel.h> #endif -#ifdef __UCLIBC_HAS_LFS__ - #ifndef O_LARGEFILE # define O_LARGEFILE 0100000 #endif @@ -53,5 +51,3 @@ libc_hidden_def(open64) libc_hidden_weak(open64) strong_alias(open64,__libc_open64) #endif - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index de813ba15..067085430 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -16,7 +16,7 @@ # define __NR_fadvise64_64 __NR_arm_fadvise64_64 #endif -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64_64 && __WORDSIZE == 32 # include <fcntl.h> # include <endian.h> diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index fc5155fd2..2442b808c 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -10,15 +10,10 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include <features.h> -#include <unistd.h> -#include <errno.h> -#include <endian.h> -#include <stdint.h> -#include <sys/sendfile.h> +#include <_lfs_64.h> #include <sys/syscall.h> -#include <bits/wordsize.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_sendfile64 +#ifdef __NR_sendfile64 +# include <sys/sendfile.h> _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #endif diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index 8705c6f59..8ec6e5842 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include <sys/types.h> -#include <sys/resource.h> #include <bits/wordsize.h> /* the regular setrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include <sys/resource.h> /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index a76f182d4..ef34faf7d 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -7,17 +7,15 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <sys/stat.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64 - -# define __NR___syscall_stat64 __NR_stat64 -# include <unistd.h> +#ifdef __NR_stat64 +# include <sys/stat.h> # include "xstatconv.h" - -static __inline__ _syscall2(int, __syscall_stat64, - const char *, file_name, struct kernel_stat64 *, buf) +# define __NR___syscall_stat64 __NR_stat64 +static __always_inline _syscall2(int, __syscall_stat64, + const char *, file_name, struct kernel_stat64 *, buf) int stat64(const char *file_name, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 1f6c4596a..6dfdc4c07 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -10,46 +10,36 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include <features.h> -#include <unistd.h> -#include <errno.h> -#include <endian.h> -#include <stdint.h> -#include <sys/types.h> +#include <_lfs_64.h> #include <sys/syscall.h> +#include <unistd.h> -#if defined __UCLIBC_HAS_LFS__ - -#if defined __NR_truncate64 - -#if __WORDSIZE == 64 +#ifdef __NR_truncate64 +# include <bits/wordsize.h> -/* For a 64 bit machine, life is simple... */ +# if __WORDSIZE == 64 _syscall2(int, truncate64, const char *, path, __off64_t, length) - -#elif __WORDSIZE == 32 - -/* The exported truncate64 function. */ +# elif __WORDSIZE == 32 +# include <endian.h> +# include <stdint.h> int truncate64(const char * path, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(truncate64, 4, path, 0, __LONG_LONG_PAIR(high, low)); -#else +# else return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR(high, low)); -#endif +# endif } +# else +# error Your machine is not 64 bit nor 32 bit, I am dazed and confused. +# endif -#else /* __WORDSIZE */ -#error Your machine is not 64 bit nor 32 bit, I am dazed and confused. -#endif /* __WORDSIZE */ - -#else /* __NR_truncate64 */ - - +#else +# include <errno.h> int truncate64(const char * path, __off64_t length) { __off_t x = (__off_t) length; @@ -62,7 +52,4 @@ int truncate64(const char * path, __off64_t length) return -1; } - -#endif /* __NR_truncate64 */ - -#endif /* __UCLIBC_HAS_LFS__ */ +#endif diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index f795342ff..75383b272 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <unistd.h> #include <sys/stat.h> -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, fstat64, int, fd, struct stat64 *, buf) libc_hidden_def(fstat64) -#endif diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index f038fb0e3..e84581c1e 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <unistd.h> #include <sys/stat.h> -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(lstat64) -#endif diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index 675e6349a..a13d1c35d 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ +#include <_lfs_64.h> #include <sys/syscall.h> -#include <unistd.h> #include <sys/stat.h> -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, stat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(stat64) -#endif diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index a6b4aa042..33f7db7bb 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -17,13 +17,12 @@ 02111-1307 USA. */ +#include <_lfs_64.h> #define _ERRNO_H 1 -#include <features.h> #include <bits/errno.h> #include <sys/syscall.h> -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 - +#ifdef __NR_mmap2 #define LINKAGE 4 #define PTR_SIZE 4 diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 6094fbb94..5470404a5 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -17,9 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <_lfs_64.h> #include <sys/syscall.h> -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ +#ifdef __NR_fadvise64_64 .text .global posix_fadvise64 diff --git a/libc/sysdeps/linux/mips/posix_fadvise64.c b/libc/sysdeps/linux/mips/posix_fadvise64.c index f97dab97d..02244aaab 100644 --- a/libc/sysdeps/linux/mips/posix_fadvise64.c +++ b/libc/sysdeps/linux/mips/posix_fadvise64.c @@ -13,7 +13,7 @@ #include <bits/wordsize.h> /* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ -#if defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64 && __WORDSIZE == 32 # include <fcntl.h> # include <endian.h> |