fstatat.c 869 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * fstatat() 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 <sys/syscall.h>
  9. #include <sys/stat.h>
  10. #include "xstatconv.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. int fstatat(int fd, const char *file, struct stat *buf, int flag)
  17. {
  18. int ret;
  19. # ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
  20. struct kernel_stat64 kbuf;
  21. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
  22. if (ret == 0)
  23. __xstat32_conv(&kbuf, buf);
  24. # else
  25. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
  26. # endif /* __ARCH_HAS_DEPRECATED_SYSCALLS__ */
  27. return ret;
  28. }
  29. libc_hidden_def(fstatat)
  30. #else
  31. /* should add emulation with fstat() and /proc/self/fd/ ... */
  32. #endif