SWAPON(2) | System Calls Manual | SWAPON(2) |
swapon
, swapoff
— control devices for interleaved
paging/swapping
Standard C Library (libc, -lc)
#include
<unistd.h>
int
swapon
(const
char *special);
int
swapoff
(const
char *special);
The
swapon
()
system call 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.
The
swapoff
()
system call disables paging and swapping on the given device. All associated
swap metadata are deallocated, and the device is made available for other
purposes.
If an error has occurred, a value of -1 is returned and errno is set to indicate the error.
Both swapon
() and
swapoff
() can fail if:
ENOTDIR
]ENAMETOOLONG
]ENOENT
]EACCES
]ELOOP
]EPERM
]EFAULT
]Additionally, swapon
() can fail for the
following reasons:
ENOTBLK
]EBUSY
]ENXIO
]EIO
]Lastly, swapoff
() can fail if:
The swapon
() system call appeared in
4.0BSD. The swapoff
() system
call appeared in FreeBSD 5.0.
October 4, 2013 | Debian |