fstatat.c 668 B

1234567891011121314151617181920212223242526272829303132
  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. #ifdef __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. struct kernel_stat64 kbuf;
  20. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
  21. if (ret == 0)
  22. __xstat32_conv(&kbuf, buf);
  23. return ret;
  24. }
  25. #else
  26. /* should add emulation with fstat() and /proc/self/fd/ ... */
  27. #endif