1 /*
2  * mknod() for uClibc
3  *
4  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7  */
8 
9 #include <sys/syscall.h>
10 #include <sys/stat.h>
11 
12 #if defined __NR_mknodat && !defined __NR_mknod
13 # include <fcntl.h>
mknod(const char * path,mode_t mode,dev_t dev)14 int mknod(const char *path, mode_t mode, dev_t dev)
15 {
16 	return mknodat(AT_FDCWD, path, mode, dev);
17 }
18 #else
mknod(const char * path,mode_t mode,dev_t dev)19 int mknod(const char *path, mode_t mode, dev_t dev)
20 {
21 	unsigned long long int k_dev;
22 
23 	/* We must convert the value to dev_t type used by the kernel.  */
24 	k_dev = (dev) & ((1ULL << 32) - 1);
25 
26 	if (k_dev != dev) {
27 		__set_errno(EINVAL);
28 		return -1;
29 	}
30 	return INLINE_SYSCALL(mknod, 3, path, mode, (unsigned int)k_dev);
31 }
32 #endif
33 libc_hidden_def(mknod)
34