lstat64.c 1.0 KB

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