Sponsored Content
Top Forums Programming Can't create file bigger than 2GB with my application Post 302320457 by vino on Thursday 28th of May 2009 05:00:50 AM
Old 05-28-2009
Try compiling your code with the macro -D_FILE_OFFSET_BITS=64.

Look at _FILE_OFFSET_BITS under info libc 'Feature Test Macros'.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File size exceeding 2GB

I am working on HP-Unix. I have a 600 MB file in compressed form. During decompression, when file size reaches 2GB, decompression aborts. What should be done? (3 Replies)
Discussion started by: Nadeem Mistry
3 Replies

2. Programming

C++ Problem, managing >2Gb file

My C++ program returns 'Disk Full' Message when I tried to manage a file larger than 2Gb. the process is very simple: based on a TXT file, the process combine the information generating another temporary file (generating the error) to fillup a database. My FS, during the process, reaches 40%...... (4 Replies)
Discussion started by: ASOliveira
4 Replies

3. Solaris

SUN Solaris 9 - Is there a 2GB file size limit?

Hi I am using SUN/Solaris 9 and I was told that some unix versions have 2GB size limit. Does this applies to SUN/Solaris 9? Thanks. (2 Replies)
Discussion started by: GMMike
2 Replies

4. Shell Programming and Scripting

efficiently split a 2GB text file into two

Can an expert kindly write an efficient Linux ksh script that will split a large 2 GB text file into two? Here is a couple of sample record from that text file: "field1","field2","field3",11,22,33,44 "TG","field2b","field3b",1,2,3,4 The above rows are delimited by commas. This script is to... (2 Replies)
Discussion started by: ihot
2 Replies

5. UNIX for Dummies Questions & Answers

MAX file size limited to 2GB

Hi All, We are running HP rp7400 box with hpux 11iv1. Recently, we changed 3 kernel parameters a) msgseg from 32560 to 32767 b) msgmnb from 65536 to 65535 c) msgssz from 128 to 256 Then we noticed that all application debug file size increase upto 2GB then it stops. So far we did not... (1 Reply)
Discussion started by: mhbd
1 Replies

6. AIX

Creating > 2GB file

I am trying to execute a database dump to a file, but can't seem to get around the 2GB file size. I have tried setting the user limit to -1, but no luck. (4 Replies)
Discussion started by: markper
4 Replies

7. Linux

unzipping file > 2gb

I am not able to unzip file greater then 2gb, Any suggestions how to do that in linux? Regards, Manoj (5 Replies)
Discussion started by: manoj.solaris
5 Replies

8. UNIX for Advanced & Expert Users

How to create a file more than 2GB

Hi, I am executing a SQL query and the output is more than 2GB. Hence the process is failing. How can I have a file created more than 2GB ? Thanks, Risshanth (1 Reply)
Discussion started by: risshanth
1 Replies

9. HP-UX

2GB file size limit

Greetings, I'm attempting to dump a filesystem from a RHEL5 Linux server to a VXFS filesystem on an HP-UX server. The VXFS filesystem is large file enabled and I've confirmed that I can copy/scp a file >2GB to the filesystem. # fsadm -F vxfs /os_dumps largefiles # mkfs -F vxfs -m... (12 Replies)
Discussion started by: bkimura
12 Replies

10. UNIX for Dummies Questions & Answers

Delete the file which crossed 2GB

Hi , I wants to create the bash script for deleting the specified 2gb file and wants to take the backup before doing that. please help me how to do the same,I use RHEL5 server (22 Replies)
Discussion started by: Rahulne25
22 Replies
lfcompile(5)                                            Standards, Environments, and Macros                                           lfcompile(5)

