From owner-freebsd-emulation@FreeBSD.ORG Fri May 4 09:15:39 2007 Return-Path: X-Original-To: emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6900C16A400 for ; Fri, 4 May 2007 09:15:39 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2-3.pacific.net.au [61.8.2.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3197813C458 for ; Fri, 4 May 2007 09:15:39 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 2BC7C6E35F; Fri, 4 May 2007 19:15:31 +1000 (EST) Received: from besplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 01C208C15; Fri, 4 May 2007 19:15:36 +1000 (EST) Date: Fri, 4 May 2007 19:15:36 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Scot Hetzel In-Reply-To: <790a9fff0705040004oab16ed8q1a1c476386379ea9@mail.gmail.com> Message-ID: <20070504190007.Y37951@besplex.bde.org> References: <790a9fff0705021345j2ad9ae98o56aaf357d556fe27@mail.gmail.com> <790a9fff0705040004oab16ed8q1a1c476386379ea9@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: emulation@FreeBSD.org Subject: Re: linuxolator: LTP lseek03 failure 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: Fri, 04 May 2007 09:15:39 -0000 On Fri, 4 May 2007, Scot Hetzel wrote: > On 5/2/07, Scot Hetzel wrote: >> I have investigated the new LTP test failure for lseek03, and the >> first test sets whence to 4 (SEEK_HOLE): >> >> test 1 lseek(tfile_1554, 1, 4) Failed, errno=25 Inappropriate ioctl >> for device, expected 22(EINVAL) >> > Looking thru -CURRENT, I found that SEEK_HOLE and SEEK_DATA were added > to lseek (sys/kern/vfs_syscalls.c 1.437) on April 5th, 2007 by pjd as > a requirement for the ZFS implementation. The main bug is in the implementation of SEEK_HOLE and SEEK_DATA. This uses fo_ioctl() and fo_ioctl() returns ENOTTY if the file system doesn't support these seeks, but ENOTTY (Inappropriate ioctl for device) is a very inappropriate errno for a syscall that is not ioctl(), especially on a file that is not a device. POSIX requires EINVAL if the `whence' arg is not a standard POSIX one, and I think ENOTTY should be translated to this. If the test is run on a file system that supports these seeks, then whence = 4 wouldn't fail natively, and I think it should only fail for emulators that are supposed to be perfectly compatible, which the Linux emulator isn't. (It would be impossible in practice to even find all native features that the system being emulated doesn't have, and more impossible to turn them all off.) Bruce