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

36
The approach taken is entirely dependent on the flexibility or demands of those who maintain the
client programs.
If the node name is not considered to be important to the interface (even though the whole utsname
structure is included) it might be tempting to support only the nonexpanded version. One drawback
to this is that client programs might want to use utsname structure and uname() function elsewhere
in their program to support long node names. Although it might be manageable for the program to
separate the two sets of references, it might cause some inconvenience. The converse situation might
arise if only the expanded version is supported by the interface.
Supporting both versions of an interface provides the most flexibility to client programs. The manner
in which multiple versions are provided depends on the design of the code that provides the
get_xyz() interface. Either a parallel implementation approach or a thin converter might be
practical. See “Providing Multiple Interface Versions in a Library”.
Re-export of Node/Host Name Constants
Consider the following interface:
struct uvw {
int uvw_field1;
char uvw_host[MAXHOSTNAMELEN];
}
extern int get_uvw(struct uvw *);
If this interface is exported outside the product, to client application code, it is said to re-export the
MAXHOSTNAMELEN interface. The descriptions in the following sections can also be applied in a
similar fashion to interfaces that re-export the SYS_NMLN, SNLEN, and UTSLEN constants.
Interface Does Not Inherit Version from Constants
The major issue with re-exporting constants is that the FLV mechanism does not provide version
identifiers. Thus, the uvw structure inherits no version if its definition is based on the expanded
version of MAXHOSTNAMELEN. No link-time checking is done to ensure that clients and interfaces
have compatible data layouts.
Because of this, it is very important that library providers scan all interface definitions for instances of
any of the node and host name-related constants. If expanded node and host names are to be
supported, the affected structure and function interfaces must be given an explicit version attribute.
Options for Interfaces Which Re-export Node/Host Name Constants
The options for constants are similar to those for re-export of the utsname structure:
Support only the nonexpanded version, and build without expanded API level.
Support only the expanded versions, and build with D_HPUX_API_LEVEL=20040821
option.
Support both versions.
The approach taken is entirely dependent on the flexibility or demands of those who maintain the
client programs. It is easiest to support only one version. However, supporting both versions
provides the most flexibility to client programs.