HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
s
swapctl(2) swapctl(2)
NAME
swapctl - manage and configure system swap space
SYNOPSIS
#include <sys/swap.h>
int swapctl(int cmd, void * arg);
PARAMETERS
cmd Specifies the operation to be performed, which includes: adding a resource, deleting a resource
reservation, and listing the swap resources.
SC_ADD Add a new swap resource to the system.
SC_LIST List the swap devices on the system. Currently only the primary swap for the
next boot will be listed, if it was configured by
SC_ADD. See the SC_LIST Com-
mand section below for more details.
SC_REMOVE Remove the swap device configured on the system. Currently only the primary
swap for the next boot will be removed. See the SC_REMOVE Command sec-
tion below for more details.
arg Specifies a pointer to a structure and is dependent on the type of command specified by the cmd
parameter. See DESCRIPTION below for more information.
DESCRIPTION
The
swapctl() system call manages system swap space by adding or deleting swap resources or return-
ing information about swap resources. The cmd parameter determines the value of the arg parameter.
Each of these commands accepts/returns information in a structure pointed to by the arg parameter. The
following sections discuss the information that should be passed in to the system call. They also explain the
information contained in these structures after a successful return.
The SC_ADD Command
For the
SC_ADD command, arg parameter is a pointer to the swapres structure with some of the follow-
ing members, depending on which type of swap is being configured:
swapctl_flags_t sr_flag
char * sr_name
int64_t sr_start
int64_t sr_length
int64_t sr_priority
int64_t sr_min
int64_t sr_lim
int64_t sr_res
where the fields are as follows:
sr_flag is one of the following:
• SW_PRIMARY | SW_NEXTBOOT (primary swap device for the next boot)
• SW_DEVICE (swap device for current boot)
• SW_FILESYS (swap file system for the current boot)
See the flag field description below for details on the usage.
*sr_name Provides the pathname of the resource that is being added.
sr_start Specifies, in 1 kilobyte blocks, the starting offset of the swap resource area.
sr_length Specifies, in 1 kilobyte blocks, the length of the swap area. Value of 0 means configure
the entire device, starting from the sr_start offset.
sr_priority Indicates the order in which the swap space from the device or file system is used. It
has a range of 0 (highest) to 10 (lowest). Swap space is taken from the lower-
numbered systems first.
sr_min (Needed for file system swap only.) Indicates the number of file system blocks that
are saved for file system use only.
466 Hewlett-Packard Company − 1 − HP-UX 11i Version 3: February 2007