From: grunwald@foobar.cs.colorado.edu (Dirk Grunwald)
Subject: Re: determining real memory on OSF/1 3.0
Date: 1995/05/05 [thread overview]
Message-ID: <GRUNWALD.95May5120441@foobar.cs.colorado.edu> (raw)
In-Reply-To: 3odjps$231@homer.alpha.net
Look at the 'getsysinfo' man page. The GSI_PHYSMEM parameter returns
the physical memory.
getsysinfo(2) getsysinfo(2)
NAME
getsysinfo - Gets system information
SYNOPSIS
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
getsysinfo(op, buffer, nbytes, start, arg)
unsigned long op;
datatype *buffer;
unsigned long nbytes;
int *start;
datatype *arg;
PARAMETERS
op 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
Operations section in this reference page for information on the vari-
ous operations that you can specify.
buffer, nbytes
The nbytes argument defines the size of buffer. The buffer argument
specifies the location where the system information is returned and its
datatype depends on the data type of buffer.
start
The start argument is the current logical location within the internal
system table referenced by the op value. The start argument must ini-
tially be set to 0 (zero). It is updated to reflect the current logi-
cal location within the system table, so that successive executions of
getsysinfo() can retrieve information about all the system structures
specified by op.
The start argument is set to 0 when all system information requested by
op has been retrieved.
arg The optional arg argument can be used by certain op values to obtain
additional information. The arg datatype depends on the data type of
arg. When arg and/or flag are not required, they should be set to
NULL.
Operations
This section lists the various operations that you can specify with the op
parameter and any applicable PARAMETER modification.
GSI_BOOTDEV
Returns the BOOTDEV string, which is used for the installation. (This
operator does require any parameter modifications.)
GSI_BOOTEDFILE
Returns the name of the file from which the currently running kernel
was booted.
buffer
char buf[SIZE]
nbytes
Must be greater than or equal to 80.
GSI_BOOTTYPE
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).
buffer
char buf[SIZE]
nbytes
Must be greater than or equal to 10.
GSI_BUS_NAME
Returns the name of a start-selected bus.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
If start is -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.
GSI_BUS_PNAME
Returns the port name of a start-selected bus.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
If start is -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.
GSI_BUS_STRUCT
Returns a start-selected bus structure, which is defined in
<io/common/devdriver.h>.
buffer
struct bus (/usr/include/io/common/devdriver.h)
nbytes
Specifies the size of the user buffer.
start
If start is -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 buffer.
GSI_CLK_TCK
Returns the system clock's ticks-per-second value in the form of an
int. (This operator does not require any parameter modifications.)
GSI_COMPAT_MOD
Returns the address of the start-selected binary compatibility module's
configure function in the form of a pointer.
buffer
struct compat_mod which is defined in <sys/systm.h>
nbytes
Specifies size of compat_mod structure
start
Points to the compat_mod structure and returns the address of the
binary compatibility module's configure function in buffer.
GSI_CPU
Returns the CPU type (from the kernel cpu global variable) in the form
of an int.
buffer
int
nbytes
Must be no less than the size of an int.
GSI_CPUS_IN_BOX
Returns the actual number of CPUs present in the current machine in the
form of an int.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_PROC_TYPE
Returns the processor type, which is defined in <machine/cpuconf.h>.
The processor type 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.
buffer
long
nbytes
Specifies the size of the user buffer.
The GSI_PROC_TYPE operation is available only on the DEC OSF/1 Version 3.2
or later operating system.
GSI_CTLR_NAME
Returns the name of a start-selected controller.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
Points to the controller structure and returns the name of that
structure in buffer.
GSI_CTLR_PNAME
Returns the port name of a start-selected controller.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
Points to the controller structure and returns the port name of
that structure in buffer.
GSI_CTLR_STRUCT
Returns a start-selected controller structure, which is defined in
<io/common/devdriver.h>.
buffer
struct controller
nbytes
Specifies the size of the user buffer.
start
Points to the controller structure and returns that structure in
buffer.
GSI_CURRENT_CPU
Returns the number of the CPU on which the thread is currently running
in the form of a long.
buffer
long
GSI_DEV_MOD
Returns a start-selected dev_mod_t structure, which is defined in
<sys/sysconfig.h>. (This operator does require any parameter modifica-
tions.)
GSI_DEV_NAME
Returns the name of a start-selected device.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
Points to the device structure and returns the name of the device
structure in buffer.
GSI_DEV_PNAME
Returns the port name of a start-selected device.
buffer
char buf[SIZE]
nbytes
Specifies the size of the user buffer.
start
Points to the device structure and returns the port name of the
device structure in buffer.
GSI_DEV_STRUCT
Returns a start-selected device structure which is defined in
<io/common/devdriver.h>.
buffer
struct device (/usr/include/io/common/devdriver.h)
nbytes
Specifies the size of the user buffer.
start
Points to the device structure and returns that structure in
buffer.
GSI_DUMPDEV
Returns the dump device descriptor in the form of a dev_t.
buffer
dev_t
nbytes
Specifies the size of the user buffer.
GSI_DUMPINFO
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 running kernel.
buffer
struct dumpinfo
nbytes
Specifies the size of the user buffer.
GSI_GRAPHIC_RES
Returns information concerning the graphics screens present in the sys-
tem. 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 argument allows you to step through all of
the screens configured 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};
nbytes
sizeof(resolution_buffer)
start
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.
GSI_GRAPHICTYPE
Returns information concerning the graphics screens present in the sys-
tem. 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 argument allows you to step through
all the screens configured in the system (as for GSI_GRAPHIC_RES).
buffer
char buf[SIZE]
nbytes
sizeof(buff) must be at least 8 bytes. The returned value will be
exactly 8 bytes and will not be zero terminated.
start
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
system, 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.
GSI_IEEE_FP_CONTROL
Returns the mask of the currently enabled FP exceptions, defined in
<machine/fpu.h> (as "read/write flags"), in the form of a long.
buffer
long
Note: it is recommended that the libc routine ieee_fp_control() be
used instead of getsysinfo(). See the ieee(3) reference page for
information on this libc routine.
GSI_IEEE_STATE_AT_SIGNAL
Returns the values set by the user through the SSI_IEEE_STATE_AT_SIGNAL
setsysinfo(2) routine. See the IEEE specification for details.
buffer
long
Note: it is recommended that the libc routine
ieee_get_state_at_signal() be used instead of getsysinfo(). See
the ieee(3) reference page for information on this libc routine.
GSI_IPRSETUP
Returns the settings of the global kernel variables ipforwarding (in
bit 1) and ipgateway (in bit 0) for use by the iprsetup utility.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_LMF
Returns LMF (License Management Facility) kernel information. LMF
definitions are in the <sys/lmf.h> and <sys/lmfklic.h> header files.
You must specify an arg argument. The other argument values vary
depending on what you specify for arg. See the LMF header files to
determine which input arguments are required.
GSI_MAX_CPU
Returns the maximum number of CPUs possible based on current machine in
the form of an int. It is based on the highest numbered CPU found in
the machine's current hardware configuration 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 containing only two cpus in slots 0 and 3 (with the other slots
being empty) would also have a GSI_MAX_CPU value of 4.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_MAX_UPROCS
Returns the maximum number of processes allowed for each user id.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_MMAPALIGN
Returns the minimum alignment required for an address specified with
the MAP_FIXED option in the mmap(2) system call.
GSI_NETBLK
Returns the entire NETBLK structure, which is used for the network
installation.
buffer
struct netblk
nbytes
Specifies the size of buffer.
GSI_PHYSMEM
Returns the amount of physical memory, in kilobytes, in the form of an
int.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_PRESTO
Returns the size of nonvolatile RAM (NVRAM) present on systems with
PRESTO installed, in the form of a int. (This operator does require
any parameter modifications.)
GSI_PROG_ENV
Reserved for future use.
GSI_PROM_ENV
Returns the contents of the PROM environment variable specified by arg
in buffer.
buffer
char buf[MAX_ENVIRON_LENGTH] /* <machine/prom.h> */
nbytes
MAX_ENVIRON_LENGTH
arg Specifies the name of the console prom environment value.
GSI_ROOTDEV
Returns the root device descriptor in the form of a dev_t.
buffer
long
nbytes
Specifies the size of the user buffer.
GSI_SCS_SYSID
Returns the first SCS CI port number for SCS_SYSID in the form of a
u_short.
buffer
u_short
nbytes
Specifies the size of the user buffer.
GSI_SIA_PROC_CRED_VAL
Returns the SIA process authority value in the form of a long.
buffer
long
nbytes
Specifies the size of the user buffer.
GSI_STATIC_DEF
Returns an Assign_entry structure, which is defined in the <sys/conf.h>
header file.
buffer
struct aentry
nbytes
Specifies the size of the user buffer.
GSI_TTYP
Returns the major and minor numbers of the controlling terminal.
buffer
dev_t
nbytes
Specifies the size of the user buffer.
GSI_UACPARNT
Returns the parent UAC setting in buffer. This setting is determined
by the setsysinfo(2) SSI_UACPARNT 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 pro-
grammer can make the necessary alternations in the code. Meanwhile,
however, the program behaves correctly because the operating system has
made the necessary temporary adjustments.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_UACPROC
Returns the parent UAC setting in buffer. This setting is determined
by the setsysinfo(2) SSI_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 pro-
grammer can make the necessary alternations in the code. Meanwhile,
however, the program behaves correctly because the operating system has
made the necessary temporary adjustments.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_UACSYS
Returns the parent UAC setting in buffer. This setting is determined
by the setsysinfo(2) SSI_UACSYS operation, which allows the superuser
to specify his or her 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 pro-
grammer can make the necessary alternations in the code. Meanwhile,
however, the program behaves correctly because the operating system has
made the necessary temporary adjustments.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_WSD_CONS
Returns the current console device, graphics (0) or alternate (1), in
the form of an int.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_WSD_TYPE
Returns the Workstation Display Type information in the form of an int.
buffer
int
nbytes
Specifies the size of the user buffer.
GSI_WSD_UNITS
Returns the Workstation Display Units information in the form of an
int. This value is bit-significant; each "on" bit indicates the pres-
ence of a graphics head.
buffer
int
nbytes
Specifies the size of the user buffer.
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.
EXAMPLES
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
.
.
.
long buf1;
.
.
.
error = getsysinfo(GSI_UACPARNT, &buf1, 4, 0, 0);
The getsysinfo operation, GSI_UACPARNT, returns the parent UAC setting in
the buffer.
RETURN VALUES
Upon successful completion, the getsysinfo system call returns a value
indicating the number of requested items stored in buffer. If the informa-
tion requested by op is not available, getsysinfo returns a (0) zero. Oth-
erwise, -1 is returned, and the global variable errno is set to indicate
the error.
ERRORS
[EFAULT]
Either buffer, start, or arg causes an illegal address to be refer-
enced.
[EINVAL]
The op argument is invalid.
[EPERM]
Permission is denied for the operation requested.
RELATED INFORMATION
setsysinfo(2)
prev parent reply other threads:[~1995-05-05 4:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-05 4:00 determining real memory on OSF/1 3.0 Mark Palmer
1995-05-05 4:00 ` Garry
1995-05-05 4:00 ` Dan Pop
1995-05-08 4:00 ` Burkhard Neidecker-Lutz
1995-05-08 4:00 ` Dan Pop
1995-05-09 4:00 ` Burkhard Neidecker-Lutz
1995-05-09 4:00 ` Torbj|rn Lindgren
1995-05-05 4:00 ` Dan Pop
1995-05-05 4:00 ` Dirk Grunwald [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox