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