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). 25-akpm/arch/i386/kernel/entry.S | 1 + 25-akpm/fs/namei.c | 28 +++++++++++++++++++++++++--- 25-akpm/include/asm-i386/unistd.h | 3 ++- 3 files changed, 28 insertions(+), 4 deletions(-) diff -puN arch/i386/kernel/entry.S~ia32-mknod64 arch/i386/kernel/entry.S --- 25/arch/i386/kernel/entry.S~ia32-mknod64 Mon May 19 16:35:50 2003 +++ 25-akpm/arch/i386/kernel/entry.S Mon May 19 16:35:50 2003 @@ -891,6 +891,7 @@ ENTRY(sys_call_table) .long sys_clock_gettime /* 265 */ .long sys_clock_getres .long sys_clock_nanosleep + .long sys_mknod64 nr_syscalls=(.-sys_call_table)/4 diff -puN fs/namei.c~ia32-mknod64 fs/namei.c --- 25/fs/namei.c~ia32-mknod64 Mon May 19 16:35:50 2003 +++ 25-akpm/fs/namei.c Mon May 19 16:35:50 2003 @@ -1403,11 +1403,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)) @@ -1448,6 +1449,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); diff -puN include/asm-i386/unistd.h~ia32-mknod64 include/asm-i386/unistd.h --- 25/include/asm-i386/unistd.h~ia32-mknod64 Mon May 19 16:35:50 2003 +++ 25-akpm/include/asm-i386/unistd.h Mon May 19 16:35:50 2003 @@ -273,8 +273,9 @@ #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_sys_mknod64 268 -#define NR_syscalls 268 +#define NR_syscalls 269 /* user-visible error numbers are in the range -1 - -124: see */ _