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

Table of Contents
Introduction ...................................................................................................................................3
Publication History ......................................................................................................................3
Activating and Setting Expanded Node and Host Names......................................................................4
Activating Expanded Node and Host Names...................................................................................4
Setting Nonexpanded uname(2) Overflow Reporting.........................................................................5
Setting a Node or Host Name.......................................................................................................5
HP Product Limitations .....................................................................................................................6
Programmer Notes: Overview for Updating Programs.........................................................................10
Is The Program Already Clean? ...................................................................................................10
The Basics................................................................................................................................10
Behavior of Existing Interfaces..................................................................................................11
Source Code Issues and Fixes .....................................................................................................11
Building for Execution on Multiple Releases ...................................................................................12
Building for Any HP-UX 11i v2 or Higher System.........................................................................12
Building for Any HP-UX Version................................................................................................12
Dynamic Buffer Sizing............................................................................................................13
Re-export of Node Name and Host Name Interfaces.......................................................................13
Summary.....................................................................................................................................15
APPENDIX A: Rules for Constructing Host and Node Names................................................................16
APPENDIX B: HP-UX Node and Host Name Interfaces.........................................................................17
Functional Program Interfaces......................................................................................................17
Programmatic Constant Interfaces ................................................................................................18
The utsname Structure Interface....................................................................................................18
Command Interfaces..................................................................................................................19
APPENDIX C: Source Code Issues with Expanded Node and Host Names..............................................20
General Program Issues..............................................................................................................20
Truncated Node or Host Name Fields .......................................................................................20
Parsing Output of uname(1) or hostname(1) Commands...............................................................20
Arrays Dimensioned by UTSLEN, SYS_NMLN, SNLEN, or MAXHOSTNAMELEN..............................21
Embedded utsname Structure or Node/Host Name Constants.......................................................21
Buffer Overflow and Other Subtle Issues........................................................................................23
Node or Host Names as Program Input.....................................................................................23
Scripts.....................................................................................................................................24
Tools to Help............................................................................................................................24
Testing Tips..............................................................................................................................24
APPENDIX D: FLV Concepts and Usage............................................................................................26
Elements of FLV.........................................................................................................................26
A Simple Example .................................................................................................................26
Source and Binary Names and the Version Attribute....................................................................27
Linking with Version Identifiers................................................................................................. 27
FLV for Data Definitions and Data Types....................................................................................28
Transitive API Changes and Inheritance.....................................................................................29
Limitations of FLV...................................................................................................................30
Providing Multiple Interface Versions in a Library ........................................................................32
FLV Applied to HP-UX Node Name Interfaces.................................................................................34
Re-export of utsname Structure ................................................................................................. 35
Re-export of Node/Host Name Constants..................................................................................36
Glossary.....................................................................................................................................38