Penguin
Annotated edit history of swapon(2) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 SWAPON
2 !!!SWAPON
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 PRIORITY
7 RETURN VALUE
8 ERRORS
9 CONFORMING TO
10 NOTES
11 SEE ALSO
12 ----
13 !!NAME
14
15
16 swapon, swapoff - start/stop swapping to file/device
17 !!SYNOPSIS
18
19
20 __#include __
21 #include __
22 #include __
23
24
25 __int swapon(const char *__''path''__, int__
26 ''swapflags''__);
27 int swapoff(const char
28 *__''path''__);__
29 !!DESCRIPTION
30
31
32 __swapon__ sets the swap area to the file or block device
33 specified by ''path''. __swapoff__ stops swapping to
34 the file or block device specified by
35 ''path''.
36
37
38 __swapon__ takes a ''swapflags'' argument. If
39 ''swapflags'' has the ''SWAP_FLAG_PREFER'' bit turned
40 on, the new swap area will have a higher priority than
41 default. The priority is encoded as:
42
43
44 ''(prio
45 ''
46
47
48 These functions may only be used by the
49 super-user.
50 !!PRIORITY
51
52
53 Each swap area has a priority, either high or low. The
54 default priority is low. Within the low-priority areas,
55 newer areas are even lower priority than older
56 areas.
57
58
59 All priorities set with ''swapflags'' are high-priority,
60 higher than default. They may have any non-negative value
61 chosen by the caller. Higher numbers mean higher
62 priority.
63
64
65 Swap pages are allocated from areas in priority order,
66 highest priority first. For areas with different priorities,
67 a higher-priority area is exhausted before using a
68 lower-priority area. If two or more areas have the same
69 priority, and it is the highest priority available, pages
70 are allocated on a round-robin basis between
71 them.
72
73
74 As of Linux 1.3.6, the kernel usually follows these rules,
75 but there are exceptions.
76 !!RETURN VALUE
77
78
79 On success, zero is returned. On error, -1 is returned, and
80 ''errno'' is set appropriately.
81 !!ERRORS
82
83
84 Many other errors can occur if ''path'' is not
85 valid.
86
87
88 __EPERM__
89
90
91 The user is not the super-user, or more than
92 __MAX_SWAPFILES__ (defined to be 8 in Linux 1.3.6) are in
93 use.
94
95
96 __EINVAL__
97
98
99 is returned if ''path'' exists, but is neither a regular
100 path nor a block device.
101
102
103 __ENOENT__
104
105
106 is returned if ''path'' does not exist.
107
108
109 __ENOMEM__
110
111
112 is returned if there is insufficient memory to start
113 swapping.
114 !!CONFORMING TO
115
116
117 These functions are Linux specific and should not be used in
118 programs intended to be portable. The second `swapflags'
119 argument was introduced in Linux 1.3.2.
120 !!NOTES
121
122
123 The partition or path must be prepared with
124 mkswap(8).
125 !!SEE ALSO
126
127
128 mkswap(8), swapon(8),
129 swapoff(8)
130 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.