sync_file_range.c 857 B

123456789101112131415161718192021222324252627
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * sync_file_range() for uClibc
  4. *
  5. * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #if defined __USE_GNU
  11. #include <fcntl.h>
  12. #if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
  13. #define __NR___syscall_sync_file_range __NR_sync_file_range
  14. static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
  15. off_t, offset_hi, off_t, offset_lo,
  16. off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
  17. int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
  18. {
  19. return __syscall_sync_file_range(fd,
  20. __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
  21. __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
  22. flags);
  23. }
  24. #endif
  25. #endif