From 80b0b55af2faa2e314d61d2f17fc24c9cfa94a34 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 15 Nov 2002 14:06:44 +0000 Subject: Cleanup a few structural wierdnesses --- libc/sysdeps/linux/common/create_module.c | 2 +- libc/sysdeps/linux/common/ftruncate64.c | 12 +++++++----- libc/sysdeps/linux/common/pread_write.c | 3 --- libc/sysdeps/linux/common/sendfile64.c | 18 ++++++++++-------- libc/sysdeps/linux/common/syscalls.c | 4 ++-- libc/sysdeps/linux/common/truncate64.c | 11 +++++++---- 6 files changed, 27 insertions(+), 23 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c index 9b80fe84e..426b0f178 100644 --- a/libc/sysdeps/linux/common/create_module.c +++ b/libc/sysdeps/linux/common/create_module.c @@ -61,7 +61,7 @@ unsigned long create_module(const char *name, size_t size) } #else /* Sparc, MIPS, etc don't mistake return values for errors. */ -_syscall2(unsigned long, create_module, const char *, name, size_t, size) +_syscall2(unsigned long, create_module, const char *, name, size_t, size); #endif diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index 0ab6fd5b9..76b0c0636 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -19,15 +19,17 @@ #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_ftruncate64 +#if defined __NR_ftruncate64 -#if __WORDSIZE == 64 +#if __WORDSIZE == 64 || (defined(__powerpc__) && defined (__UCLIBC_HAS_LFS__)) /* For a 64 bit machine, life is simple... */ _syscall2(int, ftruncate64, int, fd, __off64_t, length); #elif __WORDSIZE == 32 +#if defined __UCLIBC_HAS_LFS__ + #ifndef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) __syscall_ftruncate64 (args) #define __NR___syscall_ftruncate64 __NR_ftruncate64 @@ -42,11 +44,11 @@ int ftruncate64 (int fd, __off64_t length) uint32_t high = length >> 32; return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); } +#endif /* __UCLIBC_HAS_LFS__ */ -#else +#else /* __WORDSIZE */ #error Your machine is not 64 bit or 32 bit, I am dazed and confused. #endif /* __WORDSIZE */ -#endif /* __UCLIBC_HAS_LFS__ */ - +#endif diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c index 98a059416..7955916fe 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -45,8 +45,6 @@ static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, off_t, offset_hi, off_t, offset_lo); -#define __NR___libc_pread __NR_pread - ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR((off_t)0,offset))); @@ -66,7 +64,6 @@ weak_alias (__libc_pread64, pread64) #ifdef __NR_pwrite -#define __NR___libc_pwrite __NR_pwrite #define __NR___syscall_pwrite __NR_pwrite static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index 17ba803ea..3c83c81ad 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -20,27 +20,29 @@ #include #include +#if defined __NR_sendfile64 -#if __WORDSIZE == 64 +#if __WORDSIZE == 64 || (defined(__powerpc__) && defined (__UCLIBC_HAS_LFS__)) /* For a 64 bit machine, life is simple... */ _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #elif __WORDSIZE == 32 #if defined __UCLIBC_HAS_LFS__ -#if defined __NR_sendfile64 _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) +#endif /* __UCLIBC_HAS_LFS__ */ + +#else /* __WORDSIZE */ +#error Your machine is not 64 bit or 32 bit, I am dazed and confused. +#endif /* __WORDSIZE */ + + +#else /* ! defined __NR_sendfile64 */ -#else ssize_t sendfile64 (int out_fd, int in_fd, __off64_t *offset, size_t count) { __set_errno (ENOSYS); return -1; } -#endif - -#endif /* __UCLIBC_HAS_LFS__ */ -#else /* __WORDSIZE */ -#error Your machine is not 64 bit or 32 bit, I am dazed and confused. #endif diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index 63c70e85a..9a91f2e65 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -1586,7 +1586,7 @@ _syscall2(int, sigaltstack, const struct sigaltstack *, ss, struct sigaltstack * #ifdef L_sendfile #include #include -_syscall4(ssize_t,sendfile, int, out_fd, int, in_fd, __off_t *, offset, size_t, count) +_syscall4(ssize_t,sendfile, int, out_fd, int, in_fd, __off_t *, offset, size_t, count); #endif #endif @@ -1672,7 +1672,7 @@ _syscall2(int, fstat64, int, filedes, struct stat64 *, buf); //#define __NR_pivot_root 217 #ifdef __NR_pivot_root #ifdef L_pivot_root -_syscall2(int, pivot_root, const char *, new_root, const char *, put_old) +_syscall2(int, pivot_root, const char *, new_root, const char *, put_old); #endif #endif diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index a23bac536..ba6d95d1d 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -19,15 +19,17 @@ #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_truncate64 +#if defined __NR_truncate64 -#if __WORDSIZE == 64 +#if __WORDSIZE == 64 || (defined(__powerpc__) && defined (__UCLIBC_HAS_LFS__)) /* For a 64 bit machine, life is simple... */ _syscall2(int, truncate64, const char *, path, __off64_t, length); #elif __WORDSIZE == 32 +#if defined __UCLIBC_HAS_LFS__ + #ifndef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) __syscall_truncate64 (args) #define __NR___syscall_truncate64 __NR_truncate64 @@ -42,10 +44,11 @@ int truncate64 (const char * path, __off64_t length) uint32_t high = length >> 32; return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR (high, low)); } +#endif /* __UCLIBC_HAS_LFS__ */ -#else +#else /* __WORDSIZE */ #error Your machine is not 64 bit or 32 bit, I am dazed and confused. #endif /* __WORDSIZE */ -#endif /* __UCLIBC_HAS_LFS__ */ +#endif -- cgit v1.2.3