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
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/


================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to