delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/02/17/02:24:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Sterten AT aol DOT com
Message-ID: <f7.4a46b646.2f459ddb@aol.com>
Date: Thu, 17 Feb 2005 02:12:27 EST
Subject: Re: files > 4GB There is always a solution
To: djgpp AT delorie DOT com
MIME-Version: 1.0
X-Mailer: 9.0 SE for Windows sub 5003
Reply-To: djgpp AT delorie DOT com

OK, despite Eli's first pessimistic outlook, it seems that it is somehow  
possible
to handle files larger than 4GB, although it is maybe not so easy, I don't  
know
much about the details.
Will we see in the not too distant future a new file which just replaces  one
of the files of gcc/djgpp and which will let us handle large files easily  
just as normal
files before ? Give your predictions !
 
I had tried to create a file >4GB on an old HD without "NTFS" ,  the
file won't grow larger than 4GB, but no error message is produced,
so this is hard to locate the error and debug !
 
On NTFS-drives the file is created correctly, but I can't open it.
Below is another post, which a friend sent me, maybe someone
can use it to give exact advice, how to solve the 4GB-problem.
 
--Guenter.
 
 
============================================= 
Hi list, 
I'm trying  to make sure a program I'm writing works with files greater 
than 4GB in  length. In order to do that, I'm trying to create a sparse 
file of this  size. The program is this: 
#define _LARGEFILE64_SOURCE 
#include  <sys/types.h> 
#include <sys/stat.h> 
#include  <unistd.h> 
#include <fcntl.h> 
int main(int argc, char  *argv[] ) 
{ 
int fd=open(argv[1], O_CREAT|O_WRONLY,  0755); 
int res; 
off64_t offset;  
offset=1024*1024*1024*2u; 

offset+=offset; 
res=lseek64(fd,  offset, SEEK_SET); 
res=write(fd, "Hello, world\n", 13);  
return 0; 
} 
When I run it, however, I get a  signal when executing the "write": 
File size limit exceeded 
HOWEVER,  when doing "ulimit -a": 
core file size (blocks, -c) 0 
data seg size  (kbytes, -d) unlimited 
file size (blocks, -f) unlimited 
max locked  memory (kbytes, -l) unlimited 
max memory size (kbytes, -m) unlimited  
open files (-n) 1024 
pipe size (512 bytes, -p) 8 
stack size (kbytes,  -s) 8192 
cpu time (seconds, -t) unlimited 
max user processes (-u)  unlimited 
virtual memory (kbytes, -v) unlimited 
File system is reiserfs  3. I have tried running it also on a partition 
that has more than 4GB of  free space. Does reiser not support large files? 
Thanks,  
Shachar 
--  
Shachar Shemesh 
============================================= 
and  this answer: 
============================================= 
you need to  add 'O_LARGEFILE' to the flags of 'open'. 
if you search for EFBIG in the  sources of your file system, you'll see 
this instantly.  
============================================= 

-- 
guy 
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019