From owner-p4-projects@FreeBSD.ORG Thu Nov 9 23:31:54 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6DAC116A47B; Thu, 9 Nov 2006 23:31:54 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3068916A407 for ; Thu, 9 Nov 2006 23:31:54 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5626743D58 for ; Thu, 9 Nov 2006 23:31:53 +0000 (GMT) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kA9NVriY033267 for ; Thu, 9 Nov 2006 23:31:53 GMT (envelope-from jkim@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kA9NVrkK033258 for perforce@freebsd.org; Thu, 9 Nov 2006 23:31:53 GMT (envelope-from jkim@freebsd.org) Date: Thu, 9 Nov 2006 23:31:53 GMT Message-Id: <200611092331.kA9NVrkK033258@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jkim@freebsd.org using -f From: Jung-uk Kim To: Perforce Change Reviews Cc: Subject: PERFORCE change 109653 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2006 23:31:54 -0000 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); }