mknod.c 634 B

123456789101112131415161718192021222324
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * mknod() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <sys/stat.h>
  11. #define __NR___syscall_mknod __NR_mknod
  12. static inline _syscall3(int, __syscall_mknod, const char *, path,
  13. __kernel_mode_t, mode, __kernel_dev_t, dev);
  14. int mknod(const char *path, mode_t mode, dev_t dev)
  15. {
  16. /* We must convert the dev_t value to a __kernel_dev_t */
  17. __kernel_dev_t k_dev;
  18. k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
  19. return __syscall_mknod(path, mode, k_dev);
  20. }