lstat.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * lstat() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. /* need to hide the 64bit prototype or the weak_alias()
  10. * will fail when __NR_lstat64 doesnt exist */
  11. #define __lstat64 __hide__lstat64
  12. #include "syscalls.h"
  13. #include <unistd.h>
  14. #define _SYS_STAT_H
  15. #include <bits/stat.h>
  16. #include <bits/kernel_stat.h>
  17. #include "xstatconv.h"
  18. #undef __lstat64
  19. #define __NR___syscall_lstat __NR_lstat
  20. #undef __lstat
  21. #undef lstat
  22. static inline _syscall2(int, __syscall_lstat,
  23. const char *, file_name, struct kernel_stat *, buf);
  24. int attribute_hidden __lstat(const char *file_name, struct stat *buf)
  25. {
  26. int result;
  27. struct kernel_stat kbuf;
  28. result = __syscall_lstat(file_name, &kbuf);
  29. if (result == 0) {
  30. __xstat_conv(&kbuf, buf);
  31. }
  32. return result;
  33. }
  34. strong_alias(__lstat,lstat)
  35. #if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
  36. hidden_strong_alias(__lstat,__lstat64)
  37. weak_alias(lstat,lstat64)
  38. #endif