Skip to contentSkip to conversation

Drop O_LARGEFILE from F_GETFL for POSIX compliance

PATCH In review Andi Kleen 5 participants 10 messages Mar 22, 2004

Subsystems (8)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Drop O_LARGEFILE from F_GETFL for POSIX compliance

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

fs/fcntl.c +1 -1
diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
@@ -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();
#1 lore raw

fs/fcntl.c static long do_fcntl(unsigned int fd, un · line 277

Quoted 12 lines · Andi Kleen

diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c

fs/fcntl.c +1 -1
@@ -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();

Shouldn't this be guarded by #if BITS_PER_LONG != 32, like sys_open?

#2 lore raw
In reply to Andi Kleen
Quoted 18 lines · Andi Kleen

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

fs/fcntl.c static long do_fcntl(unsigned int fd, un

Quoted 9 lines
fs/fcntl.c +1 -2
@@ -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();
-

in my 2.4 tree I have this one instead (written in oct 2002):

fs/fcntl.c renamed from fs/fcntl.c.~1~ +4 -0
@@ -277,7 +277,11 @@ static long do_fcntl(unsigned int fd, un
 			set_close_on_exec(fd, arg&1);
 			break;
 		case F_GETFL:
+#if BITS_PER_LONG != 32
+			err = filp->f_flags & ~O_LARGEFILE;
+#else
 			err = filp->f_flags;
+#endif
 			break;
 		case F_SETFL:
 			err = setfl(fd, filp, arg);

32bit archs needs to get O_LARGEFILE in return from getfl (if they set it [it's not set implicitly in 32bit archs] they will be able to handle it transparently in glibc too, and I believe they really want it). 64bit archs not, hence the fix.

author
#3 lore raw
Quoted 4 lines · On Mon, 22 Mar 2004 05:34:54 +0100 Andrea Arcangeli <[email protected]> wrote:

32bit archs needs to get O_LARGEFILE in return from getfl (if they set it [it's not set implicitly in 32bit archs] they will be able to handle it transparently in glibc too, and I believe they really want it). 64bit archs not, hence the fix.

If 32bit archs need it then 64bit archs need it too (think 32bit emulated processes on 64bit jernels) But I think in practice it doesn't matter, so I would prefer to be consistent between 32bit and 64bit.

I don't feel very strongly about this however ...

-Andi

#4 lore raw
Quoted 9 lines · Andi Kleen
Quoted 4 lines · On Mon, 22 Mar 2004 05:34:54 +0100 Andrea Arcangeli <[email protected]> wrote:

32bit archs needs to get O_LARGEFILE in return from getfl (if they set it [it's not set implicitly in 32bit archs] they will be able to handle it transparently in glibc too, and I believe they really want it). 64bit archs not, hence the fix.

Quoted 5 lines

If 32bit archs need it then 64bit archs need it too (think 32bit emulated processes on 64bit jernels) But I think in practice it doesn't matter, so I would prefer to be consistent between 32bit and 64bit.

I don't feel very strongly about this however ...

I agree it'd be a lot simpler to handle 32bit user on 64bit kernel if we can clear it unconditionally (otherwise we've to trap getfl with a ia32 wrapper) but I'm afraid the api may break if we clear that bit unconditionally. I can't tell you for sure by memory though because the last time I worked on this was one year and half ago and this is really a matter of API. We should ask the glibc people for another confirmation before choosing if to clear it only in 64bit archs or in 32bit too.

#5 lore raw
In reply to Andi Kleen
Quoted 19 lines · Andi Kleen

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

fs/fcntl.c static long do_fcntl(unsigned int fd, un · line 277

Quoted 8 lines
fs/fcntl.c +1 -1
@@ -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?

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.

author
#6 lore raw
Quoted 31 lines · On Sun, 21 Mar 2004 21:39:44 -0800 Andrew Morton <[email protected]> wrote:
Quoted 19 lines · Andi Kleen

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

fs/fcntl.c static long do_fcntl(unsigned int fd, un · line 277

Quoted 8 lines
fs/fcntl.c +1 -1
@@ -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

Quoted 4 lines
	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.)

Quoted 2 lines

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

#7 lore raw
Quoted 1 line · Andi Kleen

No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)

What are you talking about? Neither O_LARGEFILE nor open64 is in POSIX.
But both are in the LFS extensions.

This whole change seems dubious at best. Who has argued that O_LARGEFILE mustn't be returned? I do not agree at all. If the test suite checks this the author must defend the position.

I suggest to not make any changes. It is perfectly OK to define new O_ flags and the open() specification does not require that none of them must set implicitly.

Signature · 1 line
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
author
#8 lore raw
Quoted 10 lines · On Sun, 21 Mar 2004 23:04:44 -0800 Ulrich Drepper <[email protected]> wrote:
Quoted 1 line · Andi Kleen

No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)

What are you talking about? Neither O_LARGEFILE nor open64 is in POSIX.
But both are in the LFS extensions.

This whole change seems dubious at best. Who has argued that O_LARGEFILE mustn't be returned? I do not agree at all. If the test suite checks this the author must defend the position.

I complained to this to the Austin group people at that point
and Andrew Josey told me that the issue has been discussed and the comittee ruled that the Linux behaviour was not compliant I didn't inquire about the details (standardeese bores me), ask him himself.

Quoted 3 lines

I suggest to not make any changes. It is perfectly OK to define new O_ flags and the open() specification does not require that none of them must set implicitly.

Just the LSB test suite won't pass then.

-Andi

#9 lore raw
In reply to Andi Kleen
Quoted 14 lines · Andi Kleen
Quoted 14 lines

Review static long do_fcntl(unsigned int fd, un · line 277

Quoted 11 lines

+++ linux-merge/fs/fcntl.c 2003-10-23 15:40:52.000000000 +0200

(quoted diff) +1 -1
@@ -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

Quoted 7 lines
Quoted 4 lines
	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.)

But doesn't glibc implement open64() by adding O_LARGEFILE? If so then an F_GETFL will return O_LARGEFILE even though the caller didn't supply it. Unless glibc jumps through hoops.

Which it does not:

#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>

main()

{
	int fd;
	int flags;

	fd = open64("foo", O_RDONLY);
	if (fd < 0)
		perror("open");
	flags = fcntl(fd, F_GETFL);
	printf("supplied %o, received %o\n", O_RDONLY, flags);
}

bix:/home/akpm> ./a.out
supplied 0, received 100000

I guess your test suite forgot to test that ;)

Quoted 6 lines
Quoted 2 lines

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.

Only weirdo filesystems go looking at O_LARGEFILE (hi, sgi). Oh, and ext3 too, although that looks bogus.

Here's a 2.6 patch.

---

 25-akpm/arch/ia64/ia32/sys_ia32.c     |    3 +-
 25-akpm/arch/ppc64/kernel/sys_ppc32.c |    2 -
 25-akpm/arch/x86_64/ia32/sys_ia32.c   |    2 -
 25-akpm/fs/block_dev.c                |    2 -
 25-akpm/fs/exec.c                     |    3 +-
 25-akpm/fs/ext3/file.c                |    6 ++--
 25-akpm/fs/fcntl.c                    |    2 -
 25-akpm/fs/ncpfs/file.c               |    3 +-
 25-akpm/fs/nfsd/vfs.c                 |    4 +--
 25-akpm/fs/open.c                     |   12 ++++-----
 25-akpm/fs/udf/file.c                 |    5 ++-
 25-akpm/fs/xfs/linux/xfs_file.c       |    3 +-
 25-akpm/fs/xfs/linux/xfs_ioctl.c      |    2 -
 25-akpm/include/asm-alpha/fcntl.h     |   37 ++++++++++++++-------------
 25-akpm/include/asm-arm/fcntl.h       |   35 +++++++++++++-------------
 25-akpm/include/asm-arm26/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-cris/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-h8300/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-i386/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-ia64/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-m68k/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-mips/fcntl.h      |   33 ++++++++++++------------
 25-akpm/include/asm-parisc/fcntl.h    |   45 +++++++++++++++++-----------------
 25-akpm/include/asm-ppc/fcntl.h       |   35 +++++++++++++-------------
 25-akpm/include/asm-ppc64/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-s390/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-sh/fcntl.h        |   35 +++++++++++++-------------
 25-akpm/include/asm-sparc/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-sparc64/fcntl.h   |   36 +++++++++++++--------------
 25-akpm/include/asm-v850/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-x86_64/fcntl.h    |   35 +++++++++++++-------------
 25-akpm/mm/filemap.c                  |    2 -
 arch/sparc64/kernel/sys_sparc32.c     |    0 
 arch/sparc64/solaris/fs.c             |    0 
 drivers/usb/gadget/file_storage.c     |    0 
 fs/cifs/file.c                        |    0 
 36 files changed, 357 insertions(+), 335 deletions(-)

diff -puN arch/sparc64/kernel/sys_sparc32.c~O_LARGEFILE-fix arch/sparc64/kernel/sys_sparc32.c diff -puN arch/sparc64/solaris/fs.c~O_LARGEFILE-fix arch/sparc64/solaris/fs.c

arch/ia64/ia32/sys_ia32.c renamed from arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix +2 -1
diff -puN arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/ia64/ia32/sys_ia32.c
@@ -2106,7 +2106,8 @@ sys32_brk (unsigned int brk)
 }
 
 /*
- * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
+ * Exactly like fs/open.c:sys_open(), except that it doesn't set the
+ * O_KERNEL_LARGEFILE flag.
  */
 asmlinkage long
 sys32_open (const char * filename, int flags, int mode)
arch/ppc64/kernel/sys_ppc32.c renamed from arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix +1 -1
diff -puN arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix arch/ppc64/kernel/sys_ppc32.c
@@ -2399,7 +2399,7 @@ off_t ppc32_lseek(unsigned int fd, u32 o
 
 /*
  * This is just a version for 32-bit applications which does
- * not force O_LARGEFILE on.
+ * not force O_KERNEL_LARGEFILE on.
  */
 long sys32_open(const char * filename, int flags, int mode)
 {
arch/x86_64/ia32/sys_ia32.c renamed from arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix +1 -1
diff -puN arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/x86_64/ia32/sys_ia32.c
@@ -1783,7 +1783,7 @@ asmlinkage long sys32_open(const char * 
 	char * tmp;
 	int fd, error;
 
-	/* don't force O_LARGEFILE */
+	/* don't force O_KERNEL_LARGEFILE */
 	tmp = getname(filename);
 	fd = PTR_ERR(tmp);
 	if (!IS_ERR(tmp)) {

diff -puN drivers/usb/gadget/file_storage.c~O_LARGEFILE-fix drivers/usb/gadget/file_storage.c

include/asm-ppc64/fcntl.h renamed from include/asm-ppc64/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-ppc64/fcntl.h~O_LARGEFILE-fix include/asm-ppc64/fcntl.h
@@ -10,23 +10,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY      040000	/* must be a directory */
-#define O_NOFOLLOW      0100000	/* don't follow links */
-#define O_LARGEFILE     0200000
-#define O_DIRECT	0400000	/* direct disk access hint */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY          040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_LARGEFILE         0200000
+#define O_DIRECT	    0400000	/* direct disk access hint */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-x86_64/fcntl.h renamed from include/asm-x86_64/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-x86_64/fcntl.h~O_LARGEFILE-fix include/asm-x86_64/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-ppc/fcntl.h renamed from include/asm-ppc/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-ppc/fcntl.h~O_LARGEFILE-fix include/asm-ppc/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY      040000	/* must be a directory */
-#define O_NOFOLLOW      0100000	/* don't follow links */
-#define O_LARGEFILE     0200000
-#define O_DIRECT	0400000	/* direct disk access hint */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY          040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_LARGEFILE         0200000
+#define O_DIRECT	    0400000	/* direct disk access hint */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-m68k/fcntl.h renamed from include/asm-m68k/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-m68k/fcntl.h~O_LARGEFILE-fix include/asm-m68k/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		      0100	/* not fcntl */
+#define O_EXCL		      0200	/* not fcntl */
+#define O_NOCTTY	      0400	/* not fcntl */
+#define O_TRUNC		     01000	/* not fcntl */
+#define O_APPEND	     02000
+#define O_NONBLOCK	     04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    010000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-ia64/fcntl.h renamed from include/asm-ia64/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-ia64/fcntl.h~O_LARGEFILE-fix include/asm-ia64/fcntl.h
@@ -11,23 +11,24 @@
  * open/fcntl - O_SYNC is only implemented on blocks devices and on
  * files located on an ext2 file system
  */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-parisc/fcntl.h renamed from include/asm-parisc/fcntl.h~O_LARGEFILE-fix +23 -22

51 lines not on this page · raw message

include/asm-arm/fcntl.h renamed from include/asm-arm/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-arm/fcntl.h~O_LARGEFILE-fix include/asm-arm/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	 040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-mips/fcntl.h renamed from include/asm-mips/fcntl.h~O_LARGEFILE-fix +17 -16
diff -puN include/asm-mips/fcntl.h~O_LARGEFILE-fix include/asm-mips/fcntl.h
@@ -10,22 +10,23 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	0x0003
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_APPEND	0x0008
-#define O_SYNC		0x0010
-#define O_NONBLOCK	0x0080
-#define O_CREAT         0x0100	/* not fcntl */
-#define O_TRUNC		0x0200	/* not fcntl */
-#define O_EXCL		0x0400	/* not fcntl */
-#define O_NOCTTY	0x0800	/* not fcntl */
-#define FASYNC		0x1000	/* fcntl, for BSD compatibility */
-#define O_LARGEFILE	0x2000	/* allow large file opens */
-#define O_DIRECT	0x8000	/* direct disk access hint */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
+#define O_ACCMODE		0x0003
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_APPEND		0x0008
+#define O_SYNC			0x0010
+#define O_NONBLOCK		0x0080
+#define O_CREAT         	0x0100	/* not fcntl */
+#define O_TRUNC			0x0200	/* not fcntl */
+#define O_EXCL			0x0400	/* not fcntl */
+#define O_NOCTTY		0x0800	/* not fcntl */
+#define FASYNC			0x1000	/* fcntl, for BSD compatibility */
+#define O_LARGEFILE		0x2000	/* allow large file opens */
+#define O_DIRECT		0x8000	/* direct disk access hint */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_KERNEL_LARGEFILE	0x40000	/* kernel-internal large file hint */
 
 #define O_NDELAY	O_NONBLOCK
 
include/asm-sparc/fcntl.h renamed from include/asm-sparc/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-sparc/fcntl.h~O_LARGEFILE-fix include/asm-sparc/fcntl.h
@@ -4,23 +4,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_ACCMODE	0x0003
-#define O_APPEND	0x0008
-#define FASYNC		0x0040	/* fcntl, for BSD compatibility */
-#define O_CREAT		0x0200	/* not fcntl */
-#define O_TRUNC		0x0400	/* not fcntl */
-#define O_EXCL		0x0800	/* not fcntl */
-#define O_SYNC		0x2000
-#define O_NONBLOCK	0x4000
-#define O_NDELAY	(0x0004 | O_NONBLOCK)
-#define O_NOCTTY	0x8000	/* not fcntl */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
-#define O_LARGEFILE	0x40000
-#define O_DIRECT        0x100000 /* direct disk access hint */
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_ACCMODE		0x0003
+#define O_APPEND		0x0008
+#define FASYNC			0x0040	/* fcntl, for BSD compatibility */
+#define O_CREAT			0x0200	/* not fcntl */
+#define O_TRUNC			0x0400	/* not fcntl */
+#define O_EXCL			0x0800	/* not fcntl */
+#define O_SYNC			0x2000
+#define O_NONBLOCK		0x4000
+#define O_NDELAY		(0x0004 | O_NONBLOCK)
+#define O_NOCTTY		0x8000	/* not fcntl */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_LARGEFILE		0x40000
+#define O_DIRECT        	0x100000 /* direct disk access hint */
+#define O_KERNEL_LARGEFILE	0x200000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-alpha/fcntl.h renamed from include/asm-alpha/fcntl.h~O_LARGEFILE-fix +19 -18
diff -puN include/asm-alpha/fcntl.h~O_LARGEFILE-fix include/asm-alpha/fcntl.h
@@ -3,24 +3,25 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		 01000	/* not fcntl */
-#define O_TRUNC		 02000	/* not fcntl */
-#define O_EXCL		 04000	/* not fcntl */
-#define O_NOCTTY	010000	/* not fcntl */
-
-#define O_NONBLOCK	 00004
-#define O_APPEND	 00010
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		040000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	0100000	/* must be a directory */
-#define O_NOFOLLOW	0200000 /* don't follow links */
-#define O_LARGEFILE	0400000 /* will be set by the kernel on every open */
-#define O_DIRECT	02000000 /* direct disk access - should check with OSF/1 */
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		     01000	/* not fcntl */
+#define O_TRUNC		     02000	/* not fcntl */
+#define O_EXCL		     04000	/* not fcntl */
+#define O_NOCTTY	    010000	/* not fcntl */
+
+#define O_NONBLOCK	     00004
+#define O_APPEND	     00010
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    040000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    0100000	/* must be a directory */
+#define O_NOFOLLOW	    0200000	/* don't follow links */
+#define O_LARGEFILE	    0400000
+#define O_DIRECT	    02000000 /* direct access - check with OSF/1 */
+#define O_KERNEL_LARGEFILE  04000000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-i386/fcntl.h renamed from include/asm-i386/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-i386/fcntl.h~O_LARGEFILE-fix include/asm-i386/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-s390/fcntl.h renamed from include/asm-s390/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-s390/fcntl.h~O_LARGEFILE-fix include/asm-s390/fcntl.h
@@ -10,23 +10,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-h8300/fcntl.h renamed from include/asm-h8300/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-h8300/fcntl.h~O_LARGEFILE-fix include/asm-h8300/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		      0100	/* not fcntl */
+#define O_EXCL		      0200	/* not fcntl */
+#define O_NOCTTY	      0400	/* not fcntl */
+#define O_TRUNC		     01000	/* not fcntl */
+#define O_APPEND	     02000
+#define O_NONBLOCK	     04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    010000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-sparc64/fcntl.h renamed from include/asm-sparc64/fcntl.h~O_LARGEFILE-fix +18 -18
diff -puN include/asm-sparc64/fcntl.h~O_LARGEFILE-fix include/asm-sparc64/fcntl.h
@@ -4,24 +4,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_ACCMODE	0x0003
-#define O_NDELAY	0x0004
-#define O_APPEND	0x0008
-#define FASYNC		0x0040	/* fcntl, for BSD compatibility */
-#define O_CREAT		0x0200	/* not fcntl */
-#define O_TRUNC		0x0400	/* not fcntl */
-#define O_EXCL		0x0800	/* not fcntl */
-#define O_SYNC		0x2000
-#define O_NONBLOCK	0x4000
-#define O_NOCTTY	0x8000	/* not fcntl */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
-#define O_LARGEFILE	0x40000
-#define O_DIRECT        0x100000 /* direct disk access hint */
-
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_ACCMODE		0x0003
+#define O_NDELAY		0x0004
+#define O_APPEND		0x0008
+#define FASYNC			0x0040	/* fcntl, for BSD compatibility */
+#define O_CREAT			0x0200	/* not fcntl */
+#define O_TRUNC			0x0400	/* not fcntl */
+#define O_EXCL			0x0800	/* not fcntl */
+#define O_SYNC			0x2000
+#define O_NONBLOCK		0x4000
+#define O_NOCTTY		0x8000	/* not fcntl */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_LARGEFILE		0x40000
+#define O_DIRECT        	0x100000 /* direct disk access hint */
+#define O_KERNEL_LARGEFILE	0x200000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-arm26/fcntl.h renamed from include/asm-arm26/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-arm26/fcntl.h~O_LARGEFILE-fix include/asm-arm26/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	 040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-cris/fcntl.h renamed from include/asm-cris/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-cris/fcntl.h~O_LARGEFILE-fix include/asm-cris/fcntl.h
@@ -5,23 +5,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get f_flags */
include/asm-v850/fcntl.h renamed from include/asm-v850/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-v850/fcntl.h~O_LARGEFILE-fix include/asm-v850/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW     0100000	/* don't follow links */
-#define O_DIRECT       0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE    0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	     O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_DIRECT            0200000	/* direct disk access hint */
+#define O_LARGEFILE         0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
include/asm-sh/fcntl.h renamed from include/asm-sh/fcntl.h~O_LARGEFILE-fix +18 -17
diff -puN include/asm-sh/fcntl.h~O_LARGEFILE-fix include/asm-sh/fcntl.h
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
fs/xfs/linux/xfs_file.c renamed from fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix +2 -1
diff -puN fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix fs/xfs/linux/xfs_file.c
@@ -276,7 +276,8 @@ linvfs_open(
 	vnode_t		*vp = LINVFS_GET_VP(inode);
 	int		error;
 
-	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
+			i_size_read(inode) > MAX_NON_LFS)
 		return -EFBIG;
 
 	ASSERT(vp);
fs/xfs/linux/xfs_ioctl.c renamed from fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix +1 -1
diff -puN fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix fs/xfs/linux/xfs_ioctl.c
@@ -326,7 +326,7 @@ xfs_open_by_handle(
 	}
 
 #if BITS_PER_LONG != 32
-	hreq.oflags |= O_LARGEFILE;
+	hreq.oflags |= O_KERNEL_LARGEFILE;
 #endif
 	/* Put open permission in namei format. */
 	permflag = hreq.oflags;
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~O_LARGEFILE-fix +2 -2
diff -puN fs/nfsd/vfs.c~O_LARGEFILE-fix fs/nfsd/vfs.c
@@ -455,7 +455,7 @@ nfsd_open(struct svc_rqst *rqstp, struct
 {
 	struct dentry	*dentry;
 	struct inode	*inode;
-	int		flags = O_RDONLY|O_LARGEFILE, err;
+	int		flags = O_RDONLY|O_KERNEL_LARGEFILE, err;
 
 	/*
 	 * If we get here, then the client has already done an "open",
@@ -491,7 +491,7 @@ nfsd_open(struct svc_rqst *rqstp, struct
 		if (err)
 			goto out_nfserr;
 
-		flags = O_WRONLY|O_LARGEFILE;
+		flags = O_WRONLY|O_KERNEL_LARGEFILE;
 
 		DQUOT_INIT(inode);
 	}

diff -puN fs/cifs/file.c~O_LARGEFILE-fix fs/cifs/file.c

fs/udf/file.c renamed from fs/udf/file.c~O_LARGEFILE-fix +3 -2
diff -puN fs/udf/file.c~O_LARGEFILE-fix fs/udf/file.c
@@ -262,14 +262,15 @@ static int udf_release_file(struct inode
  *
  * DESCRIPTION
  *  Use this to disallow opening RW large files on 32 bit systems.
- *  On 64 bit systems we force on O_LARGEFILE in sys_open.
+ *  On 64 bit systems we force on O_KERNEL_LARGEFILE in sys_open.
  *
  * HISTORY
  *
  */
 static int udf_open_file(struct inode * inode, struct file * filp)
 {
-	if ((inode->i_size & 0xFFFFFFFF80000000ULL) && !(filp->f_flags & O_LARGEFILE))
+	if ((inode->i_size & 0xFFFFFFFF80000000ULL) &&
+			!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)))
 		return -EFBIG;
 	return 0;
 }
fs/ncpfs/file.c renamed from fs/ncpfs/file.c~O_LARGEFILE-fix +2 -1
diff -puN fs/ncpfs/file.c~O_LARGEFILE-fix fs/ncpfs/file.c
@@ -213,7 +213,8 @@ ncp_file_write(struct file *file, const 
 		pos = inode->i_size;
 	}
 
-	if (pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
+	if (pos + count > MAX_NON_LFS &&
+	    !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))) {
 		if (pos >= MAX_NON_LFS) {
 			send_sig(SIGXFSZ, current, 0);
 			return -EFBIG;
fs/open.c renamed from fs/open.c~O_LARGEFILE-fix +6 -6
diff -puN fs/open.c~O_LARGEFILE-fix fs/open.c
@@ -279,7 +279,7 @@ static inline long do_sys_ftruncate(unsi
 		goto out;
 
 	/* explicitly opened as large or we are on 64-bit box */
-	if (file->f_flags & O_LARGEFILE)
+	if (file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))
 		small = 0;
 
 	dentry = file->f_dentry;
@@ -931,7 +931,7 @@ asmlinkage long sys_open(const char __us
 	int fd, error;
 
 #if BITS_PER_LONG != 32
-	flags |= O_LARGEFILE;
+	flags |= O_KERNEL_LARGEFILE;
 #endif
 	tmp = getname(filename);
 	fd = PTR_ERR(tmp);
@@ -1046,14 +1046,14 @@ asmlinkage long sys_vhangup(void)
 /*
  * Called when an inode is about to be open.
  * We use this to disallow opening large files on 32bit systems if
- * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
- * on this flag in sys_open.
+ * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE.  On 64bit
+ * systems we force on O_KERNEL_LARGEFILE in sys_open.
  */
 int generic_file_open(struct inode * inode, struct file * filp)
 {
-	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
+				i_size_read(inode) > MAX_NON_LFS)
 		return -EFBIG;
 	return 0;
 }
-
 EXPORT_SYMBOL(generic_file_open);
fs/ext3/file.c renamed from fs/ext3/file.c~O_LARGEFILE-fix +3 -3
diff -puN fs/ext3/file.c~O_LARGEFILE-fix fs/ext3/file.c
@@ -44,12 +44,12 @@ static int ext3_release_file (struct ino
 /*
  * Called when an inode is about to be opened.
  * We use this to disallow opening RW large files on 32bit systems if
- * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
- * on this flag in sys_open.
+ * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE.  On 64bit
+ * systems we force on O_KERNEL_LARGEFILE in sys_open.
  */
 static int ext3_open_file (struct inode *inode, struct file *filp)
 {
-	if (!(filp->f_flags & O_LARGEFILE) &&
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
 	    inode->i_size > 0x7FFFFFFFLL)
 		return -EFBIG;
 	return 0;
fs/exec.c renamed from fs/exec.c~O_LARGEFILE-fix +2 -1
diff -puN fs/exec.c~O_LARGEFILE-fix fs/exec.c
@@ -1387,7 +1387,8 @@ int do_coredump(long signr, int exit_cod
 		goto fail_unlock;
 
  	format_corename(corename, core_pattern, signr);
-	file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
+	file = filp_open(corename,
+			O_CREAT|O_RDWR|O_NOFOLLOW|O_KERNEL_LARGEFILE, 0600);
 	if (IS_ERR(file))
 		goto fail_unlock;
 	inode = file->f_dentry->d_inode;
fs/block_dev.c renamed from fs/block_dev.c~O_LARGEFILE-fix +1 -1
diff -puN fs/block_dev.c~O_LARGEFILE-fix fs/block_dev.c
@@ -679,7 +679,7 @@ int blkdev_open(struct inode * inode, st
 	 * binary needs it. We might want to drop this workaround
 	 * during an unstable branch.
 	 */
-	filp->f_flags |= O_LARGEFILE;
+	filp->f_flags |= O_KEREL_LARGEFILE;
 
 	bdev = bd_acquire(inode);
 
mm/filemap.c renamed from mm/filemap.c~O_LARGEFILE-fix +1 -1
diff -puN mm/filemap.c~O_LARGEFILE-fix mm/filemap.c
@@ -1668,7 +1668,7 @@ inline int generic_write_checks(struct f
 	 * LFS rule
 	 */
 	if (unlikely(*pos + *count > MAX_NON_LFS &&
-				!(file->f_flags & O_LARGEFILE))) {
+	    !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)))) {
 		if (*pos >= MAX_NON_LFS) {
 			send_sig(SIGXFSZ, current, 0);
 			return -EFBIG;
fs/fcntl.c renamed from fs/fcntl.c~O_LARGEFILE-fix +1 -1
diff -puN fs/fcntl.c~O_LARGEFILE-fix fs/fcntl.c
@@ -300,7 +300,7 @@ static long do_fcntl(unsigned int fd, un
 			set_close_on_exec(fd, arg & FD_CLOEXEC);
 			break;
 		case F_GETFL:
-			err = filp->f_flags;
+			err = filp->f_flags & ~O_KERNEL_LARGEFILE;
 			break;
 		case F_SETFL:
 			err = setfl(fd, filp, arg);

_