summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2007-07-16 21:05:46 +0000
committermillert <millert@openbsd.org>2007-07-16 21:05:46 +0000
commit03b50a27f873af57ea7fb60026b0122f78acd4a4 (patch)
treeb49d1c68ca1935efbbd358c30044489243ed4547
parentNo need to include <sys/param.h> or <errno.h>. Also reorder includes (diff)
downloadwireguard-openbsd-03b50a27f873af57ea7fb60026b0122f78acd4a4.tar.xz
wireguard-openbsd-03b50a27f873af57ea7fb60026b0122f78acd4a4.zip
Remove dead code and fix incorrect comment. From Igor Zinovik.
-rw-r--r--sbin/swapctl/swapctl.c6
-rw-r--r--sbin/swapctl/swapctl.h6
-rw-r--r--sbin/swapctl/swaplist.c22
3 files changed, 13 insertions, 21 deletions
diff --git a/sbin/swapctl/swapctl.c b/sbin/swapctl/swapctl.c
index 8053e2436f7..09377308b4b 100644
--- a/sbin/swapctl/swapctl.c
+++ b/sbin/swapctl/swapctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swapctl.c,v 1.14 2005/04/12 06:41:57 deraadt Exp $ */
+/* $OpenBSD: swapctl.c,v 1.15 2007/07/16 21:05:46 millert Exp $ */
/* $NetBSD: swapctl.c,v 1.9 1998/07/26 20:23:15 mycroft Exp $ */
/*
@@ -208,11 +208,11 @@ main(int argc, char *argv[])
/* Dispatch the command. */
switch (command) {
case CMD_l:
- list_swap(pri, kflag, pflag, 0, 1);
+ list_swap(pri, kflag, pflag, 1);
break;
case CMD_s:
- list_swap(pri, kflag, pflag, 0, 0);
+ list_swap(pri, kflag, pflag, 0);
break;
case CMD_c:
diff --git a/sbin/swapctl/swapctl.h b/sbin/swapctl/swapctl.h
index 2d294437e9b..147ed06b199 100644
--- a/sbin/swapctl/swapctl.h
+++ b/sbin/swapctl/swapctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: swapctl.h,v 1.3 2002/02/16 21:27:38 millert Exp $ */
+/* $OpenBSD: swapctl.h,v 1.4 2007/07/16 21:05:46 millert Exp $ */
/* $NetBSD: swapctl.h,v 1.2 1997/10/10 05:39:54 mrg Exp $ */
/*
@@ -29,5 +29,5 @@
* SUCH DAMAGE.
*/
-/* pri, kflag, pflag, tflag, dolong (1 for long, 0 for short) */
-void list_swap(int, int, int, int, int);
+/* pri, kflag, pflag, dolong (1 for long, 0 for short) */
+void list_swap(int, int, int, int);
diff --git a/sbin/swapctl/swaplist.c b/sbin/swapctl/swaplist.c
index f57aed72e05..4aab6e7ed2b 100644
--- a/sbin/swapctl/swaplist.c
+++ b/sbin/swapctl/swaplist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swaplist.c,v 1.5 2007/07/16 20:59:47 millert Exp $ */
+/* $OpenBSD: swaplist.c,v 1.6 2007/07/16 21:05:46 millert Exp $ */
/* $NetBSD: swaplist.c,v 1.8 1998/10/08 10:00:31 mrg Exp $ */
/*
@@ -39,16 +39,12 @@
#include <string.h>
#include <unistd.h>
-#define dbtoqb(b) dbtob((int64_t)(b))
-
-/*
- * NOTE: This file is separate from swapctl.c so that pstat can grab it.
- */
-
#include "swapctl.h"
+#define dbtoqb(b) dbtob((int64_t)(b))
+
void
-list_swap(int pri, int kflag, int pflag, int tflag, int dolong)
+list_swap(int pri, int kflag, int pflag, int dolong)
{
struct swapent *sep, *fsep;
long blocksize;
@@ -73,7 +69,7 @@ list_swap(int pri, int kflag, int pflag, int tflag, int dolong)
rnswap, nswap);
pathmax = 11;
- if (dolong && tflag == 0) {
+ if (dolong) {
if (kflag) {
header = "1K-blocks";
blocksize = 1024;
@@ -98,7 +94,7 @@ list_swap(int pri, int kflag, int pflag, int tflag, int dolong)
totalsize += size;
totalinuse += inuse;
- if (dolong && tflag == 0) {
+ if (dolong) {
(void)printf("%-*s %*ld ", pathmax, sep->se_path, hlen,
(long)(dbtoqb(size) / blocksize));
@@ -109,11 +105,7 @@ list_swap(int pri, int kflag, int pflag, int tflag, int dolong)
sep->se_priority);
}
}
- if (tflag)
- (void)printf("%dM/%dM swap space\n",
- (int)(dbtoqb(totalinuse) / (1024 * 1024)),
- (int)(dbtoqb(totalsize) / (1024 * 1024)));
- else if (dolong == 0)
+ if (dolong == 0)
printf("total: %ldk bytes allocated = %ldk used, "
"%ldk available\n",
(long)(dbtoqb(totalsize) / 1024),