mknod.c 716 B

12345678910111213141516171819202122232425262728
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * mknod() 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/stat.h>
  11. #include <sys/sysmacros.h>
  12. libc_hidden_proto(mknod)
  13. #define __NR___syscall_mknod __NR_mknod
  14. static inline _syscall3(int, __syscall_mknod, const char *, path,
  15. __kernel_mode_t, mode, __kernel_dev_t, dev);
  16. int mknod(const char *path, mode_t mode, dev_t dev)
  17. {
  18. /* We must convert the dev_t value to a __kernel_dev_t */
  19. __kernel_dev_t k_dev;
  20. k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
  21. return __syscall_mknod(path, mode, k_dev);
  22. }
  23. libc_hidden_def(mknod)