llseek.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <unistd.h>
  10. #include <sys/types.h>
  11. #include <sys/syscall.h>
  12. #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
  13. # ifndef INLINE_SYSCALL
  14. # define INLINE_SYSCALL(name, nr, args...) __syscall_llseek (args)
  15. # define __NR___syscall_llseek __NR__llseek
  16. static __inline__ _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi,
  17. off_t, offset_lo, loff_t *, result, int, whence)
  18. # endif
  19. loff_t lseek64(int fd, loff_t offset, int whence)
  20. {
  21. loff_t result;
  22. return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32),
  23. (off_t) (offset & 0xffffffff), &result, whence) ?: result);
  24. }
  25. #else
  26. loff_t lseek64(int fd, loff_t offset, int whence)
  27. {
  28. return (loff_t)(lseek(fd, (off_t) (offset), whence));
  29. }
  30. #endif
  31. #ifndef __LINUXTHREADS_OLD__
  32. libc_hidden_def(lseek64)
  33. #else
  34. libc_hidden_weak(lseek64)
  35. strong_alias(lseek64,__libc_lseek64)
  36. #endif