Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

swapon(1M)

privilege(5)

swapon(2)

NAME

swapon − add swap space for interleaved paging/swapping

SYNOPSIS

#include <unistd.h>

int swapon(

const char *path, ...
/* [int min,

int limit,
int reserve,]
int priority */

);

DESCRIPTION

If path names a block device file:
swapon() makes it available to the system at the specified priority for allocation for paging and swapping. 

In this form, swapon() takes only two arguments: the path to the block device file, and the priority. 

The device associated with path can be a device already known to the system, defined at system configuration time, or it can be a previously unspecified device. 

If the device was already defined at system configuration time and also has a start and/or size defined for that swap device, these values are used. 

Otherwise, if a filesystem exists on the device, swap is added following the filesystem, or if no filesystem exists, the complete device is used for swap. 

See the appropriate system administrator’s manual for information on how the size of the swap area is calculated. 

If path names a directory:
swapon() makes the blocks on the file system rooted at path, available for paging and swapping. 

The min, limit, and reserve arguments are passed and used only if the path argument names a directory. 

min indicates the number of file system blocks to take from the file system when swapon() is called. 

limit indicates the maximum number of file system blocks the swap system is allowed to take from the file system. 

reserve indicates the number of file system blocks that are saved for file system use only. 

priority indicates the order in which the swap space from this device or file system is used.  Space is taken from the lower-priority systems first. 

swapon() can be used only by users who have appropriate privileges. 

ERRORS

swapon() fails if any of the following conditions are encountered:

[EALREADY] The device or directory associated with path already has swap turned on. 

[ENXIO] The device associated with path could not be opened. 

[EBUSY] The device associated with path is already in use. 

[ENODEV] The device associated with path does not exist. 

[EPERM] The effective user ID is not a user with appropriate privileges. 

[ELOOP] Too many symbolic links were encountered in translating the path name. 

[ENOTBLK] The path argument is not a block special file or the root directory of a file system. 

[ENOENT] The system-imposed limit on the number of swap file entries has been reached. 

[ENOSPC] There is is not enough available space on the specified file system or device. 

[EINVAL] The node (see cluster(1M)) attempting to add swap had no swap configured at boot time.

[ENOSYS] The device associated with path was specified at system configuration time to add swap following the file system, but no file system was found. 

[EEXIST] The device associated with path was specified at system configuration time to add swap at a specified location, but that location is within an existing file system on the device. 

[EIO] Unable to read the device associated with path. 

[EROFS] The device associated with path is read-only. 

[EFAULT] The LIF header on the device associated with path contains inconsistent directory data. 

[ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. 

WARNINGS

No means is available to stop swapping to a device. 

The system allocates no less than the amount specified in min. However, to make the most efficient use of space, more than the amount requested might be taken from the file system. The actual amount taken will not exceed the number of file system blocks indicated in reserve.

Swapping to a file system is usually slower than swapping to a device. 

AUTHOR

swapon() was developed by the University of California, Berkeley. 

SEE ALSO

swapon(1M), privilege(5). 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026