getsysinfo(2)getsysinfo(2)NAMEgetsysinfo - Gets system information
SYNOPSIS
#include <sys/sysinfo.h> #include <machine/hal_sysinfo.h>
getsysinfo (op, buffer, nbytes, start, arg, flag)
unsigned long op;
caddr_t buffer;
unsigned long nbytes;
int *start;
void *arg;
unsigned long *flag;
PARAMETERS
Specifies the operation to be performed. Values for op are defined in
the <sys/sysinfo.h> and <machine/hal_sysinfo.h> header files. See the
DESCRIPTION for the operations you can specify. Specifies the location
where the system information is returned. Its data type depends upon
the operation you specify. Defines the size of buffer. Specifies the
current logical location within the internal system table referenced by
the op value. You initially set the start parameter to 0 (zero) or to
-1. Then, the getsysinfo() routine updates this value as it retrieves
information so that it sets the start parameter to the current logical
location within the system table. You can use successive executions of
getsysinfo(), without modifying the start parameter, to retrieve infor‐
mation about all the system structures specified by op. See the indi‐
vidual op descriptions to determine how to initialize the start parame‐
ter.
The getsysinfo() call sets the start parameter to 0 (zero) when
all the system information you requested has been retrieved.
Used by some op values to specify additional information. The
data type of these optional parameter depends upon which opera‐
tion is specified. If an operation requires no arg parameter,
omit this parameter or set it to NULL.
DESCRIPTION
The getsysinfo system call retrieves information from the system.
When information about multiple system structures is returned, it is
stored in consecutive buffer locations. The information for each system
structure depends on the op value.
This section lists the various operations that you can specify with the
op parameter. It also specifies the data type for the buffer, nbytes,
start, and arg parameters where necessary.
Returns a list or a count of the mapped out PFNs within the
specified range. If the provided buffer is too small to contain
the entire list of mapped out PFNs, an error of E2BIG is
returned along with the count of mapped out PFNs. unsigned int
buf[SIZE] Contains either a list or a count of mapped PFNs.
unsigned int size Must be at least 4. When set to 4, the count
of mapped PFNs is returned to buffer. When set to 8 or higher,
the list of mapped PFNs is returned to buffer, unless the buffer
is too small. When the buffer is too small, the count of mapped
PFNs is returned. unsigned int start points to the first PFN in
the range to be searched. unsigned int endspecifies the last
PFN in the range to be searched. Obsolete operation specific to
a controller type that is no longer supported. Returns the
BOOTDEV string, which is used for the installation. (This opera‐
tor does not require any parameter modifications.) Returns the
name of the file from which the currently running kernel was
booted. This file might be a statically linked executable, such
as vmunix, or a bootstrap linker directive file, such as
/etc/sysconfigtab. (See also the description of the GSI_MOD‐
ULE_LIST operation.) char buf[SIZE] Must be greater than or
equal to 80. Returns the name of the network interface over
which the kernel was booted. This value is only valid when the
kernel is booted from the network. Examples are ln0 (DEC 3000)
and te0 (DEC 4000). char buf[SIZE] Must be greater than or
equal to 10. Returns the name of a start-selected bus. char
buf[SIZE] Specifies the size of the user buffer. If you set
start to -1, the name of the nexus iobus is returned in buffer.
Otherwise, start points to the bus address and returns the nexus
iobus name in buffer.
See EXAMPLES for an example that uses GSI_BUS_NAME. Returns the
port name of a start-selected bus. char buf[SIZE] Specifies the
size of the user buffer. If you set start to -1, the port name
of the nexus iobus is returned in buffer. Otherwise, start
points to the bus address and returns the port name of the nexus
iobus in buffer. Returns a start-selected bus structure, which
is defined in <io/common/devdriver.h>. struct bus
(/usr/include/io/common/devdriver.h) Specifies the size of the
user buffer. If you set start to -1, the structure of the nexus
iobus is returned in buffer. Otherwise, start points to the bus
structure and returns the structure of the nexus iobus in buf‐
fer.
See EXAMPLES for an example that uses GSI_BUS_STRUCT. Returns a
non-zero value if the system supports accessing IO space with
byte/word load and store instructions. If zero is returned or
the call fails, then byte/word IO accesses should not be
attempted. int Specifies the size of the user buffer. Returns
the system clock's ticks-per-second value in the form of an int.
(This operator does not require any parameter modifications.)
Returns the address of the start-selected binary compatibility
module's configure function in the form of a pointer. struct
compat_mod which is defined in <sys/systm.h> Specifies size of
compat_mod structure Points to the compat_mod structure and
returns the address of the binary compatibility module's config‐
ure function in buffer. For internal use only. For internal
use only. For internal use only. For internal use only. Obso‐
lete. Returns the MIPS console type identifier for MIPS plat‐
forms. Returns an error ([EINVAL]) on Alpha platforms. Returns
the CPU type (from the kernel cpu global variable) in the form
of an int. int Must be no less than the size of an int.
Returns CPU information.
GSI_CPU_INFO returns data on a partition basis. On a partitioned
system with 8 CPUs GSI_CPU_INFO returns only the information for
CPUs assigned to the partition. Use GSI_CPU_STATE to return CPU
information for the entire system (all partitions). The follow‐
ing data is returned: The number of the CPU on which the calling
thread was running at the time of the getsysinfo() call. The
number of CPUs capable of running at the time of the getsys‐
info() call. The type of machine, as defined by the
/usr/include/machine/hal/cpuconf.h header file. The highest
available CPU number plus one. For example, if your system con‐
tains three CPUs numbered 0, 2, and 4, the value is 5. Bit mask
indicating which CPU numbers are currently mapped to physical
CPUs. For example, a value of 0x15 indicates that the system
contains CPUs numbered 0, 2, and 4. Bit mask indicating which
CPUs are capable of performing work at the time of the getsys‐
info() call. Bit mask indicating which CPUs are bound to spe‐
cific processes. Bit mask indicating which CPUs are part of a
processor set that is marked for exclusive use by a task. The
CPUs might be idle at the time of the getsysinfo() call. Speed
of the CPU in megahertz. This value might be inaccurate if the
system architecture supports mixed-speed CPUs. struct cpu_info
(/usr/include/machine/hal_sysinfo.h) Specifies the size of the
user buffer. GSI_CPU_STATE shows data for all CPUs on a parti‐
tioned system. (Using hardware partitioning.) See GSI_CPU_INFO,
which returns CPU information by partition. The following infor‐
mation is returned: The maximum number of CPUs supported by the
system architecture. The number of the CPU that is the current
primary processor. Whether the CPU can be the primary proces‐
sor. CPU sets that have kernel structs allocated. The CPU
slots that are currently powered up. CPU sets that are marked
as present by the system firmware. CPU sets that are marked as
available by the system firmware. CPU sets that are currently
running (online). CPU sets that have threads bound to them.
CPU sets that have threads exclusively bound. Whether the CPU
is registered with HWC. Whether the CPU is able to take inter‐
rupts.
struct cpu_state (/usr/include/machine/hal_sysinfo.h) Specifies
the size of the user buffer. Returns the actual number of CPUs
present in the current machine in the form of an int. int Spec‐
ifies the size of the user buffer. Returns the name of a start-
selected controller. char buf[SIZE] Specifies the size of the
user buffer. Points to the controller structure and returns the
name of that structure in buffer. Returns the port name of a
start-selected controller. char buf[SIZE] Specifies the size of
the user buffer. Points to the controller structure and returns
the port name of that structure in buffer. Returns a start-
selected controller structure, which is defined in <io/com‐
mon/devdriver.h>. struct controller Specifies the size of the
user buffer. Points to the controller structure and returns
that structure in buffer. Returns the number of the CPU on
which the thread is currently running in the form of a long.
long For internal use only. Returns a start-selected dev_mod_t
structure, which is defined in <sys/sysconfig.h>. (This operator
does require any parameter modifications.) Returns the name of
a start-selected device. char buf[SIZE] Specifies the size of
the user buffer. Points to the device structure and returns the
name of the device structure in buffer. Returns the port name
of a start-selected device. char buf[SIZE] Specifies the size
of the user buffer. Points to the device structure and returns
the port name of the device structure in buffer. Returns a
start-selected device structure which is defined in <io/com‐
mon/devdriver.h>. struct device (/usr/include/io/common/dev‐
driver.h) Specifies the size of the user buffer. Points to the
device structure and returns that structure in buffer. Returns
the type (disk, tape, and so forth) of the start-selected device
in the form of a string. char buf[SIZE] Specifies the length of
buffer. For internal use only. Returns the dump device
descriptor in the form of a dev_t. dev_t Specifies the size of
the user buffer. Returns the contents of the kernel's dumpinfo
structure (defined in <sys/sysinfo.h>) to allow the savecore
utility to retrieve namelist information for the currently run‐
ning kernel. struct dumpinfo Specifies the size of the user
buffer. For internal use only. Returns information about the
number of open files allowed for a process. The process's utask
structure is checked. If the process has enabled support for up
to 64K file descriptors, a 1 is returned. If the process has not
enabled support for up to 64K file descriptors, a 0 is returned.
int Specifies the size of the user buffer. Returns information
about the console firmware revision in the form of struct
firmware_rev, as defined in <machine/console.h>. struct
firmware_rev Specifies the size of buffer, which must be >=
sizeof(struct firmware_rev). For internal use only. For inter‐
nal use only. Returns the HWRPB in the form of struct rpb, as
defined in <machine/rpb.h> struct rpb hwrpb Specifies the size
of buffer. Returns information concerning the graphics screens
present in the system. This information consists of the width
and height, in pixels, for a graphics device, for example, 1280
x 1024 for the DEC 3000 Model 500 default graphics. The start
parameter allows you to step through all of the screens config‐
ured in the system (as for GSI_GRAPHICTYPE).
The following is an example of a buffer data structure format
that can be used:
buffer
struct {
int width;
int height;
} resolution_buffer = {0, 0;
sizeof(resolution_buffer) Should be set to zero for the first
call. On return, will contain the screen number for which data
was returned, or zero (0) after the data for the last screen
present in the system was returned on the previous call.
Returns information concerning the graphics screens present in
the system. This information consists of the ROM identifier
string associated with a graphics device, for example, “PMAGB-
BA” for the DEC 3000 Model 500 default graphics. The start
parameter allows you to step through all the screens configured
in the system (as for GSI_GRAPHIC_RES). char buf[SIZE]
sizeof(buf) must be at least 8 bytes. The returned value will be
exactly 8 bytes and will not be zero terminated. Should be set
to zero for the first call. On return, will contain the screen
number for which data was returned, or zero (0) after the data
for the last screen present in the system was returned on the
previous call. If no graphic screens are configured in the sys‐
tem, a value of zero will be returned from the first call. An
error of EINVAL will be returned if start is negative or equal
to or greater than the number of screens actually configured.
Returns the parent IEC setting in buffer. This setting is deter‐
mined by the setsysinfo(2) SSIN_IECPARNT operation, which allows
users to specify their own instruction emulation control (IEC)
mechanism. By default, the operating system emulates instruc‐
tions not supported by the host processor and displays an infor‐
mational message (for the first occurrence only). This allows
programs executing such instructions to run to completion and
produce correct results. However, increased system overhead may
degrade the program's performance. int Specifies the size of
the user buffer. Returns the process IEC setting in buffer.
This setting is determined by the setsysinfo(2) SSIN_IECPROC
operation, which allows users to specify their own instruction
emulation control (IEC) mechanism. By default, the operating
system emulates instructions not supported by the host processor
and displays an informational message (for the first occurrence
only). This allows programs executing such instructions to run
to completion and produce correct results. However, increased
system overhead may degrade the program's performance. int
Specifies the size of the user buffer. Returns the system IEC
setting in buffer. This setting is determined by the setsys‐
info(2) SSIN_IECSYS operation, which allows the superuser to
specify his or her own instruction emulation control (IEC) mech‐
anism. By default, the operating system emulates instructions
not supported by the host processor and displays an informa‐
tional message (for the first occurrence only). This allows pro‐
grams executing such instructions to run to completion and pro‐
duce correct results. However, increased system overhead may
degrade the program's performance. int Specifies the size of
the user buffer. Returns the mask of the currently enabled FP
exceptions, defined in <machine/fpu.h> (as “read/write flags”),
in the form of a long. long
Note
It is recommended that the C library (libc) routine ieee_fp_con‐
trol() be used instead of getsysinfo(). See the ieee(3) refer‐
ence page for information on this libc routine.
Returns the values set by the user through the
SSI_IEEE_STATE_AT_SIGNAL setsysinfo(2) routine. See the IEEE
specification for details. long
Note
It is recommended that the libc routine ieee_get_state_at_sig‐
nal() be used instead of getsysinfo(). See the ieee(3) reference
page for information on this libc routine.
For internal use only. Returns the settings of the global ker‐
nel variables ipforwarding (in bit 1) and ipgateway (in bit 0)
for use by the iprsetup utility. int Specifies the size of the
user buffer. Returns the keyboard name, if it exists, as an
ASCII string. char kybd[SIZE] Specifies the size of buffer.
For internal use only. Returns LMF (License Management Facil‐
ity) kernel information. LMF definitions are in the <sys/lmf.h>
and <sys/lmfklic.h> header files. You must specify an arg param‐
eter. The other parameter values vary depending on what you
specify for arg. See the LMF header files to determine which
input parameters are required. Returns the maximum length of a
login name in the form of an integer. int login_name_max Speci‐
fies the size of buffer, which is sizeof(int). For internal use
only. Returns the maximum number of CPUs possible based on cur‐
rent machine in the form of an int. It is based on the highest
numbered CPU found in the machine's current hardware configura‐
tion regardless of whether the lower numbered slots contain
CPU's or are empty. For example a system containing CPU's in
slots 0-3 would have a GSI_MAX_CPU value of 4. A system contain‐
ing only two cpus in slots 0 and 3 (with the other slots being
empty) would also have a GSI_MAX_CPU value of 4. int Specifies
the size of the user buffer. Returns the maximum number of pro‐
cesses allowed for each user id. int Specifies the size of the
user buffer. Returns the minimum alignment required for an
address specified with the MAP_FIXED option in the mmap(2) sys‐
tem call. Returns the following two lists for kernels that are
bootstrap linked: A space-separated list of the exact module
names and linker flags used to build the currently running ker‐
nel. A space-separated list of the foreign kit names and
devices that were added to the kernel from the bootstrap command
line.
If the currently running kernel is a statically linked kernel,
getsysinfo() returns an empty string. char buf[SIZE] At least
one page (8192 bytes). In some cases one page is too small to
hold the data to be returned. In this case, getsysinfo returns
the EFAULT error code. Retry the operation with two or more
pages. Returns the entire NETBLK structure, which is used for
the network installation. struct netblk Specifies the size of
buffer. For internal use only. Returns information about the
palcode revision in the form of struct palcode_rev. struct pal‐
code_rev Specifies the size of buffer. For internal use only.
Returns the amount of physical memory, in kilobytes, in the form
of an int. long Specifies the size of the user buffer. Returns
the physical memory starting address as a LONG value. Physical
memory will have a nonzero starting address for any secondary
partition (that is, where partition number > 0). long Specifies
the size of the user buffer. Returns the name of the hardware
platform. Example platform names are AlphaServer 1000 4/200 and
DEC3000-M500. char buf[SIZE] Specifies the size of the user
buffer. Returns the mouse/tablet name, if any, in the form of
an ASCII string. char pointer[size] Specifies the size of buf‐
fer. Returns the size of nonvolatile RAM (NVRAM) present on
systems with PRESTO installed, in the form of a int. (This oper‐
ator does not require any parameter modifications.) Returns the
processor type of the CPU on which the application process or
thread is currently running. The processor type, as defined in
<machine/cpuconf.h>, is returned in the lower 32 bits of the
buffer. The higher 32 bits are processor dependent (not always
zero) and should be masked off. long Specifies the size of the
user buffer.
Processor type can vary among the CPUs in a multiprocessor sys‐
tem that supports CPUs of mixed types, speeds, and cache sizes.
Therefore, information returned by the GSI_PROC_TYPE operation
of the getsysinfo() does not necessarily apply to all system
CPUs, only to the one on which the process or thread is cur‐
rently running. Use the TBL_PROCESSOR_INFO operation of the ta‐
ble() function to get information about all the CPUs in the sys‐
tem. See table(2). Reserved for future use. Returns the value
of a specified console environment variable (for example, boot‐
def_dev). If the variable is disabled due to a known firmware
problem, then errno is set to EACCES. Specifies the location
where the value is returned. A string containing the name of
the console environment variable. If the flag contains
PROM_CONVERT_TYPE (defined in <prom.h>), then the kernel does
value conversion. Device values are converted from their native
bootstring format to a Tru64 UNIX device name. For example, a
GSI_PROM_ENV of a device variable like booted_dev will return a
string similar to dsk1 instead of SCSI 0 11 0 5 2 0 0. Integer
values are returned in a hexadecimal string format, like 0x3F.
See EXAMPLES for a code fragment that shows how to use
GSI_PROM_ENV. For internal use only by the consvar utility. See
consvar(8) for information about this utility. For internal use
only. Returns the root device descriptor in the form of a
dev_t. long Specifies the size of the user buffer. Returns the
first SCS CI port number for SCS_SYSID in the form of a u_short.
u_short Specifies the size of the user buffer. For internal use
only by the sysconf() function. See sysconf(3) for information
about querying the _SC_SIGQUEUE_MAX variable with the sysconf()
function. For internal use only by the sizer utility. See
sizer(8) for information about using this utility. Returns an
Assign_entry structure, which is defined in the <sys/conf.h>
header file. struct aentry Specifies the size of the user buf‐
fer. Obsolete operation. Returns a specified system identifier
string that can be reset by a Value-Added Reseller (VAR) of the
operating system software when the kernel is built. This strings
are defined in the /sys/conf/version.* files that are included
in the kernel at build time and can be overridden by version_*
entries in the /etc/sysconfigtab database that is dynamically
loaded when the system boots. See also GSI_VERSIONSTRING, which
returns a string that is partially dependent on these defini‐
tions. char buffer[size] Specifies the size of buffer. Speci‐
fies one of the following: Software banner. Vendor name. Prod‐
uct name. Product version. Abbreviated vendor name. For
internal use only by the sysconf() function. See sysconf(3) for
information about using sysconf() to query the _SC_TIMER_MAX
variable. For internal use only by TruCluster software.
Returns the number of cycles completed by the memory troller on
each RAD. long laps[rad_get_max()] At least as many bytes as
determined by rad_get_max()*sizeof(long)
Each entry in the returned array is set to the number of laps
completed on the RAD whose number corresponds to that entry's
index. Use of rad_get_max() requires an include statement for
<numa.h>. Returns the memory troller's run status. An include
statement for <sys/numa_types.h> is required for the status
(state) definitions. int state
The value returned for state is one of the following: Troller is
not supported. Troller is running. Troller is either stopping
or starting. Troller is not running. At least as many bytes as
determined by sizeof(int). Returns the major and minor numbers
of the controlling terminal. dev_t Specifies the size of the
user buffer. Returns the parent UAC setting in buffer. This
setting is determined by the setsysinfo(2) SSIN_UACPARNT opera‐
tion, which allows users to specify their own unaligned access
control (UAC) mechanism. By default, when the operating system
accesses unaligned data, it fixes the unaligned accesses and
displays a warning message so that the programmer can make the
necessary alternations in the code. Meanwhile, however, the pro‐
gram behaves correctly because the operating system has made the
necessary temporary adjustments. int Specifies the size of the
user buffer.
See EXAMPLES for an example that uses GSI_UACPARNT. Returns the
process UAC setting in buffer. This setting is determined by the
setsysinfo(2) SSIN_UACPROC operation, which allows users to
specify their own unaligned access control (UAC) mechanism. By
default, when the operating system accesses unaligned data, it
fixes the unaligned accesses and displays a warning message so
that the programmer can make the necessary alternations in the
code. Meanwhile, however, the program behaves correctly because
the operating system has made the necessary temporary adjust‐
ments. int Specifies the size of the user buffer. Returns the
system UAC setting in buffer. This setting is determined by the
setsysinfo(2) SSIN_UACSYS operation, which allows the superuser
to specify his or her own unaligned access control (UAC) mecha‐
nism. By default, when the operating system accesses unaligned
data, it fixes the unaligned accesses and displays a warning
message so that the programmer can make the necessary alterna‐
tions in the code. Meanwhile, however, the program behaves cor‐
rectly because the operating system has made the necessary tem‐
porary adjustments. int Specifies the size of the user buffer.
Returns the operating system version string that is constructed
when the kernel is built. This string is partly configurable by
value-added resellers of operating system software and is the
same string returned by the sizer -v command. See also GSI_SYS‐
TEM_ID. char Specifies the size of buffer. Not implemented.
This operation returns an error (EINVAL) on Alpha platforms.
Returns the current console device, graphics (0) or alternate
(1), in the form of an int. int Specifies the size of the user
buffer. Returns the Workstation Display Type information in the
form of an int. int Specifies the size of the user buffer.
Returns the Workstation Display Units information in the form of
an int. This value is bit-significant; each “on” bit indicates
the presence of a graphics head. int Specifies the size of the
user buffer.
RETURN VALUES
Upon successful completion, the getsysinfo system call returns a value
indicating the number of requested items stored in buffer. If the
information requested by op is not available, getsysinfo returns a (0)
zero. Otherwise, -1 is returned, and the global variable errno is set
to indicate the error.
ERRORS
The list of mapped PFNs is too large for the provided buffer. Either
buffer, start, or arg causes an illegal address to be referenced. The
op parameter is invalid. Permission is denied for the operation
requested. The list of returned PFNs is too large for the provided
buffer.
EXAMPLES
In the following example, the getsysinfo operation, GSI_UACPARNT,
returns the parent UAC setting in the buffer.
#include <sys/sysinfo.h> #include <machine/hal_sysinfo.h> . .
. long buf1; . . . error = getsysinfo(GSI_UACPARNT, &buf1,
4, 0, 0); In the following example, the getsysinfo operation
GSI_PROM_ENV returns the value of the named console environment
variable. PROM_CONVERT_TYPE indicates that the kernel should do
value conversion and MAX_ENVIRON_LENGTH specifies the maximum
length of the console prom environment value.
#include <machine/prom.h>
char evname[]="booted_dev"; char evval[MAX_ENVIRON_LENGTH]; int
start=0,status;
status = getsysinfo (GSI_PROM_ENV, evval, MAX_ENVIRON_LENGTH,
&start, evname, PROM_CONVERT_TYPE); In the
following example, you can print the names of all the configured
busses in the system. You call getsysinfo in a loop to obtain
all the internal bus structures. The first call to getsysinfo
passes a -1 as the value of the start parameter:
#include <sys/sysconfig.h> #include <sys/systeminfo.h> #include
<io/common/devdriver.h> #include <machine/hal_sysinfo.h>
main () {
printf("Exercising getsysinfo\n\n");
print_bus(-1); }
print_bus(caddr_t busaddr) { struct bus bus;
char bus_name[20]; int status;
do {
if (getsysinfo(GSI_BUS_STRUCT, &bus, sizeof(struct
bus),
busaddr, 0) == -1) {
break;
}
/*** note busaddr is now a valid bus address ***/
if (bus.alive & ALV_ALIVE) {
bzero(bus_name, sizeof(bus_name));
if ( getsysinfo(GSI_BUS_NAME, bus_name,
sizeof(bus_name), busaddr, 0) != -1) {
printf("bus_name = %s", bus_name);
printf("bus_num = %d\n", bus.bus_num);
}
/*** print all buses connected to this bus ***/
if (bus.bus_list) {
print_bus( (caddr_t)bus.bus_list);
}
}
/*** next bus in topology ***/
} while(busaddr = (caddr_t)bus.nxt_bus);
}
SEE ALSO
Functions: setsysinfo(2), table(2)getsysinfo(2)