1lfcompile(5)          Standards, Environments, and Macros         lfcompile(5)
2
3
4

NAME

6       lfcompile - large file compilation environment for 32-bit applications
7

DESCRIPTION

9       All  64-bit  applications  can  manipulate  large files by default. The
10       methods described on this page allow 32-bit applications to  manipulate
11       large files.
12
13
14       In  the large file compilation environment, source interfaces are bound
15       to appropriate 64-bit functions, structures, and types.   Compiling  in
16       this  environment allows 32-bit applications to access files whose size
17       is greater than or equal to 2 Gbyte ( 2^31 bytes).
18
19
20       Each interface named xxx() that needs  to  access  64-bit  entities  to
21       access  large files maps to a xxx64() call in the resulting binary. All
22       relevant data types are defined to be of  correct  size  (for  example,
23       off_t has a typedef definition for a 64-bit entity).
24
25
26       An  application  compiled  in this environment is able to use the xxx()
27       source interfaces to access both large and  small  files,  rather  than
28       having  to  explicitly utilize the transitional xxx64() interface calls
29       to access large files. See the lfcompile64(5) manual page for  informa‐
30       tion regarding the transitional compilation environment.
31
32
33       Applications  can be compiled in the large file compilation environment
34       by using the following methods:
35
36           o      Use the getconf(1) utility with one or more of the arguments
37                  listed  in  the  table below. This method is recommended for
38                  portable applications.
39
40
41
42
43                  ┌──────────────────┬────────────────────────────────────────┐
44argument      purpose                 
45                  ├──────────────────┼────────────────────────────────────────┤
46LFS_CFLAGS        │ obtain compilation flags necessary  to │
47                  │                  │ enable   the  large  file  compilation │
48                  │                  │ environment                            │
49LFS_LDFLAGS       │ obtain link editor options             │
50LFS_LIBS          │ obtain link library names              │
51LFS_LINTFLAGS     │ obtain lint options                    │
52                  └──────────────────┴────────────────────────────────────────┘
53
54           o      Set the compile-time flag  _FILE_OFFSET_BITS  to  64  before
55                  including any headers. Applications may combine objects pro‐
56                  duced in the large file compilation environment with objects
57                  produced  in  the  transitional compilation environment, but
58                  must be careful with  respect  to  interoperability  between
59                  those  objects. Applications should not declare global vari‐
60                  ables of types whose sizes change between  compilation envi‐
61                  ronments.
62
63   Access to Additional Large File Interfaces
64       The  fseek()  and  ftell()  functions  do  not  map  to functions named
65       fseek64() and ftell64(); rather, the large file additions fseeko()  and
66       ftello(),  have  functionality  identical to fseek() and ftell() and do
67       map to the 64-bit functions  fseeko64()  and  ftello64().  Applications
68       wishing to access large files should use fseeko() and ftello() in place
69       of fseek() and ftell(). See the fseek(3C) and  ftell(3C)  manual  pages
70       for information about  fseeko() and ftello().
71
72
73       Applications  wishing  to  access  fseeko() and ftello() as well as the
74       POSIX and X/Open specification-conforming interfaces should define  the
75       macro  _LARGEFILE_SOURCE  to be 1 and set whichever feature test macros
76       are appropriate to obtain the desired environment (see standards(5)).
77

EXAMPLES

79       In the following examples, the large file  compilation  environment  is
80       accessed  by  invoking  the  getconf  utility with one of the arguments
81       listed in the table above. The additional  large  file  interfaces  are
82       accessed by specifying -D_LARGEFILE_SOURCE.
83
84
85       The  examples  that use the form of command substitution specifying the
86       command within parentheses preceded by a dollar sign  can  be  executed
87       only  in  a POSIX-conforming shell such as the Korn Shell (see ksh(1)).
88       In a shell that is not POSIX-conforming, such as the Bourne Shell  (see
89       sh(1)) and the C Shell (see csh(1)), the getconf calls must be enclosed
90       within grave accent marks, as shown in the second example.
91
92       Example 1 Compile a program with a "large" off_t  that  uses  fseeko(),
93       ftello(), and yacc.
94
95
96       The following example compiles a program with a "large"  off_t and uses
97       fseeko(), ftello(), and yacc(1).
98
99
100         $ c89 -D_LARGEFILE_SOURCE                \
101               -D_FILE_OFFSET_BITS=64 -o foo      \
102               $(getconf LFS_CFLAGS) y.tab.c b.o  \
103               $(getconf LFS_LDFLAGS)             \
104               -ly $(getconf LFS_LIBS)
105
106
107       Example 2 Compile a program with a "large"  off_t  that  does  not  use
108       fseeko() and ftello() and has no application specific libraries.
109
110         % c89 -D_FILE_OFFSET_BITS=64     \
111               `getconf LFS_CFLAGS` a.c   \
112               `getconf LFS_LDFLAGS`      \
113               `getconf LFS_LIBS`         \
114
115
116       Example  3  Compile a program with a "default" off_t that uses fseeko()
117       and ftello().
118
119         $ c89 -D_LARGEFILE_SOURCE  a.c
120
121

SEE ALSO

123       csh(1),  getconf(1),  ksh(1),  yacc(1),  sh(1),  fseek(3C),  ftell(3C),
124       lf64(5), lfcompile64(5), standards(5)
125

NOTES

127       Certain  system-specific  or  non-portable interfaces are not usable in
128       the large file compilation environment. Known cases are:
129
130           o      Kernel data structures read from /dev/kmem.
131
132           o      Interfaces in the kernel virtual memory library, -lkvm.
133
134           o      Interfaces in the ELF access library, -lelf.
135
136           o      Interfaces to /proc defined in <procfs.h>.
137
138           o      The ustat(2) system call.
139
140
141       Programs that use these interfaces should not be compiled in the  large
142       file  compilation  environment.   As a partial safeguard against making
143       this mistake, including either  of  the  <libelf.h>  or  <sys/procfs.h>
144       header files will induce a compilation error when the large file compi‐
145       lation environment is enabled.
146
147
148       In general, caution should be exercised when using any  separately-com‐
149       piled  library whose interfaces include data items of type off_t or the
150       other redefined types either  directly  or  indirectly,  such  as  with
151       'struct stat'. (The redefined types are off_t, rlim_t, ino_t, blkcnt_t,
152       fsblkcnt_t, and fsfilcnt_t.) For the large file compilation environment
153       to  work  correctly  with  such  a library, the library interfaces must
154       include the appropriate xxx64() binary entry points and must have  them
155       mapped to the corresponding primary functions when _FILE_OFFSET_BITS is
156       set to 64.
157
158
159       Care should be exercised using any of the printf() or scanf()  routines
160       on  variables of the types mentioned above.  In the large file compila‐
161       tion environment, these variables should be printed  or  scanned  using
162       long long formats.
163

BUGS

165       Symbolic  formats  analogous to those found in <sys/int_fmtio.h> do not
166       exist for printing or scanning variables of the types  that  are  rede‐
167       fined in the large file compilation environment.
168
169
170
171SunOS 5.11                        24 Aug 2009                     lfcompile(5)
Impressum