From owner-freebsd-emulation@FreeBSD.ORG Fri May 4 15:19:57 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 AF53916A402 for ; Fri, 4 May 2007 15:19:57 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247]) by mx1.freebsd.org (Postfix) with ESMTP id 6C5B013C484 for ; Fri, 4 May 2007 15:19:57 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: by an-out-0708.google.com with SMTP id c24so909105ana for ; Fri, 04 May 2007 08:19:56 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QTQ7CI6DgAX0YCkmHF3bZhHb5FCarIzyTUVXb+rqJe0nxJq5o3w/OjTVKEvuyAiyB1Za3fBlrBYJI8k34gHEnpvBXs2a15eq3Lz5QE6gvRtr48lXL51K+s7NmfZg8KWJvRBLSQUXAulWcQ+i/CXlBIlwPp8uW/fQd/AWnzASdII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Smp+tEr42BL0qP9mX/8IzXd9rNk2wmwV0IohZjBbb0SVKM5JikcKnhThUppl6E39ohE7i6tQXo+J1sCsYgHRdelrMKf4Ims29J1uiA+l+hJn5lyNzc6SCgMphyXvEdkVc2Gno0o9MXsg9QezwLJ+Kaixcse/fV57MPUpVuVn+0Q= Received: by 10.100.133.9 with SMTP id g9mr2798432and.1178291996430; Fri, 04 May 2007 08:19:56 -0700 (PDT) Received: by 10.100.141.14 with HTTP; Fri, 4 May 2007 08:19:56 -0700 (PDT) Message-ID: <790a9fff0705040819u24e4c2f0s5c9fc34b93770e13@mail.gmail.com> Date: Fri, 4 May 2007 10:19:56 -0500 From: "Scot Hetzel" To: "Bruce Evans" In-Reply-To: <20070504190007.Y37951@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <790a9fff0705021345j2ad9ae98o56aaf357d556fe27@mail.gmail.com> <790a9fff0705040004oab16ed8q1a1c476386379ea9@mail.gmail.com> <20070504190007.Y37951@besplex.bde.org> 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 15:19:57 -0000 On 5/4/07, Bruce Evans wrote: > 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. > I see three places where this could be fixed: kern/vfs_vnops.c:vn_ioctl(...) kern/vfs_syscalls.c:lseek(...) compat/linux/linux_file.c:(linux_lseek and linux_llseek) Would the best fix be to change the native lseek to return EINVAL when fo_ioctl returns ENOTTY? Scot -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.