- Add a clearer error message for the case where swapon hits the
NSWAPDEV limit. - Don't warn about devices that are not in use in 'swapoff -a'. - Re-add behavior mistakenly removed in revision 1.44: If using 'swapon -a', do not warn if the device is already in use. PR: 46633 Submitted by: Andy Farkas <andyf@speednet.com.au> (in part) Reviewed by: mike (mentor)
This commit is contained in:
parent
1cc0669761
commit
9f419c5edf
@ -140,7 +140,7 @@ main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
if (strstr(fsp->fs_mntops, "noauto"))
|
if (strstr(fsp->fs_mntops, "noauto"))
|
||||||
continue;
|
continue;
|
||||||
if (swap_on_off(fsp->fs_spec, 0)) {
|
if (swap_on_off(fsp->fs_spec, 1)) {
|
||||||
stat = 1;
|
stat = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("%s: %sing %s as swap device\n",
|
printf("%s: %sing %s as swap device\n",
|
||||||
@ -170,14 +170,20 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
swap_on_off(char *name, int ignoreebusy)
|
swap_on_off(char *name, int doingall)
|
||||||
{
|
{
|
||||||
if ((which_prog == SWAPOFF ? swapoff(name) : swapon(name)) == -1) {
|
if ((which_prog == SWAPOFF ? swapoff(name) : swapon(name)) == -1) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EBUSY:
|
case EBUSY:
|
||||||
if (!ignoreebusy)
|
if (!doingall)
|
||||||
warnx("%s: device already in use", name);
|
warnx("%s: device already in use", name);
|
||||||
break;
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
if (which_prog == SWAPON)
|
||||||
|
warnx("%s: NSWAPDEV limit reached", name);
|
||||||
|
else if (!doingall)
|
||||||
|
warn("%s", name);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
warn("%s", name);
|
warn("%s", name);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user