pread_write.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include <sys/syscall.h>
  8. #include <unistd.h>
  9. #include <endian.h>
  10. #ifdef __NR_pread64
  11. # ifdef __NR_pread
  12. # error "__NR_pread and __NR_pread64 both defined???"
  13. # endif
  14. # define __NR_pread __NR_pread64
  15. #endif
  16. #ifdef __NR_pread
  17. # define __NR___syscall_pread __NR_pread
  18. static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
  19. size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
  20. # define MY_PREAD(fd, buf, count, offset) \
  21. __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
  22. # define MY_PREAD64(fd, buf, count, offset) \
  23. __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
  24. #endif
  25. #ifdef __NR_pwrite64
  26. # ifdef __NR_pwrite
  27. # error "__NR_pwrite and __NR_pwrite64 both defined???"
  28. # endif
  29. # define __NR_pwrite __NR_pwrite64
  30. #endif
  31. #ifdef __NR_pwrite
  32. # define __NR___syscall_pwrite __NR_pwrite
  33. static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
  34. size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
  35. # define MY_PWRITE(fd, buf, count, offset) \
  36. __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
  37. # define MY_PWRITE64(fd, buf, count, offset) \
  38. __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
  39. #endif
  40. #include "../common/pread_write.c"