sysinfo - not available; use the uname and setuname functions (CrUn176)
The sysinfo function exists on Tru64 UNIX, but not on HP-UX. However, you can use the uname and setuname functions to achieve similar results.
The sysinfo function manages system information strings. It retrieves and sets information relating to the operating system by sending special commands to the kernel.
The sysinfo function is defined for Tru64
UNIX as follows:
where command specifies the commands
that manage the system information strings, buf is the buffer used
for storage of system information, and count is the size of the buffer
pointed to by the buf parameter. Following is a sample use of the sysinfo function:
int len = sizeof(buf);
ret = sysinfo(SI_HOSTNAME, buf, len);
This code fragment copies into the buffer the name of the present
host machine, typically the hostname or nodename that the machine is recognized
by locally. All calls to sysinfo are written in the same manner.
Use the uname and setuname functions to achieve similar results.
The correct way for applications to manipulate system
information is through calls to uname and setuname.
Note that uname and setuname may not behave exactly
the same as sysinfo. In particular, a direct replacement is not
available for the SI_ARCHITECTURE and SI_SET_SYSNAME command
You must also keep in mind the limit for setuname for
a nodename is smaller on HP-UX than SI_HOSTNAME on Tru64 UNIX (see sys/utsname.h). Review your code and applicable manpages for more information on these functions.
Although there is an undocumented sysinfo function on HP-UX, to achieve
functionality similar to that on Tru64 UNIX you need to use the HP-UX uname function.
There is only one call to issue on HP-UX to retrieve all
values. Accessing members of the utsname structure
will yield similar results to sysinfo.
struct utsname name;
ret = uname (&name);
Tru64 UNIX sysinfo HP-UX uname/setuname
SI_SET_HOSTNAME setuname(namebuf, sizeof(namebuf)-1);
||any HP-UX 11i version