ustat.c 637 B

12345678910111213141516171819202122232425
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * ustat() 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 "syscalls.h"
  10. #include <sys/ustat.h>
  11. #include <sys/sysmacros.h>
  12. #define __NR___syscall_ustat __NR_ustat
  13. static inline _syscall2(int, __syscall_ustat,
  14. unsigned short int, kdev_t, struct ustat *, ubuf);
  15. int ustat(dev_t dev, struct ustat *ubuf)
  16. {
  17. /* We must convert the dev_t value to a __kernel_dev_t */
  18. __kernel_dev_t k_dev;
  19. k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
  20. return __syscall_ustat(k_dev, ubuf);
  21. }