sysi86(2) sysi86(2)
NAME
sysi86 - machine-specific functions
SYNOPSIS
#include <sys/sysi86.h>
int sysi86(int cmd, . . .);
DESCRIPTION
The sysi86 system call implements machine-specific functions.
The cmd argument determines the function to be performed. The
types of the arguments expected depend on the function.
Command RTODC
When cmd is RTODC, the expected argument is the address of a
struct rtc_t (from the header file sys/rtc.h) which contains
the following members:
char rtc_sec, rtc_asec, rtc_min, rtc_amin,
rtc_hr, rtc_ahr, rtc_dow, rtc_dom,
rtc_mon, rtc_yr, rtc_statusa,
rtc_statusb, rtc_statusc, rtc_statusd;
This function reads the hardware time-of-day clock and returns
the data in the structure referenced by the argument. The
calling process must have the P_SYSOPS privilege to use this
command.
Command RDUBLK
This command reads the u-block (per process user information
as defined by struct user in the sys/user.h header file) for a
given process. When cmd is RDUBLK, sysi86 takes three
additional arguments: the process ID, the address of a buffer,
and the number of bytes to read; that is,
sysi86(RDUBLK, pid_t pid, char *buf, int n)
Command SI86FPHW
This command expects the address of an integer as its
argument. After successful return from the system call, the
integer specifies how floating-point computation is supported.
The low-order byte of the integer contains the value of
``fpkind,'' a variable that specifies whether an 80287 or
80387 floating-point coprocessor is present, emulated in
software, or not supported. The values are defined in the
header file sys/fp.h.
Copyright 1994 Novell, Inc. Page 1
sysi86(2) sysi86(2)
FP_NO no fp chip, no emulator (no fp support)
FP_SW no fp chip, using software emulator
FP_HW chip present bit
FP_287 80287 chip present
FP_387 80387 chip present
Command SETNAME
The calling process must have the P_SYSOPS privilege to use
this command. Expects an argument of type char * which points
to a NULL terminated string of at most 7 characters. The
command will change the running system's sysname and nodename
[see uname(2)] to this string.
Command STIME
When cmd is STIME, an argument of type long is expected. This
function sets the system time and date (not the hardware
clock). The argument contains the time as measured in seconds
from 00:00:00 GMT January 1, 1970. The calling process must
have the P_SYSOPS privilege to use this command.
Command SI86DSCR
This command sets a segment descriptor in the kernel. It
accepts as a descriptor executable and data segments in the
LDT at DPL 3.
The argument is a pointer to a request structure that contains
the values to be placed in the descriptor. The request
structure is declared in the sys/sysi86.h header file.
Command SI86MEM
This command returns the size of available memory in bytes.
Command SI86SWPI
When cmd is SI86SWPI, individual swapping areas may be added,
deleted or the current areas determined. The address of an
appropriately primed swap buffer is passed as the only
argument. (Refer to the sys/swap.h header file for details of
loading the buffer.)
The format of the swap buffer is:
struct swapint {
char si_cmd;/*command: SI_LIST, SI_ADD, SI_DEL*/
char *si_buf;/*swap file path pointer*/
int si_swplo;/*start block*/
int si_nblks;/*swap size*/
Copyright 1994 Novell, Inc. Page 2
sysi86(2) sysi86(2)
}
Typically, a swap area is added by a single call to sysi86.
First, the swap buffer is primed with appropriate entries for
the structure members. Then sysi86 is invoked.
The calling process must have the P_SYSOPS privilege to use
this command.
#include <sys/sysi86.h>
#include <sys/swap.h>
struct swapint swapbuf;/*swap into buffer ptr*/
sysi86(SI86SWPI, &swapbuf);
If this command succeeds, it returns 0 to the calling process.
This command fails, returning -1, if one or more of the
following is true:
EFAULT swapbuf points to an invalid address
EFAULT swapbuf.si_buf points to an invalid address
ENOTBLK
Swap area specified is not a block special device
EEXIST Swap area specified has already been added
ENOSPC Too many swap areas in use (if adding)
ENOMEM Tried to delete last remaining swap area
EINVAL Bad arguments
ENOMEM No place to put swapped pages when deleting a swap area
Command SI86IOPL
This command changes the I/O privilege level for the invoking
LWP. Setting the IOPL to 3 allows the lightweight process
(LWP) to directly perform input/output instructions to access
all hardware device ports. The calling process must have the
P_SYSOPS privilege to use this command.
The argument is an integer which is the new I/O privilege
level (0-3).
Copyright 1994 Novell, Inc. Page 3
sysi86(2) sysi86(2)
Command SI86NULLPTR
This command controls the system behavior when applications
dereference through a NULL pointer. To support existing
applications the default behavior as delivered is to enable
null-pointer dereferences. The default behavior can be
changed by changing the nullptr to enable parameter.
When null-pointer dereferences are enabled, any user program
attempt to read memory in the first page (addresses 0-4095)
will successfully return zero. When disabled, these memory
reads behave like any other bad memory reference and cause a
SIGSEGV signal to be sent to the referencing LWP. Memory
writes to page 0 always generate SIGSEGV.
The argument for SI86NULLPTR is an integer. A value of zero
disables null-pointer dereferences for the current user ID. A
value of one enables null-pointer dereferences for the current
user ID. A value of two returns the current setting.
Return Values
If sysi86 succeeds, it returns zero or a value that depends on
cmd as described above. If sysi86 fails, it returns -1 and
sets errno to identify the error.
Errors
When the cmd is invalid, errno is set to EINVAL.
Command SI86SWPI returns the errno values listed above.
REFERENCES
nullptr(1), swap(1M), uname(2)
Copyright 1994 Novell, Inc. Page 4