swap(2) CLIX swap(2)
NAME
swap - Controls system swap space
LIBRARY
Intergraph XIO Library (libix.a)
SYNOPSIS
#include <sys/swap.h>
int swap(
swpi_t *si );
PARAMETERS
si Points to a structure (see the DESCRIPTION section.)
DESCRIPTION
The swap() function provides a mechanism for adding or deleting a swap
partition on a system, and for listing the current contents of the system
swap table.
The si parameter points to a structure with the following members:
char si_cmd; /* command code */
char *si_buf; /* pointer to a buffer or pathname */
int si_swplo; /* first block number of the file */
int si_nblks; /* size of swap file in blocks */
The si_cmd member contains one of the listed commands:
SI_LIST Obtain a listing of the current contents of the system swap
table. The si_buf parameter points to a buffer with
sizeof(swpi_t)*MSFILES bytes.
SI_ADD Add a swap partition to the system swap table. The si_buf
member points to the pathname of the swap partition. The
si_swplo member is the first block of the swap partition, and
si_nblks is the size, in blocks, of the swap partition.
SI_DEL Delete a swap partition from the system swap table. The si_buf
member points to the pathname of the swap partition. The
si_swplo member is the first block of the swap partition.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to si_buf to indicate the error.
2/94 - Intergraph Corporation 1
swap(2) CLIX swap(2)
ERRORS
The swap() function fails if one or more of the following is true:
[EFAULT]
The value of si points to a location outside the allocated address
space, or some part of the buffer pointed to by the si_buf of the
SI_LIST command is outside the allocated space for the process
[EPERM]
The current user is not the superuser.
[ENOENT]
The swap partition to be added or deleted is not valid.
[ENOTBLK]
The swap partition is not a block special file.
[EEXIST]
The swap partition to be added is already in the system swap table.
[EINVAL]
The si_cmd contains an unknown command, or the swap partition to be
deleted is not in the system swap table.
[ENOSPC]
The system swap table is full.
[ENOMEM]
The user attempts to delete the last swap partition or requests the
removal of a swap partition, which would leave the system with
fewer swap pages than the minimum required.
RELATED INFORMATION
Commands: swap(8)
2 Intergraph Corporation - 2/94