Individual file size limit on HP-UX

I got a question on ulimit on HP-UX. I have a log file that gets more than 2 GB and the application crashes because it can not write to log. I browsed through the forum and found one very similar post on ulimit but that was not concluded. Did some analysis and below is some output.

[/home/user1]>getconf KERNEL_BITS
64
[/home/user1]>ulimit -a
time(seconds)        unlimited
file(blocks)         unlimited
data(kbytes)         2097152
stack(kbytes)        161792
memory(kbytes)       unlimited
coredump(blocks)     4194303
[/home/user1]>uname -s
HP-UX
[/home/user1]>uname -r
B.11.11
[/home/user1]>ulimit -f
unlimited

What is controlling the file size here ? I thought file size is unlimited here. Is there any way to increase the individual max file size limit to some higher value say 8 GB?

Thanks.

What version of HP-UX are you using?

HP-UX 11i v1
Thanks.

I belive you can compile your C program with this option to open files greater then 2GB

-D_FILE_OFFSET_BITS=64

You will require ANSI C compiler.
Unfortunatly i cannot test this since i don't have v1 avalible, but same works on v2

[tst]>cat test.c ## Some code i found online...
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char **argv){
      char *fname;
      int fd, hasread;
      if(argc > 1){
        fname = argv[1];
        fprintf(stdout, "Filename is %s\n", fname);
      }
      fd = open(fname, O_RDONLY);
      if(fd == -1 ){
        perror("Could not open file");
        return 1;
      }
      fprintf(stdout, "File %s was open successfully\n", fname);
      close(fd);
      return 0;
    }
[tst]>du -sk largefile
2099624 largefile
[tst]>cc test.c
[tst]>./a.out largefile
Filename is largefile
Could not open file: Value too large to be stored in data type
[tst]>rm a.out
[tst]>cc -D_FILE_OFFSET_BITS=64 test.c
[tst]>./a.out largefile
Filename is largefile
File largefile was open successfully

Hope that helps.
Regards.

Thanks for your quick response. I wanted to have a limit configured at OS level. It is not any specific C code in the application that writes to log but there are many Java, C++, reports that run to generate the log file. One question -
is the ulimit setting as shown in my first message correct to allow more than 2 GB file size ? I see file(blocks)=unlimited but data (kbytes) is about 2 GB.

I believe that would be data(kbytes) 2097152
Kernel parameter would be maxdsiz/maxdsiz64

The ulimit value is represented in KB, while maxdsiz is in B.

Regards
Peasant.

What filesystem are you using and what commands were used to create the filesystem? Is "largefiles" (i.e. >2Gb) enabled on the filesystem and mentioned in /etc/fstab? See for example "man fsadm_vxfs" (depends on what filesystem you have). Even if the filesystem allows files >2Gb it does not mean that the application has code which can create files larger than 2Gb.