SWAPON(2)

NAME
swapon, swapoff - start/stop swapping to file/device

SYNOPSIS
#include <unistd.h>

int swapon(const char *path);
int swapoff(const char *path);

DESCRIPTION
swapon sets the swap area to the file or block device specified by path. swapoff stops swapping to the file or block device specified by path. These functions may only be used by the super-user.

RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS
Many other errors can occur if path is not valid.

EPERM
    The user is not the super-user, or more than MAX_SWAPFILES (defined to be 8 in Linux 0.99.11) are in use.

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

ENOENT
    is returned if path does not exist.

ENOMEM
    is returned if there is insufficient memory to start swapping.

CONFORMING TO
These functions are Linux specific.

NOTES
The partition or path must be prepared with mkswap(8).

SEE ALSO
mkswap(8), swapon(8), swapoff(8)