Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (f) fopen64(3)
NAME
fopen64 - Opens a file stream
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
DESCRIPTION
The C run-time library supports two variants of the fopen64() function: fopen64_oss() and
fopen64_guardian(). These variants support the unique file-naming conventions and structures
of the OSS and Guardian file systems, respectively. In addition to supporting smaller files, these
variants support OSS files that have a file offset maximum larger than 2 gigabytes and Guardian
files that have a file offset maximum larger than 4 gigabytes (Guardian Format 2 files), respec-
tively.
An application can explicitly call this function when you compile the application using the
#define _LARGEFILE64_SOURCE 1 feature test macro or an equivalent compiler command
option.
An application call to fopen( ) is automatically mapped to this function when you compile the
applciation using the #define _FILE_OFFSET_BITS 64 feature test macro or an equivalent
compiler command option.
Explicit calls to the fopen64_oss() and fopen64_guardian() variants in source code are only
made when the behavior of one environment is desired from the other environment.
For a description of the fopen64() OSS function and the fopen64_oss() function, refer to the
fopen64_oss(3) reference page. For a description of the fopen64( ) Guardian function and the
fopen64_guardian() function, see the fopen64_guardian(3) reference page.
NOTES
The file offset maximum for an OSS file is established when the file is opened. When you use
fopen_oss() (and the call is not mapped to fopen64_oss()) to open a file that is larger than 2
gigabytes, the file is treated like a small file. Subsequent operations, such as read, write, and
positioning operations, are subject to the same limits as when accessing a file that has an offset
maximum of 2 gigabytes.
The file offset maximum for an Guardian file is established when the file is opened:
• When you use fopen64_guardian(), or a function that calls this function, to open a
Guardian file with a file offset maximum of 4 gigabytes (a Guardian Format 1 file), the
file is automatically converted to a file that can grow to larger than 4 gigabytes (It is con-
verted to a Guardian Format 2 file).
• When you use fopen_guardian() (and the call is not mapped to fopen64_guardian())to
open a Guardian Format 2 file that has less than 4 gigabytes of data, the file is treated like
a Guardian Format 1 file. Subsequent operations, such as read, write, and positioning
operations, are subject to the same limits as when accessing a Guardian Format 1 file
(that has an offset maximum of 4 gigabytes). For a few functions, the OSS limit for small
files of 2 gigabytes applies instead of the Guardian limit for small files of 4 gigabytes,
because file positions beyond 2 gigabytes cannot be represented in the functions’s data
structures.
527192-018 Hewlett-Packard Company 2−65