summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/open.c7
-rw-r--r--include/asm-ia64/fcntl.h2
-rw-r--r--include/linux/fcntl.h4
3 files changed, 10 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index 963bd81a44c..2ebb72c1a87 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -21,6 +21,7 @@
#include <linux/vfs.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
+#include <linux/personality.h>
#include <linux/pagemap.h>
#include <linux/syscalls.h>
@@ -935,9 +936,9 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
char * tmp;
int fd, error;
-#if BITS_PER_LONG != 32
- flags |= O_LARGEFILE;
-#endif
+ if (force_o_largefile())
+ flags |= O_LARGEFILE;
+
tmp = getname(filename);
fd = PTR_ERR(tmp);
if (!IS_ERR(tmp)) {
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h
index d193981bb1d..c9f8d835d0c 100644
--- a/include/asm-ia64/fcntl.h
+++ b/include/asm-ia64/fcntl.h
@@ -81,4 +81,6 @@ struct flock {
#define F_LINUX_SPECIFIC_BASE 1024
+#define force_o_largefile() ( ! (current->personality & PER_LINUX32) )
+
#endif /* _ASM_IA64_FCNTL_H */
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 704fb76b633..8a7c82151de 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -25,6 +25,10 @@
#ifdef __KERNEL__
+#ifndef force_o_largefile
+#define force_o_largefile() (BITS_PER_LONG != 32)
+#endif
+
#if BITS_PER_LONG == 32
#define IS_GETLK32(cmd) ((cmd) == F_GETLK)
#define IS_SETLK32(cmd) ((cmd) == F_SETLK)