HP-UX 11i Version 2 Release Notes (October 2003)
Commands and System Calls
Usage of Capacity-related ioctls: DIOC_CAPACITY, DIOC_DESCRIBE, and SIOC_CAPACITY
Chapter 8
199
Usage of Capacity-related ioctls: DIOC_CAPACITY,
DIOC_DESCRIBE, and SIOC_CAPACITY
The DIOC_CAPACITY ioctl can be used to obtain the capacity of a disk device in
DEV_BSIZE units. The DIOC_DESCRIBE ioctl can be used to obtain device specific
identification information. The information returned includes the disk's logical block
size. The SIOC_CAPACITY ioctl indicates the current device size.
Summary of Change
Applications that use the DIOC_CAPACITY or DIOC_DESCRIBE ioctl calls should be
rebuilt because capacity_type and disk_describe_type, respectively, now include
64-bit fields to better represent the size of newer, larger devices. Unrebuilt applications
will continue to work properly because the kernel will detect the smaller struct sizes and
return the proper 32-bit values. However, if these ioctls are used with a truly large
device, these 32-bit fields can overflow and result in an EOVERFLOW error.
Applications that use the SIOC_CAPACITY ioctl for devices that may become large at
some point should now use the new SIOC_STORAGE_CAPACITY ioctl (which uses the new
storage_capacity_t struct which includes a 64-bit size field). Otherwise, the
SIOC_CAPACITY ioctl will return an EOVERFLOW error when a truly large device causes
an overflow in the capacity struct.
Usage of ustat(), statfs(), and statvfs()
The ustat() system call returns information about a mounted file system. The
statfs() function returns status information for a mounted file system.The statvfs()
function returns information about a mounted file system.
Compatibility
There is a compatibility issue involving old binaries that still use ustat(), the various
forms of statfs() (fstatfs(), statfsdev(), fstatfsdev()) and the various forms of
the 32-bit flavor of statvfs(), (fstatvfs(), statvfsdev(), fstatfsdev()).
When these old binaries are exposed to a truly large file system, these calls will return
an EOVERFLOW error that the binaries have never seen before. In some cases, this may be
interpreted as a file being absent (some libraries and commands look at the -1 result,
but not the u.uerror) or draw other incorrect conclusions. HP-provided command and
library code has been updated to use the 64-bit flavor of statvfs(), so rebuilt binaries
should not have this problem. The bottom line is that administrators need to be aware of
this when setting up their file systems. These older binaries need to be run against data
that resides on smaller file systems, rather than new, huge ones that will overflow the
various 32-bit status fields.