- 论坛徽章:
- 0
|
原帖由 xltao 于 2006-6-19 15:36 发表
我用的是redhat 2.4内核,
32位环境下,编译加“-D_FILE_OFFSET_BITS=64” ,我测试也一下是可以的!不需要在open里加O_LARGEFILE标记 。
谢谢大家!
应该加上O_LARGEFILE标志的, 除非red hat给2.4内核打过补丁做了相应改动, 否则从道理上是讲不通的。
我手头的2.4.0内核的sys_open()函数:
- ……
- #if BITS_PER_LONG != 32
- flags |= O_LARGEFILE;
- #endif
- ……
复制代码
ext2_file_open()函数:
- static int ext2_open_file (struct inode * inode, struct file * filp)
- {
- if (!(filp->f_flags & O_LARGEFILE) &&
- inode->i_size > 0x7FFFFFFFLL)
- return -EFBIG;
- return 0;
- }
复制代码
0x7FFFFFFF就是2G-1。 看一下这个逻辑, 就知道open时必须制定O_LARGEFILE. |
|