llseek.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * llseek/lseek64 syscall for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include "syscalls.h"
  10. #include <unistd.h>
  11. #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
  12. # ifndef INLINE_SYSCALL
  13. # define INLINE_SYSCALL(name, nr, args...) __syscall_llseek (args)
  14. # define __NR___syscall_llseek __NR__llseek
  15. static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi,
  16. off_t, offset_lo, loff_t *, result, int, whence);
  17. # endif
  18. loff_t __libc_lseek64(int fd, loff_t offset, int whence)
  19. {
  20. loff_t result;
  21. return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
  22. (off_t) (offset & 0xffffffff), &result, whence) ?: result);
  23. }
  24. #else
  25. extern __typeof(lseek) __libc_lseek;
  26. libc_hidden_proto(__libc_lseek)
  27. loff_t __libc_lseek64(int fd, loff_t offset, int whence)
  28. {
  29. return(loff_t)(__libc_lseek(fd, (off_t) (offset), whence));
  30. }
  31. #endif
  32. libc_hidden_proto(lseek64)
  33. weak_alias(__libc_lseek64,lseek64)
  34. libc_hidden_def(lseek64)
  35. //strong_alias(__libc_lseek64,_llseek)