update from Donn -- fixes for pcc
[unix-history] / usr / src / lib / libc / sys / swapon.2
CommitLineData
931b8415 1.\" Copyright (c) 1980, 1991 The Regents of the University of California.
88b3ccf2 2.\" All rights reserved.
1f431a5b 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
88b3ccf2 5.\"
931b8415 6.\" @(#)swapon.2 6.7 (Berkeley) %G%
1f431a5b 7.\"
931b8415
CL
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
e06acb0b 20makes the block device
931b8415 21.Fa special
e06acb0b
KM
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
931b8415 26.Fa special
e06acb0b
KM
27is calculated at the time the device is first made available
28for swapping.
931b8415
CL
29.Sh RETURN VALUES
30If an error has occurred, a value of -1 is returned and
31.Va errno
0148896a 32is set to indicate the error.
931b8415
CL
33.Sh ERRORS
34.Fn Swapon
b5984ffe 35succeeds unless:
931b8415
CL
36.Bl -tag -width ENAMETOOLONG
37.It Bq Er ENOTDIR
b5984ffe 38A component of the path prefix is not a directory.
931b8415 39.It Bq Er EINVAL
b5984ffe 40The pathname contains a character with the high-order bit set.
931b8415 41.It Bq Er ENAMETOOLONG
b5984ffe
KM
42A component of a pathname exceeded 255 characters,
43or an entire path name exceeded 1023 characters.
931b8415 44.It Bq Er ENOENT
b5984ffe 45The named device does not exist.
931b8415 46.It Bq Er EACCES
b5984ffe 47Search permission is denied for a component of the path prefix.
931b8415 48.It Bq Er ELOOP
b5984ffe 49Too many symbolic links were encountered in translating the pathname.
931b8415 50.It Bq Er EPERM
b5984ffe 51The caller is not the super-user.
931b8415
CL
52.It Bq Er ENOTBLK
53.Fa Special
fd690c8b 54is not a block device.
931b8415
CL
55.It Bq Er EBUSY
56The device specified by
57.Fa special
58has already
fd690c8b 59been made available for swapping
931b8415
CL
60.It Bq Er EINVAL
61The device configured by
62.Fa special
63was not
fd690c8b 64configured into the system as a swap device.
931b8415 65.It Bq Er ENXIO
fd690c8b 66The major device number of
931b8415 67.Fa special
fd690c8b
KM
68is out of range (this indicates no device driver exists
69for the associated hardware).
931b8415 70.It Bq Er EIO
fd690c8b 71An I/O error occurred while opening the swap device.
931b8415
CL
72.It Bq Er EFAULT
73.Fa Special
fd690c8b 74points outside the process's allocated address space.
931b8415
CL
75.Sh SEE ALSO
76.Xr swapon 8 ,
77.Xr config 8
78.Sh BUGS
1f431a5b
KM
79There is no way to stop swapping on a disk so that the pack may be
80dismounted.
931b8415 81.Pp
e06acb0b 82This call will be upgraded in future versions of the system.
931b8415
CL
83.Sh HISTORY
84The
85.Nm
86function call appeared in
87.Bx 4.0 .