[Midnightbsd-cvs] src [11212] trunk/sbin/hastctl/hastctl.c: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jul 1 16:47:25 EDT 2018


Revision: 11212
          http://svnweb.midnightbsd.org/src/?rev=11212
Author:   laffer1
Date:     2018-07-01 16:47:24 -0400 (Sun, 01 Jul 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/sbin/hastctl/Makefile
    trunk/sbin/hastctl/hastctl.8
    trunk/sbin/hastctl/hastctl.c

Property Changed:
----------------
    trunk/sbin/hastctl/hastctl.8

Modified: trunk/sbin/hastctl/Makefile
===================================================================
--- trunk/sbin/hastctl/Makefile	2018-07-01 20:47:04 UTC (rev 11211)
+++ trunk/sbin/hastctl/Makefile	2018-07-01 20:47:24 UTC (rev 11212)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/sbin/hastctl/Makefile 250503 2013-05-11 09:51:44Z trociny $
 
 .include <bsd.own.mk>
 
@@ -19,10 +20,9 @@
 SRCS+=	y.tab.h
 MAN=	hastctl.8
 
-WARNS=	0
-
 NO_WFORMAT=
 NO_WCAST_ALIGN=
+NO_WMISSING_VARIABLE_DECLARATIONS=
 CFLAGS+=-I${.CURDIR}/../hastd
 CFLAGS+=-DHAVE_CAPSICUM
 CFLAGS+=-DINET

Modified: trunk/sbin/hastctl/hastctl.8
===================================================================
--- trunk/sbin/hastctl/hastctl.8	2018-07-01 20:47:04 UTC (rev 11211)
+++ trunk/sbin/hastctl/hastctl.8	2018-07-01 20:47:24 UTC (rev 11212)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2010 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,9 +26,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/hastctl/hastctl.8 307403 2016-10-16 22:02:50Z sevan $
 .\"
-.Dd May 24, 2013
+.Dd March 14, 2013
 .Dt HASTCTL 8
 .Os
 .Sh NAME
@@ -145,18 +146,10 @@
 will not be created on secondary node.
 .El
 .It Cm list
+Present verbose status of the configured resources.
 .It Cm status
-Present verbose status of the configured resources.
-For now, list and status commands are equivalent.
-In the near future the output of 
-.Nm
-status command will change to more terse format.
-If you use `
-.Nm
-status' for parsing in your scripts, switch to `
-.Nm
-list'.
-
+Present terse (and more easy machine-parseable) status of the configured
+resources.
 .It Cm dump
 Dump metadata stored on local component for the configured resources.
 .El
@@ -232,5 +225,5 @@
 The
 .Nm
 was developed by
-.An Pawel Jakub Dawidek Aq pjd at FreeBSD.org
+.An Pawel Jakub Dawidek Aq Mt pjd at FreeBSD.org
 under sponsorship of the FreeBSD Foundation.


Property changes on: trunk/sbin/hastctl/hastctl.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/hastctl/hastctl.c
===================================================================
--- trunk/sbin/hastctl/hastctl.c	2018-07-01 20:47:04 UTC (rev 11211)
+++ trunk/sbin/hastctl/hastctl.c	2018-07-01 20:47:24 UTC (rev 11212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2009-2010 The FreeBSD Foundation
  * All rights reserved.
@@ -28,24 +29,14 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/hastctl/hastctl.c 260006 2013-12-28 19:21:22Z trociny $");
 
 #include <sys/param.h>
-#include <sys/disk.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
 
 #include <err.h>
-#include <errno.h>
-#include <fcntl.h>
 #include <libutil.h>
-#include <limits.h>
-#include <signal.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sysexits.h>
 #include <unistd.h>
 
 #include <activemap.h>
@@ -301,8 +292,9 @@
 }
 
 static int
-control_status(struct nv *nv)
+control_list(struct nv *nv)
 {
+	pid_t pid;
 	unsigned int ii;
 	const char *str;
 	int error, ret;
@@ -341,6 +333,9 @@
 		str = nv_get_string(nv, "status%u", ii);
 		if (str != NULL)
 			printf("  status: %s\n", str);
+		pid = nv_get_int32(nv, "workerpid%u", ii);
+		if (pid != 0)
+			printf("  workerpid: %d\n", pid);
 		printf("  dirty: %ju (%NB)\n",
 		    (uintmax_t)nv_get_uint64(nv, "dirty%u", ii),
 		    (intmax_t)nv_get_uint64(nv, "dirty%u", ii));
@@ -361,10 +356,54 @@
 		    (uintmax_t)nv_get_uint64(nv, "stat_write_error%u", ii),
 		    (uintmax_t)nv_get_uint64(nv, "stat_delete_error%u", ii),
 		    (uintmax_t)nv_get_uint64(nv, "stat_flush_error%u", ii));
+		printf("    queues: "
+		    "local: %ju, send: %ju, recv: %ju, done: %ju, idle: %ju\n",
+		    (uintmax_t)nv_get_uint64(nv, "local_queue_size%u", ii),
+		    (uintmax_t)nv_get_uint64(nv, "send_queue_size%u", ii),
+		    (uintmax_t)nv_get_uint64(nv, "recv_queue_size%u", ii),
+		    (uintmax_t)nv_get_uint64(nv, "done_queue_size%u", ii),
+		    (uintmax_t)nv_get_uint64(nv, "idle_queue_size%u", ii));
 	}
 	return (ret);
 }
 
+static int
+control_status(struct nv *nv)
+{
+	unsigned int ii;
+	const char *str;
+	int error, hprinted, ret;
+
+	hprinted = 0;
+	ret = 0;
+
+	for (ii = 0; ; ii++) {
+		str = nv_get_string(nv, "resource%u", ii);
+		if (str == NULL)
+			break;
+		if (!hprinted) {
+			printf("Name\tStatus\t Role\t\tComponents\n");
+			hprinted = 1;
+		}
+		printf("%s\t", str);
+		error = nv_get_int16(nv, "error%u", ii);
+		if (error != 0) {
+			if (ret == 0)
+				ret = error;
+			printf("ERR%d\n", error);
+			continue;
+		}
+		str = nv_get_string(nv, "status%u", ii);
+		printf("%-9s", (str != NULL) ? str : "-");
+		printf("%-15s", nv_get_string(nv, "role%u", ii));
+		printf("%s\t",
+		    nv_get_string(nv, "localpath%u", ii));
+		printf("%s\n",
+		    nv_get_string(nv, "remoteaddr%u", ii));
+	}
+	return (ret);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -533,6 +572,8 @@
 		error = control_set_role(nv, argv[0]);
 		break;
 	case CMD_LIST:
+		error = control_list(nv);
+		break;
 	case CMD_STATUS:
 		error = control_status(nv);
 		break;



More information about the Midnightbsd-cvs mailing list