Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261752AbUCVGOc (ORCPT ); Mon, 22 Mar 2004 01:14:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261756AbUCVGOc (ORCPT ); Mon, 22 Mar 2004 01:14:32 -0500 Received: from ns.suse.de ([195.135.220.2]:40416 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S261752AbUCVGOa (ORCPT ); Mon, 22 Mar 2004 01:14:30 -0500 Date: Mon, 22 Mar 2004 07:14:25 +0100 From: Andi Kleen To: Andrew Morton Cc: marcelo.tosatti@cyclades.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance Message-Id: <20040322071425.3cd57aca.ak@suse.de> In-Reply-To: <20040321213944.2fdb980d.akpm@osdl.org> References: <20040322051318.597ad1f9.ak@suse.de> <20040321213944.2fdb980d.akpm@osdl.org> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1918 Lines: 55 On Sun, 21 Mar 2004 21:39:44 -0800 Andrew Morton wrote: > Andi Kleen wrote: > > > > > > On 64bit architectures open() sets O_LARGEFILE implicitely. This causes the LSB > > testsuite to fail, which checks that F_GETFL only returns the flags set by > > a previous open. > > > > According to the POSIX standards gurus the Linux behaviour is not compliant. > > > > This patch fixes this by just not reporting O_LARGEFILE in F_GETFL. > > > > This has been in several shipping SuSE releases and the x86-64.org CVS > > treee for a long time, so is unlikely to break anything. > > > > -Andi > > > > diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c > > --- linux-2.4.26-pre5/fs/fcntl.c 2004-01-13 10:29:17.000000000 +0100 > > +++ linux-merge/fs/fcntl.c 2003-10-23 15:40:52.000000000 +0200 > > @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un > > set_close_on_exec(fd, arg&1); > > break; > > case F_GETFL: > > - err = filp->f_flags; > > + err = filp->f_flags & ~O_LARGEFILE; > > break; > > case F_SETFL: > > lock_kernel(); > > eh? If the application on a 64-bit box does > > open("foo", O_LARGEFILE|O_RDWR); > > then a subsequent F_GETFL will now return just O_RDWR, will it not? So > it's still posixly incorrect? No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.) > I think open() needs to set O_KERNEL_LARGEFILE, and we mask that off in > F_GETFL, and test for (O_LARGEFILE|O_KERNEL_LARGEFILE) everywhere. That would be the best solution, agreed But it would be a lot more intrusive because all file systems need to be audited and fixed. -Andi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/