setsysinfo(2) — System Calls
NAME
setsysinfo − Sets system information
SYNOPSIS
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
setsysinfo(op, buffer, nbytes, start, arg, flag)
unsigned long op;
datatype ∗buffer;
unsigned long nbytes;
int ∗start;
datatype ∗arg;
unsigned long flag;
PARAMETERS
opSpecifies 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 various 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.
startThe start argument is the current logical location within the internal system table referenced by the op value. The start argument must initially be set to 0 (zero). It is updated to reflect the current logical 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, flagThe optional arg and flag arguments 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.
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. The optional buffer and nbytes arguments are used to pass data, which varies depending upon op. When buffer and nbytes are not required, they should be set to NULL. The optional arg argument can be used with certain op values for additional information. When arg is not required, it should be set to NULL. The optional flag argument can be used with certain op and arg values for additional information. When flag is not required it should be set to NULL.
Possible op values are:
SSI_NVPAIRS
This operation uses pairs of values or their named equivalents 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/sysinfo.h> header file.
The other member can be one of the following: A_BSD, A_POSIX, A_SYSV, or a system name defined as a flag for UAC (unaligned access control) 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 message 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.
UAC settings are inherited by a forked process so that the process will have the same UAC characteristics as its parent.
Possible name values for the first member, are:
SSIN_NFSPORTMON
Determines whether incoming NFS traffic is originating at a privileged port or not. Its paired value must be 0 or 1.
SSIN_PROG_ENV
Reserved for future use.
SSIN_UACSYS
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.
SSIN_UACPARNT
A value that is set in the current process’s parent proc structure. 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 “unaligned access fixups,” 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, it returns EPERM.
SSIN_UACPROC
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, it toggles printing of “unaligned access fixups,” fixing of UAC faults, and delivery of a SIGBUS signal to the thread.
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.
SSI_ZERO_STRUCT
Each member of a system structure is set to zero. The arg defines the structure type.
Possible values for arg are:
SSIS_NFS_CLSTAT
NFS client statistics.
SSIS_NFS_SVSTAT
NFS server statistics.
SSIS_RPC_STAT
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 arguments are not used.
Permission checking is done on a structure-by-structure basis.
SSI_SET_STRUCT
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 op 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 specifies the amount of data to be transferred that is stored at buffer.
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 = setsysinf(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 contiguous, and an SSI_∗ value appears in the even number position beginning with array position [0].
buf[0] = SSIN_UACPARNT;
buf[1] = UAC_NOPRINT;
buf[2] = SSIN_NSFPORTMON;
buf[3] = 1;
if (setsysinfo(SSI_NVPAIRS, buf, 2, 0, 0) < 0)
{
perror("setsysinfo");
return;
}
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
[EFAULT]Either buffer or arg causes an illegal address to be referenced.
[EINVAL]The op, arg, or flag argument is invalid.
[EPERM]Permission is denied for the operation requested.