HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)
u
uname(2) uname(2)
ERRORS
If uname() or setuname() fails, errno is set to one of the following values.
[EFAULT] name points to an illegal address. The reliable detection of this error is implementation
dependent.
[EPERM]
setuname() was attempted by a process lacking appropriate privileges.
WARNINGS
uname() returns one of two versions of the
utsname structure.
• HP-UX compatible version (compatible with all OS versions and updates).
• Expanded version of the structure, which provides room to accommodate larger node names.
The compatible structure is used by default. To use the expanded structure, see nodehostnamesize(5).
If the administrator has configured a node name with a length larger than 8 bytes, the compatible version
of the
utsname structure, as returned by
uname(), contains just the first 8 bytes in the
utsname.nodename
field. No other fields in the utsname
structure are truncated in this manner.
Setting a node name of more than 8 bytes with
setuname() is only possible with the appropriate
configuration options enabled. It is strongly recommended that all related documentation be completely
understood before setting a larger node name. A node name larger than 8 bytes can cause anomalous or
incorrect behavior in applications which use the uname command or the uname() system function to
access the names.
It is recommended that, whenever possible, programs use the host name as returned by the gethost-
name()
interface rather than the utsname nodename field. This avoids any issues with respect to the
expanded version of the utsname structure; it will be unnecessary to use it.
See gethostname(2) for more information.
AUTHOR
uname() was developed by AT&T and HP.
SEE ALSO
hostname(1), uname(1), setuname(1M), gethostname(2), sethostname(2), nodehostnamesize(5),
privileges(5).
STANDARDS CONFORMANCE
uname(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
510 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: December 2007 Update