stat64.c 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * stat64() 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 <_lfs_64.h>
  10. #include <sys/syscall.h>
  11. #include <sys/stat.h>
  12. #if defined __NR_fstatat64 && !defined __NR_stat64
  13. #include <fcntl.h>
  14. #include <unistd.h>
  15. int stat64(const char *file_name, struct stat64 *buf)
  16. {
  17. return fstatat64(AT_FDCWD, file_name, buf, 0);
  18. }
  19. libc_hidden_def(stat64)
  20. /* For systems which have both, prefer the old one */
  21. # elif defined __NR_stat64
  22. # define __NR___syscall_stat64 __NR_stat64
  23. # include "xstatconv.h"
  24. static __always_inline _syscall2(int, __syscall_stat64,
  25. const char *, file_name, struct kernel_stat64 *, buf)
  26. int stat64(const char *file_name, struct stat64 *buf)
  27. {
  28. int result;
  29. struct kernel_stat64 kbuf;
  30. result = __syscall_stat64(file_name, &kbuf);
  31. if (result == 0) {
  32. __xstat64_conv(&kbuf, buf);
  33. }
  34. return result;
  35. }
  36. libc_hidden_def(stat64)
  37. #endif