OSDN Git Service

mknod: Use mknodat if arch does not have the mknod syscall
authorMarkos Chandras <markos.chandras@imgtec.com>
Wed, 10 Oct 2012 13:53:41 +0000 (14:53 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 20 Feb 2013 12:45:11 +0000 (13:45 +0100)
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/sysdeps/linux/common/mknod.c

index b52c8c5..416cab6 100644 (file)
 #include <sys/syscall.h>
 #include <sys/stat.h>
 
+#if defined __NR_mknodat && !defined __NR_mknod
+# include <fcntl.h>
+int mknod(const char *path, mode_t mode, dev_t dev)
+{
+       return mknodat(AT_FDCWD, path, mode, dev);
+}
+#else
 int mknod(const char *path, mode_t mode, dev_t dev)
 {
        unsigned long long int k_dev;
@@ -19,4 +26,5 @@ int mknod(const char *path, mode_t mode, dev_t dev)
 
        return INLINE_SYSCALL(mknod, 3, path, mode, (unsigned int)k_dev);
 }
+#endif
 libc_hidden_def(mknod)