Creating/Opening of Files over 2 GB under Solaris

Sometimes we deals with opening or creating large files in Solaris 32 environment.

There is compilation convieniece rather code changes. we need not to depend on 'O_LARGEFILE'  flag with open() system call.

The lfcompile page notes that if you pass the following flag to the compiler your application will get compiled to support large files, files greater then 2GB (2^31): 



-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 

You can also try with -D_LARGEFILE_SOURCE=1 or -D_LARGEFILE64_SOURCE=1 or both incase required.

The program could then create a file greater then 2^31 (2GB). This way you do not need to modify your code.

Additional information: 
https://blogs.oracle.com/d/entry/enabling_large_file_support
http://www.gnu.org/software/libc/manual/html_node/Opening-Streams.html

No comments :

Post a Comment