fstat.c 751 B

12345678910111213141516171819202122232425262728293031323334
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * fstat() 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 <sys/syscall.h>
  10. #include <unistd.h>
  11. #include <sys/stat.h>
  12. #include "xstatconv.h"
  13. #define __NR___syscall_fstat __NR_fstat
  14. static __inline__ _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf)
  15. int fstat(int fd, struct stat *buf)
  16. {
  17. int result;
  18. struct kernel_stat kbuf;
  19. result = __syscall_fstat(fd, &kbuf);
  20. if (result == 0) {
  21. __xstat_conv(&kbuf, buf);
  22. }
  23. return result;
  24. }
  25. libc_hidden_def(fstat)
  26. #if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
  27. strong_alias_untyped(fstat,fstat64)
  28. libc_hidden_def(fstat64)
  29. #endif