From: Andries.Brouwer@cwi.nl The patch below adds a new system call mknod64 for i386. If there are no objections I'll add it to the other architectures as well. Note that the prototype is mknod64(const char *name, int mode, unsigned int devhi, unsigned int devlo) (and not ... unsigned int major, unsigned int minor). arch/i386/kernel/entry.S | 3 ++- fs/namei.c | 28 +++++++++++++++++++++++++--- include/asm-i386/unistd.h | 3 ++- 3 files changed, 29 insertions(+), 5 deletions(-) diff -puN arch/i386/kernel/entry.S~ia32-mknod64 arch/i386/kernel/entry.S --- 25/arch/i386/kernel/entry.S~ia32-mknod64 2003-07-04 22:23:24.000000000 -0700 +++ 25-akpm/arch/i386/kernel/entry.S 2003-07-04 22:23:24.000000000 -0700 @@ -902,5 +902,6 @@ ENTRY(sys_call_table) .long sys_clock_nanosleep .long sys_statfs64 .long sys_fstatfs64 - + .long sys_mknod64 /* 270 */ + nr_syscalls=(.-sys_call_table)/4 diff -puN fs/namei.c~ia32-mknod64 fs/namei.c --- 25/fs/namei.c~ia32-mknod64 2003-07-04 22:23:24.000000000 -0700 +++ 25-akpm/fs/namei.c 2003-07-04 22:23:24.000000000 -0700 @@ -1424,11 +1424,12 @@ int vfs_mknod(struct inode *dir, struct return error; } -asmlinkage long sys_mknod(const char __user * filename, int mode, dev_t dev) +static long +do_mknod(const char __user *filename, int mode, dev_t dev) { int error = 0; - char * tmp; - struct dentry * dentry; + char *tmp; + struct dentry *dentry; struct nameidata nd; if (S_ISDIR(mode)) @@ -1469,6 +1470,27 @@ out: return error; } +asmlinkage long +sys_mknod(const char __user *filename, int mode, unsigned int devnr) +{ + dev_t dev = devnr; + + if (dev != devnr) + return -EOVERFLOW; + return do_mknod(filename, mode, dev); +} + +asmlinkage long +sys_mknod64(const char __user *filename, int mode, + unsigned int major, unsigned int minor) +{ + dev_t dev = MKDEV(major, minor); + + if (MAJOR(dev) != major || MINOR(dev) != minor) + return -EOVERFLOW; + return do_mknod(filename, mode, dev); +} + int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) { int error = may_create(dir, dentry, NULL); diff -puN include/asm-i386/unistd.h~ia32-mknod64 include/asm-i386/unistd.h --- 25/include/asm-i386/unistd.h~ia32-mknod64 2003-07-04 22:23:24.000000000 -0700 +++ 25-akpm/include/asm-i386/unistd.h 2003-07-04 22:23:24.000000000 -0700 @@ -275,8 +275,9 @@ #define __NR_clock_nanosleep (__NR_timer_create+8) #define __NR_statfs64 268 #define __NR_fstatfs64 269 +#define __NR_mknod64 270 -#define NR_syscalls 270 +#define NR_syscalls 271 /* user-visible error numbers are in the range -1 - -124: see */ _