xref: /original-bsd/lib/libc/sys/swapon.2 (revision 4405f301)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)swapon.2	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt SWAPON 2
10.Os BSD 4
11.Sh NAME
12.Nm swapon
13.Nd add a swap device for interleaved paging/swapping
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn swapon "const char *special"
18.Sh DESCRIPTION
19.Fn Swapon
20makes the block device
21.Fa special
22available to the system for
23allocation for paging and swapping.  The names of potentially
24available devices are known to the system and defined at system
25configuration time.  The size of the swap area on
26.Fa special
27is calculated at the time the device is first made available
28for swapping.
29.Sh RETURN VALUES
30If an error has occurred, a value of -1 is returned and
31.Va errno
32is set to indicate the error.
33.Sh ERRORS
34.Fn Swapon
35succeeds unless:
36.Bl -tag -width ENAMETOOLONG
37.It Bq Er ENOTDIR
38A component of the path prefix is not a directory.
39.It Bq Er EINVAL
40The pathname contains a character with the high-order bit set.
41.It Bq Er ENAMETOOLONG
42A component of a pathname exceeded 255 characters,
43or an entire path name exceeded 1023 characters.
44.It Bq Er ENOENT
45The named device does not exist.
46.It Bq Er EACCES
47Search permission is denied for a component of the path prefix.
48.It Bq Er ELOOP
49Too many symbolic links were encountered in translating the pathname.
50.It Bq Er EPERM
51The caller is not the super-user.
52.It Bq Er ENOTBLK
53.Fa Special
54is not a block device.
55.It Bq Er EBUSY
56The device specified by
57.Fa special
58has already
59been made available for swapping
60.It Bq Er EINVAL
61The device configured by
62.Fa special
63was not
64configured into the system as a swap device.
65.It Bq Er ENXIO
66The major device number of
67.Fa special
68is out of range (this indicates no device driver exists
69for the associated hardware).
70.It Bq Er EIO
71An I/O error occurred while opening the swap device.
72.It Bq Er EFAULT
73.Fa Special
74points outside the process's allocated address space.
75.Sh SEE ALSO
76.Xr swapon 8 ,
77.Xr config 8
78.Sh BUGS
79There is no way to stop swapping on a disk so that the pack may be
80dismounted.
81.Pp
82This call will be upgraded in future versions of the system.
83.Sh HISTORY
84The
85.Nm
86function call appeared in
87.Bx 4.0 .
88