Bug 16204 - File I/O fails on files >= 2^31 bytes (2GB)
Summary: File I/O fails on files >= 2^31 bytes (2GB)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-25 19:27 UTC by Bryce McKinlay
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test case (388 bytes, text/plain)
2004-06-25 19:28 UTC, Bryce McKinlay
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bryce McKinlay 2004-06-25 19:27:13 UTC
libgcj does not appear to support files > 2GB. However the Sun implementation
works fine on the same system & file system. The attached test case fails with
the following error:

$ gij LargeFile
Exception in thread "main" java.io.IOException: Invalid argument
   at gnu.java.nio.channels.FileChannelImpl.seek(long)
(/local/gcc-clean/lib/libgcj.so.6.0.0)
   at gnu.java.nio.channels.FileChannelImpl.position(long)
(/local/gcc-clean/lib/libgcj.so.6.0.0)
   at java.io.RandomAccessFile.seek(long) (/local/gcc-clean/lib/libgcj.so.6.0.0)

It appears we need to enable LFS support. see:

http://www.suse.de/~aj/linux_lfs.html
Comment 1 Bryce McKinlay 2004-06-25 19:28:33 UTC
Created attachment 6631 [details]
Test case
Comment 2 Andrew Pinski 2004-06-25 21:02:45 UTC
I should note on sane OS's (all *BSD [Darwin is included]) offset_t is always 64bit.
Comment 3 GCC Commits 2004-07-15 00:58:43 UTC
Subject: Bug 16204

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bryce@gcc.gnu.org	2004-07-15 00:58:41

Modified files:
	libjava        : ChangeLog Makefile.am Makefile.in 
Added files:
	libjava/testsuite/libjava.lang: LargeFile.java LargeFile.out 

Log message:
	2004-07-14  Bryce McKinlay  <mckinlay@redhat.com>
	
	PR libgcj/16204
	* Makefile.am (AM_CXXFLAGS): Add -D_FILE_OFFSET_BITS=64 to enable
	large file support.
	* Makefile.in: Rebuilt.
	* testsuite/libjava.lang/LargeFile.java: New test case.
	* testsuite/libjava.lang/LargeFile.out: New file.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.2932&r2=1.2933
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.am.diff?cvsroot=gcc&r1=1.388&r2=1.389
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.in.diff?cvsroot=gcc&r1=1.412&r2=1.413
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.lang/LargeFile.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.lang/LargeFile.out.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 4 Bryce McKinlay 2004-07-15 01:01:15 UTC
Fix committed to HEAD.