DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

sysi86(S)


sysi86 -- machine-specific functions

Syntax

cc . . . -lc

#include <sys/sysi86.h>

long sysi86 (cmd, arg) 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.


RTODC
When cmd is RTODC, the expected argument is the address of a structure rtc_t (from the header file <sys/rtc.h>):

   struct rtc_t {
           char rtc_sec, rtc_asec, rtc_min, rtc_amin,
           rtc_hr, rtc_ahr, rtc_dow, rtc_dom,
           rtc_mon, rtc_yr, rtc_statusg,
           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.


NOTE: RTODC has been replaced by RTODC_CENT and is only present for backwards compatibility.


RTODC_CENT
When cmd is RTODC_CENT, the expected argument is the address of a structure rtc_cent_t (from the header file <sys/rtc.h>):

   struct rtc_cent_t {
           char rtc_sec, rtc_asec, rtc_min, rtc_amin,
           rtc_hr, rtc_ahr, rtc_dow, rtc_dom,
           rtc_mon, rtc_yr, rtc_cent, rtc_statusg,
           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. This command is available only to root.


NOTE: This ioctl includes the century number and replaces RTODC.


RDUBLK
This command reads the u-block (per process user information as defined by the user structure 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:

   sysi86(RDUBLK, pid, buf, n)
           int  pid;
           char *buf;
           ind  n;

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 specifying whether an 80287 or 80387 floating-point co-processor is present, emulated in software, or not supported. The values are defined in the header file <sys/fp.h>.


FP_NO
no fp chip, no emulator (no fp support)

FP_SW
no fp chip, using software emulator

FP_HW
chip present bit

FP_28
80287 chip present

FP_38
80387 chip present


SETNAME
This cmd, which is only available to root, expects an argument of type char * pointing to a NULL terminated string of at most 7 characters. The command changes the running system's sysname and nodename to this string. See uname(S).


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 1970-01-01 00:00 UTC. Year values in the range 00-68 refer to years in the twenty-first century (2000 to 2068 inclusive). Note that this command is only available to root.


SI86DSCR
This command sets a segment or gate descriptor in the kernel. The following descriptor types are accepted:

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.


SI86MEM
This command returns the size of available memory in bytes.


SI86SETPIPE
The argument is the name of a file. If the filesystem on which that file resides is mounted read/write, then that filesystem becomes the ``pipe filesystem.'' Anonymous pipes created with pipe(S) use i-nodes and blocks on this pipe filesystem for temporary storage of the data passing through the pipe.

If the argument is the NULL pointer, then the pipe filesystem is disabled. This causes all subsequent pipe( ) calls to fail with error ENODEV. Existing anonymous pipes are not affected.

Named pipes use the filesystem on which they reside, not the pipe filesystem, and so are never affected by SI86SETPIPE.

Only root can set or disable the pipe filesystem. Upon successful completion a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set the indicate the error:


[EPERM]
The effective user ID is not root (the superuser).

[ENOENT]
The named file does not exist.

[ENOTDIR]
A component of file's path prefix is not a directory.

[EROFS]
The filesystem is mounted read-only.

[ENODEV]
The filesystem is incapable of supporting pipes.


SI86GETPIPE
This command, which does not take an argument, returns the device number of the block special file containing the current pipe filesystem. (See command SI86SETPIPE for the definition of the ``pipe filesystem''.) Otherwise, -1 is returned and errno set to indicate the error:

[ENODEV]
No pipe filesystem currently exists.


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 <sys/swap.h> header file for details on loading the buffer.

The format of the swap buffer is:

   typedef struct swapint {
           char    si_cmd;      /* One of the command codes     */
                                /* listed below.                */
           char    *si_buf;     /* For an SI_LIST function, this*/
                                /* is a pointer to a buffer of  */
                                /* sizeof(swpt_t)*MSFILES bytes.*/
                                /* For the other cases, it is a */
                                /* pointer to a pathname of a   */
                                /* swap file.                   */
           int     si_swplo;    /* The first block number of the*/
                                /* swap file.  Used only for    */
                                /* SI_ADD and SI_DEL.           */
           int     si_nblks;    /* The size of the swap file in */
                                /* blocks.  Used only for an    */
                                /* SI_ADD request.              */
   } swpi_t;
   

/* The following are the possible values for si_cmd. */

#define SI_LIST 0 /* List the currently active */ /* swap files. */ #define SI_ADD 1 /* Add a new swap file. */ #define SI_DEL 2 /* Delete one of the currently */ /* active swap files. */

Note that the add and delete options of the command may only be used by root.

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.

   #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:


[EEXIST]
Swap area specified has already been added

[EFAULT]
1. swapbuf points to an invalid address
2. swapbuf.si_buf points to an invalid address

[EINVAL]
Bad arguments

[ENOMEM]
1. Tried to delete last remaining swap area
2. No place to put swapped pages when deleting a swap area

[ENOSPC]
Too many swap areas in use (if adding).

[ENOTBLK]
Swap area specified is not a block special device

Return value

Upon error, -1 is returned and errno is set to indicate the error. When the cmd is invalid, errno is set to EINVAL.

Notes

Normally after booting, the pipe filesystem is initially and automatically set by the system to be the root filesystem. However, if the system is booted with a read-only root, which is normally done only for installation (see boot(HW)), then there is no initial pipe filesystem and the pipe(ADM) command should be used once a suitable filesystem is mounted.

pathconf(S) can be used to determine whether or not a filesystem supports pipes.

See also

pathconf(S), pipe(S), uname(S), pipe(ADM), swap(ADM)

Standards conformance

The sysi86 system call is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003