In 64-bit Linux, how does one run a 32-bit application? In the case of 32-bit programs, it is advantageous to use a 32-bit system and use RAMDISK to allocate unrecognized memory to the hard disk for virtual memory! Although the 64-bit system can recognize more than 3 GB memory, it cannot make 32-bit programs use more than 3 GB memory! With more than 3 GB of memory, we can only rely on 64-bit systems and 64-bit programs! Preface
The online business is a 32-bit program, and the server uses Debian 64-bit. In theory, the ext4 file system supports a maximum of 16 TB for a single file. Because program logs are not classified by time, so that a single file reaches 2 GB, logs may be lost in some time periods due to the failure to write results. The final analysis shows that the 32-bit program references the 32-bit library, and fopen cannot be written after a single file reaches 32 GB.
I. Definition macro
- Define the macro to process large files (> 4 GB) (This macro definition must be introduced wherever it is used. So you need to write it in a. h file separately)
#undef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #include
#include
2. Add the makefile compilation Option
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILE
(Qt can be modified in the pro file.DEFINES += _FILE_OFFSET_BITS=64 _LARGE_FILE
, Parameters in the preceding format are automatically generated in makefile)
Iii. Use fopen64 function 4. Add a parameter to functions such as fopen:
- For open and open, you can use the O_LARGEFILE parameter,
- That is:
fd = open("./bill_test",O_LARGEFILE|O_APPEND|O_RDWR,0666);
Then there is no problem, but fopen does not have this parameter, and it can only be solved according to the method.