posix_fadvise.c 846 B

12345678910111213141516171819202122232425262728293031
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * posix_fadvise() for uClibc
  4. * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
  5. *
  6. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  7. *
  8. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  9. */
  10. #include <sys/syscall.h>
  11. #include <fcntl.h>
  12. #ifdef __NR_fadvise64
  13. #define __NR_posix_fadvise __NR_fadvise64
  14. int posix_fadvise(int fd, off_t offset, off_t len, int advice)
  15. {
  16. int ret;
  17. INTERNAL_SYSCALL_DECL(err);
  18. ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 5, fd,
  19. __LONG_LONG_PAIR (offset >> 31, offset), len, advice));
  20. if (INTERNAL_SYSCALL_ERROR_P (ret, err))
  21. return INTERNAL_SYSCALL_ERRNO (ret, err);
  22. return 0;
  23. }
  24. # if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64
  25. strong_alias(posix_fadvise,posix_fadvise64)
  26. # endif
  27. #endif