]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swapoff: do not use 1 exist status at all
authorKarel Zak <kzak@redhat.com>
Thu, 28 May 2020 10:51:26 +0000 (12:51 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 28 May 2020 10:51:26 +0000 (12:51 +0200)
The make sure we are not in collision with old versions.

Addresses: https://github.com/karelzak/util-linux/issues/1050
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/swapoff.c
sys-utils/swapon.8

index dade6fd5e9620e20c5f907ee183e167709ed0c90..7bfb90a3e7810514fb8666360f5c079dde3e61fa 100644 (file)
@@ -26,9 +26,9 @@ static int all;
 #define CANONIC        1
 
 #define SWAPOFF_EX_OK          0       /* no errors */
-#define SWAPOFF_EX_ENOMEM      1       /* swapoff(2) failed due to OOM */
-#define SWAPOFF_EX_FAILURE     2       /* swapoff(2) failed due to another reason */
-#define SWAPOFF_EX_SYSERR      4       /* non-swaoff() errors */
+#define SWAPOFF_EX_ENOMEM      2       /* swapoff(2) failed due to OOM */
+#define SWAPOFF_EX_FAILURE     4       /* swapoff(2) failed due to another reason */
+#define SWAPOFF_EX_SYSERR      8       /* non-swaoff() errors */
 #define SWAPOFF_EX_USAGE       16      /* usage, permissions or syntax error */
 #define SWAPOFF_EX_ALLERR      32      /* --all all failed */
 #define SWAPOFF_EX_SOMEOK      64      /* --all some failed some OK */
index e43ceb54f273ec53d1cb3db4591489feb08b4ed9..b10076c9082220e242dd4ff05c4e812eb26421d2 100644 (file)
@@ -189,18 +189,18 @@ Be verbose.
 Display version information and exit.
 .SH EXIT STATUS
 .B swapoff
-has the following exit status values:
+has the following exit status values since v2.36:
 .TP
 .B 0
 success
 .TP
-.B 1
+.B 2
 system has insufficient memory to stop swapping (OOM)
 .TP
-.B 2
+.B 4
 swapoff syscall failed for another reason
 .TP
-.B 4
+.B 8
 non-swapoff syscall system error (out of memory, ...)
 .TP
 .B 16
@@ -215,6 +215,8 @@ some swapoff succeeded on \fB\-\-all\fR
 The command \fBswapoff \-\-all\fR returns 0 (all succeeded), 32 (all failed), or 64 (some
 failed, some succeeded).
 
+The old versions before v2.36 has no documented exit status, 0 means success in all versions.
+
 .SH ENVIRONMENT
 .IP LIBMOUNT_DEBUG=all
 enables libmount debug output.