Node and Host Name Sizes on HP-UX: Using the Expanded Capabilities of HP-UX

18
Programmatic Constant Interfaces
SYS_NMLN, UTSLEN
These are symbolic constants used to determine the size of fields in the utsname structure.
Their values are 257 if the program is compiled with D_HPUX_API_LEVEL=20040821.
Otherwise, their values are 9.
SNLEN
This is a symbolic constant used to determine the size of the idnumber field in the utsname
structure. Its value is 257 if the program is compiled with
D_HPUX_API_LEVEL=20040821. Otherwise, its value is 15.
MAXHOSTNAMELEN
This is a symbolic constant used to determine the maximum size of a host name. Its value is
256 if the program is compiled with D_HPUX_API_LEVEL=20040821. Otherwise, its
value is 64.
The utsname Structure Interface
The utsname structure is defined as:
struct utsname {
char sysname[SYS_NMLN];
char nodename[SYS_NMLN];
char release[SYS_NMLN];
char version[SYS_NMLN];
char machine[SYS_NMLN];
char idnumber[SNLEN];
};
When the SYS_NMLN and SNLEN values change for the expanded version (that is, when the program
is compiled with D_HPUX_API_LEVEL=20040821), this structure exhibits a different size and
layout. (In addition, it includes fields added for future expansion.)
For HP-UX 11i v2 and v3, only the nodename value is permitted to exceed the length allowed by
prior versions of HP-UX. The other field values cannot exceed the prior limits.
5
However, future needs
are not always predictable, so HP might expand other values so that they do not fit in the
corresponding fields of the nonexpanded version of the structure. This will cause the nonexpanded
version of uname(2) to return an EOVERFLOW error.
5
Why have other values not been expanded? There is little call for a longer sysname field (it is typically "HP-UX"). The
release, version, and machine fields cannot be controlled by the customer. HP does not want to force longer strings on
applications without customer control. The release field is parsed by many programs and scripts which could not tolerate a
deviation from the normal format (such as B.11.11). The version is a single byte that encodes the license level. The
machine field is also parsed by programs and scripts that cannot tolerate a deviation from the normal format (such as
9000/889). [Alternate interfaces exist for more complete model information (see model(1), getconf(1)
w/MACHINE_MODEL, confstr(3) w/_CS_MACHINE_MODEL) . Finally, theidnumber field must be parsable by into a
32-bit unsigned integer value so it cannot exceed 10 bytes (representing 10 decimal digits).