xref: /netbsd/lib/libc/sys/swapon.3 (revision bf9ec67e)
1.\"	$NetBSD: swapon.3,v 1.10 2002/02/07 07:00:33 ross Exp $
2.\"
3.\" Copyright (c) 1980, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)swapon.2	8.1 (Berkeley) 6/4/93
35.\"
36.Dd June 4, 1993
37.Dt SWAPON 3
38.Os
39.Sh NAME
40.Nm swapon
41.Nd add a swap device for interleaved paging/swapping
42.Sh SYNOPSIS
43.Fd #include \*[Lt]unistd.h\*[Gt]
44.Ft int
45.Fn swapon "const char *special"
46.Sh DESCRIPTION
47.Bf -symbolic
48.\" This interface is available from the compatibility library, libcompat and
49This interface is provided for compatibility only and
50has been obsoleted by
51.Xr swapctl 2 .
52.Ef
53.Pp
54.Fn swapon
55makes the block device
56.Fa special
57available to the system for
58allocation for paging and swapping.  The names of potentially
59available devices are known to the system and defined at system
60configuration time.  The size of the swap area on
61.Fa special
62is calculated at the time the device is first made available
63for swapping.
64.Sh RETURN VALUES
65If an error has occurred, a value of -1 is returned and
66.Va errno
67is set to indicate the error.
68.Sh ERRORS
69.Fn swapon
70succeeds unless:
71.Bl -tag -width ENAMETOOLONG
72.It Bq Er ENOTDIR
73A component of the path prefix is not a directory.
74.It Bq Er ENAMETOOLONG
75A component of a pathname exceeded
76.Dv {NAME_MAX}
77characters, or an entire path name exceeded
78.Dv {PATH_MAX}
79characters.
80.It Bq Er ENOENT
81The named device does not exist.
82.It Bq Er EACCES
83Search permission is denied for a component of the path prefix.
84.It Bq Er ELOOP
85Too many symbolic links were encountered in translating the pathname.
86.It Bq Er EPERM
87The caller is not the super-user.
88.It Bq Er ENOTBLK
89.Fa special
90is not a block device.
91.It Bq Er EBUSY
92The device specified by
93.Fa special
94has already
95been made available for swapping
96.It Bq Er EINVAL
97The device configured by
98.Fa special
99was not
100configured into the system as a swap device.
101.It Bq Er ENXIO
102The major device number of
103.Fa special
104is out of range (this indicates no device driver exists
105for the associated hardware).
106.It Bq Er EIO
107An I/O error occurred while opening the swap device.
108.It Bq Er EFAULT
109.Fa special
110points outside the process's allocated address space.
111.El
112.Sh SEE ALSO
113.Xr swapctl 2 ,
114.Xr swapctl 8 ,
115.Xr swapon 8
116.Sh HISTORY
117The
118.Fn swapon
119function call appeared in
120.Bx 4.0
121and was removed
122.Nx 1.3
123.Sh BUGS
124This call will be upgraded in future versions of the system.
125