Date: Thu, 9 Nov 2006 23:31:53 GMT From: Jung-uk Kim <jkim@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 109653 for review Message-ID: <200611092331.kA9NVrkK033258@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109653 Change 109653 by jkim@jkim_hammer on 2006/11/09 23:31:05 Linux mknod(2) can open any files, not just char/block or fifo files. This fixes LTP test case mknod01, mknod07 and mknod09. Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#30 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#30 (text+ko) ==== @@ -891,11 +891,34 @@ printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev); #endif - if (S_ISFIFO(args->mode)) + switch (args->mode & S_IFMT) { + case S_IFIFO: + case S_IFSOCK: error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode); - else + break; + + case S_IFCHR: + case S_IFBLK: error = kern_mknod(td, path, UIO_SYSSPACE, args->mode, args->dev); + break; + + case S_IFDIR: + error = EPERM; + break; + + case 0: + args->mode |= S_IFREG; + /* fall through */ + case S_IFREG: + error = kern_open(td, path, UIO_SYSSPACE, + O_WRONLY | O_CREAT | O_TRUNC, args->mode); + break; + + default: + error = EINVAL; + break; + } LFREEPATH(path); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611092331.kA9NVrkK033258>