lstat.c 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * lstat() 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. /* need to hide the 64bit prototype or the weak_alias()
  10. * will fail when __NR_lstat64 doesnt exist */
  11. #define lstat64 __hidelstat64
  12. #include "syscalls.h"
  13. #include <unistd.h>
  14. #include <sys/stat.h>
  15. #include "xstatconv.h"
  16. #undef lstat64
  17. libc_hidden_proto(lstat)
  18. #define __NR___syscall_lstat __NR_lstat
  19. static inline _syscall2(int, __syscall_lstat,
  20. const char *, file_name, struct kernel_stat *, buf);
  21. int lstat(const char *file_name, struct stat *buf)
  22. {
  23. int result;
  24. struct kernel_stat kbuf;
  25. result = __syscall_lstat(file_name, &kbuf);
  26. if (result == 0) {
  27. __xstat_conv(&kbuf, buf);
  28. }
  29. return result;
  30. }
  31. libc_hidden_def(lstat)
  32. #if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
  33. libc_hidden_proto(lstat64)
  34. strong_alias(lstat,lstat64)
  35. libc_hidden_def(lstat64)
  36. #endif