sync_file_range.c 863 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 __NR_sync_file_range && defined __UCLIBC_HAS_LFS__ && defined __USE_GNU
  11. # include <fcntl.h>
  12. # define __NR___syscall_sync_file_range __NR_sync_file_range
  13. static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
  14. off_t, offset_hi, off_t, offset_lo,
  15. off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
  16. int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
  17. {
  18. return __syscall_sync_file_range(fd,
  19. __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
  20. __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
  21. flags);
  22. }
  23. #endif