fstatat64.c 893 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. /* 64bit ports tend to favor newfstatat() */
  12. #if __WORDSIZE == 64 && defined __NR_newfstatat
  13. # define __NR_fstatat64 __NR_newfstatat
  14. #endif
  15. #ifdef __NR_fstatat64
  16. # include <sys/stat.h>
  17. # include "xstatconv.h"
  18. int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
  19. {
  20. # ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
  21. int ret;
  22. struct kernel_stat64 kbuf;
  23. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
  24. if (ret == 0)
  25. __xstat64_conv(&kbuf, buf);
  26. return ret;
  27. # else
  28. return INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
  29. # endif
  30. }
  31. libc_hidden_def(fstatat64)
  32. #else
  33. /* should add emulation with fstat64() and /proc/self/fd/ ... */
  34. #endif