Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/swapon.2
Show All 22 Lines | ||||||||||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||||||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||||||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | |||||||||||
.\" | .\" | |||||||||||
.\" @(#)swapon.2 8.1 (Berkeley) 6/4/93 | .\" @(#)swapon.2 8.1 (Berkeley) 6/4/93 | |||||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | |||||||||||
.\" | .\" | |||||||||||
.Dd March 30, 2020 | .Dd December 2, 2021 | |||||||||||
.Dt SWAPON 2 | .Dt SWAPON 2 | |||||||||||
.Os | .Os | |||||||||||
.Sh NAME | .Sh NAME | |||||||||||
.Nm swapon , swapoff | .Nm swapon , swapoff | |||||||||||
.Nd control devices for interleaved paging/swapping | .Nd control devices for interleaved paging/swapping | |||||||||||
.Sh LIBRARY | .Sh LIBRARY | |||||||||||
.Lb libc | .Lb libc | |||||||||||
.Sh SYNOPSIS | .Sh SYNOPSIS | |||||||||||
.It vm/vm_param.h | ||||||||||||
.It vm/swap_pager.h | ||||||||||||
.In unistd.h | .In unistd.h | |||||||||||
.Ft int | .Ft int | |||||||||||
.Fn swapon "const char *special" | .Fn swapon "const char *special" | |||||||||||
.Ft int | .Ft int | |||||||||||
.Fn swapoff "const char *special" | .Fn swapoff "const char *special" | |||||||||||
.Sh DESCRIPTION | .Sh DESCRIPTION | |||||||||||
The | The | |||||||||||
.Fn swapon | .Fn swapon | |||||||||||
Show All 10 Lines | ||||||||||||
is calculated at the time the device is first made available | is calculated at the time the device is first made available | |||||||||||
for swapping. | for swapping. | |||||||||||
.Pp | .Pp | |||||||||||
The | The | |||||||||||
.Fn swapoff | .Fn swapoff | |||||||||||
system call disables paging and swapping on the given device. | system call disables paging and swapping on the given device. | |||||||||||
All associated swap metadata are deallocated, and the device | All associated swap metadata are deallocated, and the device | |||||||||||
is made available for other purposes. | is made available for other purposes. | |||||||||||
.Pp | ||||||||||||
The | ||||||||||||
.Fa special | ||||||||||||
argument points to either the string that names the special device | ||||||||||||
used for swapping or the following structure | ||||||||||||
alcUnsubmitted Done Inline Actions
alc: | ||||||||||||
.Bd -literal | ||||||||||||
struct swapoff_new_args { | ||||||||||||
const char *name_old_syscall; | ||||||||||||
const char *name; | ||||||||||||
u_int flags; | ||||||||||||
}; | ||||||||||||
.Ed | ||||||||||||
that extends swapoff's interface to include optional flags. | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
The | ||||||||||||
.Va name_old_syscall | ||||||||||||
member must be initialized to | ||||||||||||
.Dv NULL | ||||||||||||
for the system to recognize the extended interface. | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
It is recommended that the whole structure be zeroed for future | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
compatibility, due to padding. | ||||||||||||
.Pp | ||||||||||||
The | ||||||||||||
.Va name | ||||||||||||
string is the special device name, same as legacy syscall argument. | ||||||||||||
.The | ||||||||||||
.Va flags | ||||||||||||
argument takes the following flags: | ||||||||||||
.Bl -tag -width SWAPOFF_FORCE | ||||||||||||
.It Dv SWAPOFF_FORCE | ||||||||||||
Overrides a very conservative check that prevents swapoff | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
if the total amount of free memory and remaining swap | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
devices space might be unsufficient for the system to continue | ||||||||||||
Done Inline Actions
alc: | ||||||||||||
operating. | ||||||||||||
.El | ||||||||||||
.Sh RETURN VALUES | .Sh RETURN VALUES | |||||||||||
If an error has occurred, a value of -1 is returned and | If an error has occurred, a value of -1 is returned and | |||||||||||
.Va errno | .Va errno | |||||||||||
is set to indicate the error. | is set to indicate the error. | |||||||||||
.Sh ERRORS | .Sh ERRORS | |||||||||||
Both | Both | |||||||||||
.Fn swapon | .Fn swapon | |||||||||||
and | and | |||||||||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |