mknod.c 662 B

12345678910111213141516171819202122232425
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * mknod() 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. #include "syscalls.h"
  10. #include <sys/stat.h>
  11. #include <sys/sysmacros.h>
  12. #define __NR___syscall_mknod __NR_mknod
  13. static inline _syscall3(int, __syscall_mknod, const char *, path,
  14. __kernel_mode_t, mode, __kernel_dev_t, dev);
  15. int mknod(const char *path, mode_t mode, dev_t dev)
  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_mknod(path, mode, k_dev);
  21. }