fstatat64.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * fstatat64() for uClibc
  3. *
  4. * Copyright (C) 2009 Analog Devices Inc.
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <_lfs_64.h>
  9. #include <bits/wordsize.h>
  10. #include <sys/syscall.h>
  11. #if defined __mips__
  12. # include <sgidefs.h>
  13. #endif
  14. /* 64bit ports tend to favor newfstatat() */
  15. #if __WORDSIZE == 64 && defined __NR_newfstatat
  16. # define __NR_fstatat64 __NR_newfstatat
  17. #endif
  18. /* mips N32 ABI use newfstatat(), too */
  19. #if defined __mips__ && _MIPS_SIM == _ABIN32
  20. # define __NR_fstatat64 __NR_newfstatat
  21. #endif
  22. #ifdef __NR_fstatat64
  23. # include <sys/stat.h>
  24. # include "xstatconv.h"
  25. int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
  26. {
  27. # ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
  28. int ret;
  29. struct kernel_stat64 kbuf;
  30. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
  31. if (ret == 0)
  32. __xstat64_conv(&kbuf, buf);
  33. return ret;
  34. # else
  35. return INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
  36. # endif
  37. }
  38. libc_hidden_def(fstatat64)
  39. #else
  40. /* should add emulation with fstat64() and /proc/self/fd/ ... */
  41. #endif