setsysinfo(2)setsysinfo(2)NAMEsetsysinfo - Set system information
SYNOPSIS
#include <sys/sysinfo.h> #include <machine/hal_sysinfo.h>
setsysinfo(op, buffer, nbytes, arg, flag)
unsigned long op;
datatype *buffer;
unsigned long nbytes;
datatype *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. The op value determines
which of the remaining parameters specify required information and, for
the buffer or arg (sometimes both) parameters, what datatype should be.
The buffer argument specifies the location where the system information
is stored. The nbytes argument specifies the size of buffer. When the
buffer and nbytes arguments are not required for a given op, they
should be set to NULL. The arg and flag arguments can be used by cer‐
tain op values to store information. When the flag argument or both
the argand flag arguments are not required for a given op, they should
be set to NULL.
DESCRIPTION
The setsysinfo system call modifies system information. The op argument
specifies the operation to be performed. Values for op are defined in
the <sys/sysinfo.h> and <machine/hal_sysinfo.h> header files.
Possible op values are: This operation sets the directory where a core
file is created or disables dump creation. For use with SSI_COREDIR,
the arg parameter passes the only significant information and is
defined as type char *.
The core file dumped by a privileged application contains sensi‐
tive system information; therefore, it is important that privi‐
leged applications ensure that core files are not written to
unprotected locations. For an example of using SSI_COREDIR, see
EXAMPLES.
For information about enabling or disabling application core
dumps on a systemwide basis, see the descriptions of the
dump_cores and dump_setugid_cores attributes in
sys_attrs_proc(5). For support of up to 64K file descriptors
per process. If the flag is set to one, the utask bit is set and
support for up to 64K file descriptors is enabled. Additionally,
the process's hard file limit is raised to 64K.
If the flag is set to zero, the utask bit is cleared and support
for up to 64K file descriptors is disabled. The process's hard
file limit returns to the default maximum of 4K. If the process
is using more than 4K file descriptors, the process's hard file
limit is not changed: [EINVAL] is returned. If either the
process's hard or soft limit is above 4K, that limit is set to
4K. This operation uses pairs of values or their named equiva‐
lents to modify system behavior. The buffer variable is an
array of paired values (or their named equivalents). One member
of a pair is from a set of system names defined in the <sys/sys‐
info.h> header file.
The other member can be one of the following: A_BSD, A_POSIX,
A_SYSV, a system name defined as a flag for UAC (unaligned
access control), or an IEC (Instruction Emulation Control) flag
in the <sys/proc.h> header file and set on a per task basis.
The following UAC flags can be specified in any combination:
UAC_NOPRINT, UAC_NOFIX, and UAC_SIGBUS.
UAC_NOPRINT suppresses the printing of the unaligned error mes‐
sage to the user.
UAC_NOFIX instructs the operating system not to fix the
unaligned access fault.
UAC_SIGBUS causes a SIGBUS signal to be delivered to the thread.
The following IEC flags can be specified in any combination:
IEC_VERBOSE, IEC_NOPRINT, and IEC_NOEMUL.
IEC_VERBOSE prints the instruction emulated message for each
instruction emulation, not just the first.
IEC_NOPRINT suppresses printing of the instruction emulated mes‐
sage to the user.
IEC_NOEMUL instructs the operating system to deliver a SIGILL
signal to the user instead of emulating instructions not sup‐
ported by the host processor.
UAC and IEC settings are inherited by a forked process so that
the process will have the same UAC and IEC characteristics as
its parent.
Possible name values for the first member, are: Determines
whether incoming NFS traffic is originating at a privileged port
or not. Its paired value must be 0 or 1. Reserved for future
use. This is a system-specified value that accepts the
UAC_NOPRINT flag only, as its paired value, even if other UAC
flags are specified. Accordingly, it toggles an “unaligned
access fixup” message. Use of this value is restricted to the
superuser and supersedes a user setting that requests printing.
A value that is set in the current process's parent proc struc‐
ture. This value is paired with the UAC flags UAC_NOPRINT,
UAC_NOFIX, and UAC_SIGBUS, specified in any combination with
inclusive OR. Accordingly, it toggles printing of an “unaligned
access fixup” message, fixing of UAC faults, and delivery of a
SIGBUS signal to the thread. This value is inherited across
forks and execs. If parent is init, the system call returns
[EPERM]. A value that is set in the proc structure. This value
is paired with UAC flags UAC_NOPRINT, UAC_NOFIX, and UAC_SIGBUS,
specified in any combination, with inclusive OR. Accordingly, it
toggles printing of an “unaligned access fixup” message, fixing
of UAC faults, and delivery of a SIGBUS signal to the thread.
This is a system-specified value that accepts only the
IEC_NOPRINT flag as its paired value, even if other IEC flags
are specified. Accordingly, it toggles an “instruction emulated”
message. Use of this value is restricted to the superuser and
supersedes a user setting that requests printing. A value that
is set in the current process's parent proc structure. This
value is paired with the IEC flags IEC_VERBOSE, IEC_NOPRINT, and
IEC_NOEMUL, specified in any combination with inclusive OR.
Accordingly, it toggles verbose printing of “instruction emu‐
lated”, not printing “instruction emulated”, and not emulating
instructions. This value is inherited across forks and execs. If
the parent is init, the system call returns [EPERM]. A value
that is set in the proc structure. This value is paired with the
IEC flags IEC_VERBOSE, IEC_NOPRINT, and IEC_NOEMUL, specified in
any combination, with inclusive OR. Accordingly, it toggles ver‐
bose printing of “instruction emulated”, not printing “instruc‐
tion emulated”, and not emulating instructions.
The value is a legal value for name. The nbytes argument defines
the number of pairs in buffer. The arg and flag arguments are
not used. Sets the value of a named console environment vari‐
able. If the variable is disabled due to a known firmware prob‐
lem, then errno will contain [EACCES]. Specifies the location
of the string value. A string containing the name of the con‐
sole environment variable. If the flag contains PROM_CON‐
VERT_TYPE (defined in <prom.h>), then the kernel does value con‐
version. Device values should be specified as a fully qualified
path to a device special file. For network devices, the con‐
troller name (e.g. tu2) should be provided. The kernel will
convert these device references to the native console bootstring
format. Integer values should be specified as strings, which the
kernel will convert to binary form. Saves the values of all
console environment variables to non-volatile storage. If saving
is disabled due to a known firmware problem, then errno will
contain [EACCES]. Each member of a system structure is set to
zero. The arg defines the structure type.
Possible values for arg are: NFS client statistics. NFS server
statistics. RPC statistics. The flag argument is used for a
particular arg value, to further define the operation or a
resultant action to be performed. The buffer and nbytes argu‐
ments are not used.
Permission checking is done on a structure-by-structure basis.
Each member of a system structure is set to a supplied value.
The arg defines the structure type.
Possible values for arg are as defined for SSI_STRUCT_ZERO. The
flag argument is used for a particular arg value, to further
define the operation or a resultant action to be performed. The
buffer argument is the address of a structure of the appropriate
type that contains the desired values. The nbytes argument spec‐
ifies the amount of data to be transferred that is stored at
buffer.
RETURN VALUES
A zero (0) is returned if the call succeeds. If the call fails, -1; is
returned, and the global variable errno is set to indicate the error.
ERRORS
Either buffer or arg causes an illegal address to be referenced. The
op, arg, or flag argument is invalid.
The process has more than 4K file descriptors active when a call
is issued to disable support for more than 4K file descriptors.
Permission is denied for the operation requested.
EXAMPLES
#include <sys/sysinfo.h>; #include <machine/hal_sysinfo.h>; #include
<sys/proc.h>; &. int buf[2], val, arg; . /* Don't print the warning
to the user */ buf[0] = SSIN_UACPROC; buf[1] = UAC_NOPRINT; error =
setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0); . . . /* Deliver a SIGBUS
signal and don't print the warning */ buf[0] = SSIN_UACPROC; buf[1] =
UAC_SIGBUS | UAC_NOPRINT; error = setsysinfo(SSI_NVPAIRS, buf, 1, 0,
0); The following example shows that you can pass more than one pair of
values to the SSI_NVPAIRS call. Notice that members of a pair are con‐
tiguous, and an SSI_* value appears in the even number position begin‐
ning with array position [0].
buf[0] = SSIN_UACPARNT; buf[1] = UAC_NOPRINT; buf[2] = SSIN_NSF‐
PORTMON; buf[3] = 1; if (setsysinfo(SSI_NVPAIRS, buf, 2, 0, 0) <
0)
{
perror("setsysinfo");
return;
} In the following example, the setsysinfo operation
SSI_PROM_ENV sets the value of a named console environment vari‐
able:
#include <machine/prom.h>;
char evname[]="boot_dev"; char evval[]="/dev/rz0a"; /* or
something like "tu0" */ int status; status = setsys‐
info(SSI_PROM_ENV,evval, strlen(evval)+1,
evname, PROM_CONVERT_TYPE;
The following example shows how to use SSI_COREDIR to control
the directory location where core files might be written:
#include <sys/signal.h> #include <sys/sysinfo.h> #include
<stdlib.h>
main (argc, argv) int argc; char *argv[]; {
char *coredir;
/*
* fetch core directory value from environment variable
*/
if (!(coredir = getenv("COREDIR"))) {
printf("please \"setenv COREDIR\" to desired core direc‐
tory\n");
exit(1);
}
/*
* set core directory
*/
if (setsysinfo(SSI_COREDIR, NULL, 0, coredir, 0) == -1) {
perror("setsysinfo(SSI_COREDIR)");
exit(1);
}
/*
* Now kill the process. If core dumps are allowed, the
core file will be
* written to the specified core directory.
*/
kill(getpid(), SIGSEGV);
exit(1); }
SEE ALSO
Commands: iec(1), uac(1)
Functions: getsysinfo(2)
Files: signal(4)setsysinfo(2)