summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/pread_write.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-22 19:35:08 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-22 19:35:08 +0000
commitdf31d32b411022d130b078de177cfa40b7bf6cde (patch)
tree0604126022fcad298f377155a756b42e28882177 /libc/sysdeps/linux/common/pread_write.c
parentd98307c5af70386c4480deff87c7c9921d801c7c (diff)
Enable _GNU_SOURCE build wide, trying to get consistent interfaces, else IMA is a useless attempt
Diffstat (limited to 'libc/sysdeps/linux/common/pread_write.c')
-rw-r--r--libc/sysdeps/linux/common/pread_write.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
index 327a9c785..45a94cfb8 100644
--- a/libc/sysdeps/linux/common/pread_write.c
+++ b/libc/sysdeps/linux/common/pread_write.c
@@ -13,26 +13,13 @@
* from GNU libc 2.2.5, but reworked considerably...
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "syscalls.h"
#include <unistd.h>
#include <stdint.h>
#ifdef __NR_pread
-#define __NR___syscall_pread __NR_pread
+# define __NR___syscall_pread __NR_pread
static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
@@ -42,7 +29,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -50,14 +37,13 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pread */
-
#ifdef __NR_pwrite
-#define __NR___syscall_pwrite __NR_pwrite
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
@@ -67,7 +53,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -75,11 +61,9 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pwrite */
-
-
#if ! defined __NR_pread || ! defined __NR_pwrite
libc_hidden_proto(read)
libc_hidden_proto(write)
@@ -123,7 +107,7 @@ static ssize_t __fake_pread_write(int fd, void *buf,
return(result);
}
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
static ssize_t __fake_pread_write64(int fd, void *buf,
size_t count, off64_t offset, int do_pwrite)
{
@@ -158,7 +142,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
__set_errno (save_errno);
return result;
}
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
#ifndef __NR_pread
@@ -168,16 +152,15 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, buf, count, offset, 0));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pread */
-
#ifndef __NR_pwrite
ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
{
@@ -187,11 +170,11 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pwrite */