SWAPON(2)

NAME
swapon - set swap file/device.

SYNOPSIS
#include <unistd.h>
int swapon(const char *file);

DESCRIPTION
swapon() sets the swap area to the file or block device specified by *file.

swapon() may only be called by the super user, and may only be called once successfully. 0 is returned on success, and a printk() (console message) made telling how much swap space was added. On failure, a negative value is returned.

ERRORS
-EBUSY is returned when there already is a swap file or swap device.

-EINVAL is returned if file exists, but is neither a regular file nor a block device.

-ENOENT is returned if file does not exist.

-ENOMEM is returned if there is insufficient memory to start swapping. -EPERM is returned if non-root users attempt to call swapon().

FILES
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO

BUGS
There is no way to turn off swapping or change devices. The partition or file must be prepared with mkswap(1).