From owner-freebsd-emulation@FreeBSD.ORG Wed Nov 8 23:45:00 2006 Return-Path: X-Original-To: freebsd-emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1BA7716A40F for ; Wed, 8 Nov 2006 23:45:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BA1443D46 for ; Wed, 8 Nov 2006 23:44:58 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id kA8NivDr038549 for ; Wed, 8 Nov 2006 18:44:57 -0500 (EST) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-emulation@FreeBSD.org Date: Wed, 8 Nov 2006 18:44:42 -0500 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_svmUFOyRrFvyJPN" Message-Id: <200611081844.44550.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88.6/2177/Wed Nov 8 11:10:40 2006 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Subject: [PATCH] fixes for LTP mknod01, mknod07 and mknod09 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2006 23:45:00 -0000 --Boundary-00=_svmUFOyRrFvyJPN Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch fixes LTP mknod01, mknod07 and mknod09. This is not a critical fix but it fixes a very annoying problem, i.e., LTP leaves a corrupt directory after each run. # rm -rf mknAawlFy rm: mknAawlFy/tnode: Bad file descriptor rm: mknAawlFy: Directory not empty # ls -al mknAawlFy ls: tnode: Bad file descriptor total 4 drwxrwxrwx 2 root wheel 512 11 7 17:06 . drwxrwxrwt 12 root wheel 512 11 8 18:41 .. Jung-uk Kim --Boundary-00=_svmUFOyRrFvyJPN Content-Type: text/x-diff; charset="iso-8859-1"; name="linux_misc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux_misc.diff" --- src/sys/compat/linux/linux_misc.c.orig Tue Nov 7 17:46:33 2006 +++ src/sys/compat/linux/linux_misc.c Wed Nov 8 18:11:38 2006 @@ -890,11 +890,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); } --Boundary-00=_svmUFOyRrFvyJPN--