swapctl.2 (2010 09)

s
swapctl(2) swapctl(2)
The SC_LIST Command
For the SC_LIST command, arg parameter is a pointer to the
swaptable structure with following
members:
int swt_n
swapctl_flags_t swt_flag
struct swapent swt_ent []
where:
swt_n Specifies the maximum entries that will be returned by
swapctl().
swt_ent Is an array of swt_n
swapents. Currently the
SC_LIST command can be used to
list the primary swap configured for next boot, so the array size for the
swapent
structures is 1.
swt_flag sr_flag is
SW_PRIMARY | SW_NEXTBOOT
.
The flag indicates that the swap resource that is marked as swap for the next boot
be listed. This will only work if the primary swap device was configured using the
SC_ADD command. Devices that have been configured for use by methods other
than swapctl() can not be listed by the
SC_LIST command.
The
swapent structure will return the information in the following fields:
char *ste_path
nt64_t ste_start
nt64_t ste_length
ev_t ste_dev
Before swapctl() is issued, allocate memory to all of the ste_path pointers. Ensure that each of the
areas allocated is at least MAXPATHLEN bytes long. MAXPATHLEN is defined in <sys/param.h>
.
The fields are defined as follows:
*ste_path Specifies the name of the swap device.
ste_dev Specifies the device number corresponding to the ste_path .
ste_priority Specifies the priority at which the device was configured.
ste_start Specifies in 512-byte blocks, the starting block to begin swapping.
ste_length Specifies in 512-byte blocks, the length of the swap area.
ste_dev Specifies the device number corresponding to the ste_path.
The
SC_LIST command for now only lists the primary swap device that is configured for next boot. The
pstst_getswap() interface has to be used to get the list of all other swap resources.
RETURN VALUES
On success, the
swapctl() system call returns 0 when used with the SC_ADD or SC_REMOVE com-
mands. For the SC_LIST command, the number of struct swapent entries actually returned indi-
cates success.
On error, the
swapctl() system call returns a value of -1 and sets errno to indicate the error.
ERRORS
If the
swapctl() system call fails, errno is set to one of the following:
[EACCES] A component of the sr_name prefix denies search permission.
[EACCES] The input device pointer to be sr_name has a logical volume on it.
[EALREADY] For
SC_ADD, the device associated with sr_name already has swap turned on.
[EBUSY] The device associated with sr_name is already in use.
[EEXIST] For primary swap configuration, indicates that a swap device is already configured
as primary swap for next boot. It should be removed using the
SC_REMOVE com-
mand before a new one can be added.
[EIO] Unable to read the device associated with sr_name .
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3