summaryrefslogtreecommitdiffstats
path: root/sbin/swapon
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-02-24 08:51:31 +0000
committerdas <das@FreeBSD.org>2003-02-24 08:51:31 +0000
commit9f419c5edf00e02a97a43f46dc63e834a7e61c97 (patch)
treed318d0a4d20bbbb215389c6d5d3dad61c5062550 /sbin/swapon
parent1cc066976197e51dd191b3dda3c7e85ba6675a4f (diff)
downloadFreeBSD-src-9f419c5edf00e02a97a43f46dc63e834a7e61c97.zip
FreeBSD-src-9f419c5edf00e02a97a43f46dc63e834a7e61c97.tar.gz
- 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)
Diffstat (limited to 'sbin/swapon')
-rw-r--r--sbin/swapon/swapon.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index 82af8be..ae88c8c 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -140,7 +140,7 @@ main(int argc, char **argv)
continue;
if (strstr(fsp->fs_mntops, "noauto"))
continue;
- if (swap_on_off(fsp->fs_spec, 0)) {
+ if (swap_on_off(fsp->fs_spec, 1)) {
stat = 1;
} else {
printf("%s: %sing %s as swap device\n",
@@ -170,14 +170,20 @@ main(int argc, char **argv)
}
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) {
switch (errno) {
case EBUSY:
- if (!ignoreebusy)
+ if (!doingall)
warnx("%s: device already in use", name);
break;
+ case EINVAL:
+ if (which_prog == SWAPON)
+ warnx("%s: NSWAPDEV limit reached", name);
+ else if (!doingall)
+ warn("%s", name);
+ break;
default:
warn("%s", name);
break;
OpenPOWER on IntegriCloud