NAME
lfcompile - large file compilation environment for 32-bit applications DESCRIPTION
All 64-bit applications can manipulate large files by default. The methods described on this page allow 32-bit applications to manipulate large files. In the large file compilation environment, source interfaces are bound to appropriate 64-bit functions, structures, and types. Compiling in this environment allows 32-bit applications to access files whose size is greater than or equal to 2 Gbyte ( 2**31 bytes). Each interface named xxx() that needs to access 64-bit entities to access large files maps to a xxx64() call in the resulting binary. All relevant data types are defined to be of correct size (for example, off_t has a typedef definition for a 64-bit entity). An application compiled in this environment is able to use the xxx() source interfaces to access both large and small files, rather than having to explicitly utilize the transitional xxx64() interface calls to access large files. See the lfcompile64(5) manual page for infor- mation regarding the transitional compilation environment. Applications can be compiled in the large file compilation environment by using the following methods: o Use the getconf(1) utility with one or more of the arguments listed in the table below. This method is recommended for portable appli- cations. +------------------+----------------------------------------+ | argument | purpose | |LFS_CFLAGS | obtain compilation flags necessary to | | | enable the large file compilation | | | environment | |LFS_LDFLAGS | obtain link editor options | |LFS_LIBS | obtain link library names | |LFS_LINTFLAGS | obtain lint options | +------------------+----------------------------------------+ o Set the compile-time flag _FILE_OFFSET_BITS to 64 before including any headers. Applications may combine objects produced in the large file compilation environment with objects produced in the transitional compilation environment, but must be careful with respect to interoperability between those objects. Applications should not declare global variables of types whose sizes change between compila- tion environments. Access to Additional Large File Interfaces The fseek() and ftell() functions do not map to functions named fseek64() and ftell64(); rather, the large file additions fseeko() and ftello(), have functionality identical to fseek() and ftell() and do map to the 64-bit functions fseeko64() and ftello64(). Applications wishing to access large files should use fseeko() and ftello() in place of fseek() and ftell(). See the fseek(3C) and ftell(3C) manual pages for information about fseeko() and ftello(). Applications wishing to access fseeko() and ftello() as well as the POSIX and X/Open specification-conforming interfaces should define the macro _LARGEFILE_SOURCE to be 1 and set whichever feature test macros are appropriate to obtain the desired environment (see standards(5)). EXAMPLES
In the following examples, the large file compilation environment is accessed by invoking the getconf utility with one of the arguments listed in the table above. The additional large file interfaces are accessed by specifying -D_LARGEFILE_SOURCE. The examples that use the form of command substitution specifying the command within parentheses preceded by a dollar sign can be executed only in a POSIX-conforming shell such as the Korn Shell (see ksh(1)). In a shell that is not POSIX-conforming, such as the Bourne Shell (see sh(1)) and the C Shell (see csh(1)), the getconf calls must be enclosed within grave accent marks, as shown in the second example. Example 1: An example of compiling a program with a "large" off_t, and that uses fseeko(), ftello(), and yacc(1) $ c89 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o foo $(getconf LFS_CFLAGS) y.tab.c b.o $(getconf LFS_LDFLAGS) -ly $(getconf LFS_LIBS) Example 2: An example of compiling a program with a "large" off_t that does not use fseeko() and ftello() and has no application specific libraries: % c89 -D_FILE_OFFSET_BITS=64 `getconf LFS_CFLAGS` a.c `getconf LFS_LDFLAGS` `getconf LFS_LIBS` Example 3: An example of compiling a program with a "default" off_t and that uses fseeko() and ftello(): $ c89 -D_LARGEFILE_SOURCE a.c SEE ALSO
csh(1), getconf(1), ksh(1), lint(1B), sh(1), fseek(3C), ftell(3C), lf64(5), lfcompile64(5), standards(5) NOTES
Certain system-specific or non-portable interfaces are not usable in the large file compilation environment. Known cases are: o Kernel data structures read from /dev/kmem. o Interfaces in the kernel virtual memory library, -lkvm. o Interfaces in the ELF access library, -lelf. o Interfaces to /proc defined in <procfs.h>. o The ustat(2) system call. Programs that use these interfaces should not be compiled in the large file compilation environment. As a partial safeguard against making this mistake, including either of the <libelf.h> or <sys/procfs.h> header files will induce a compilation error when the large file compi- lation environment is enabled. In general, caution should be exercised when using any separately-compiled library whose interfaces include data items of type off_t or the other redefined types either directly or indirectly, such as with 'struct stat'. (The redefined types are off_t, rlim_t, ino_t, blkcnt_t, fsblkcnt_t, and fsfilcnt_t.) For the large file compilation environment to work correctly with such a library, the library interfaces must include the appropriate xxx64() binary entry points and must have them mapped to the corresponding primary functions when _FILE_OFFSET_BITS is set to 64. Care should be exercised using any of the printf() or scanf() routines on variables of the types mentioned above. In the large file compi- lation environment, these variables should be printed or scanned using long long formats. BUGS
The lint(1B) utility will generate spurious error messages when _FILE_OFFSET_BITS is set to 64. This is because the binary libc lint library, /usr/lib/llib-lc.ln, is compiled only for the standard interfaces, not with _FILE_OFFSET_BITS set to 64. This deficiency hampers static error-checking for programs compiled in the large file compilation environment. Symbolic formats analogous to those found in <sys/int_fmtio.h> do not exist for printing or scanning variables of the types that are rede- fined in the large file compilation environment. SunOS 5.10 23 Jul 2001 lfcompile(5)
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy