man Pages(5): Headers, Tables and Macros
この本のみを検索
PDF 文書ファイルをダウンロードする

NAME

lfcompile - large file compilation environment

DESCRIPTION

In the large file compilation environment, source interfaces are bound to appropriate 64-bit functions, structures, and types. Compiling in this environment allows applications to 31 access files whose size is greater than or equal to 2 Gbyte (2 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 information regarding the transitional compilation environment.
Applications can be compiled in the large file compilation environment by using the following methods:
Use the getconf(1) utility with one or more of the arguments listed in the table below. This method is recommended for portable applications.
argumentpurpose
LFS_CFLAGSobtain compilation flags necessary to enable the large file compilation environment
LFS_LDFLAGSobtain link editor options
LFS_LIBSobtain link library names
LFS_LINTFLAGSobtain lint options
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 compilation 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(3S) and ftell(3S) 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.
  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)

  1. 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`

  1. An example of compiling a program with a "default" off_t and that uses fseeko( ) and ftello( ):

        $ c89 -D_LARGEFILE_SOURCE a.c

  1. An example of running lint on a program with a "large" off_t:

$ lint -D_LARGEFILE_SOURCE           \
   -D_FILE_OFFSET_BITS=64           \
   $(getconf LFS_LINTFLAGS) . . .   \
   $(getconf LFS_LIBS)

SEE ALSO

csh(1), getconf(1), ksh(1), sh(1), fseek(3S), ftell(3S), interface64(5), lfcompile64(5), standards(5)