SWAPON(2)

NAME
swapon - add a swap device for interleaved paging/swapping

SYNOPSIS
int swapon(special)
char *special;

DESCRIPTION

swapon() makes the block device special available to the system for allocation for paging and swapping. The names of potentially available devices are known to the system and defined at system configuration time. The size of the swap area on special is calculated at the time the device is first made available for swapping.

RETURN VALUES

swapon() returns:

0   on success.

-1  on failure and sets errno to indicate the error.

ERRORS

EACCES
    Search permission is denied for a component of the path prefix of special.

EBUSY
    The device referred to by special has already been made available for swapping.

EFAULT
    special points outside the process's address space.

EIO An I/O error occurred while reading from or writing to the file system.

    An I/O error occurred while opening the swap device.

ELOOP
    Too many symbolic links were encountered in translating special.

ENAMETOOLONG
    The length of the path argument exceeds {PATH_MAX}.

    A pathname component is longer than {NAME_MAX} (see sysconf(2V)) while {_POSIX_NO_TRUNC} is in effect (see pathconf(2V)).

ENODEV
    The device referred to by special was not configured into the system as a swap device.

ENOENT
    The device referred to by special does not exist.

ENOTBLK
    The file referred to by special is not a block device.

ENOTDIR
    A component of the path prefix of special is not a directory.

ENXIO
    The major device number of the device referred to by special is out of range (this indicates no device driver exists for the associated hardware).

EPERM
    The caller is not the super-user.

SEE ALSO
fstab(5), config(8), swapon(8)

BUGS

There is no way to stop swapping on a disk so that the pack may be dismounted.

This call will be upgraded in future versions of the system.