critical impact:
open - large file support not enabled by default (CrCh348)
Problem description
Support for large files (larger than 2 GB) is enabled by default on Tru64 UNIX
but not on HP-UX.
On HP-UX, the default file system options and the default compilation
environment do not support files larger than 2 GB.
The default file system options for HFS and VxFS on HP-UX do not
support large files. If an application writes to a file system where
large file support is not enabled, then any writes past 2 GB will fail
with the errno EFBIG, even if the application was compiled with large
file support.
The default compilation environment on HP-UX is 32 bits. Its uses
the ILP32 data model and its file-related data types like off_t are
32 bits. Applications built in this environment will not be able to
access large files. For example, opens and stats of large files will
fail with the errno EOVERFLOW and writes past 2 GB will fail with the
errno EFBIG. Identifiers
 open |
|
|
|
|
|
|
|
See also
Solution description
To use large files on HP-UX, enable large file support in file systems
and compile with large file support.
To enable large file support in HFS and VxFS file systems, use
the largefiles option to the mkfs, newfs, or fsadm commands. Their
default option is nolargefiles. You can also use the fsadm command to see which option is set in a file system.
Warning: Not all of the HP-UX backup utilities support large files.
dd and fbackup/frecover do, and tar and pax will for files up to 8 GB.
However, cpio and ftio will skip large files, and dump will not back up
a file system that has large file support enabled.
To compile with large file support, there are three main approaches:
- +DD64
This approach is for 64-bit applications. It selects the LP64
data model and defines off_t and other file-related data types to
be 64 bits.
This approach is the closest to the default compilation
environment on Tru64 UNIX.
- -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
This approach is for 32-bit applications. It does not change
the default data model of ILP32, but it defines off_t and other
file-related data types to be 64 bits and uses 64-bit versions of
open() and other file-related functions. It also makes the
fseeko() and ftello() functions visible.
This approach is stricter than the 32-bit (taso) compilation
environment on Tru64 UNIX, where long and off_t are both 64 bits.
First, applications must use off_t for file offsets and not long; long is smaller than off_t in this approach. Second,
applications must include the headers for any file-related
functions that they call because the approach is implemented in
the system headers. Finally, applications must call fseeko()
and ftello(), which use off_t in their definitions, instead of
fseek() and ftell(), which use long.
- -D_LARGEFILE64_SOURCE
This approach is for 32-bit applications that use the explicit
64-bit data types and functions like off64_t and open64(). HP
does not recommend using these functions because they are not part of the
POSIX standard and they may be removed from HP-UX in a future
release.
This approach does not apply to applications transitioning
from Tru64 UNIX because these features were never available on
Tru64 UNIX.
New behavior
# create a file system with large file support
newfs -F vxfs -o largefiles /dev/rg02/rlvol1
# see if the largefiles option is set in a file system
fsadm -F vxfs /appfs
# compile in the 64-bit compilation environment
cc +DD64 app.c
See also
Problem summary
| classifications |
source types |
OS release |
severity |
type |
| IO |
C, C++ |
any HP-UX 11i version |
critical |
changed |
|