summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-12-09 20:24:54 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-12-09 20:24:54 +0000
commit922fdfa87cdb0cdc29ad2b035b810e17334150c8 (patch)
treeeafb522331f5c24616fcab887873edfd51b051a3
parent8644b0ff65180a0817cb9ec4424a314a72c5e1b9 (diff)
Implement panic command.
-rw-r--r--usr.sbin/ldomctl/ldomctl.810
-rw-r--r--usr.sbin/ldomctl/ldomctl.c32
2 files changed, 38 insertions, 4 deletions
diff --git a/usr.sbin/ldomctl/ldomctl.8 b/usr.sbin/ldomctl/ldomctl.8
index 58048d2c34d..610f758d0ad 100644
--- a/usr.sbin/ldomctl/ldomctl.8
+++ b/usr.sbin/ldomctl/ldomctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ldomctl.8,v 1.3 2012/11/29 22:15:49 kettenis Exp $
+.\" $OpenBSD: ldomctl.8,v 1.4 2012/12/09 20:24:53 kettenis Exp $
.\"
.\" Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 29 2012 $
+.Dd $Mdocdate: December 9 2012 $
.Dt LDOMCTL 8 sparc64
.Os
.Sh NAME
@@ -37,12 +37,18 @@ The following commands are available:
Start a domain.
.It Cm stop Ar domain
Stop a domain.
+.It Cm panic Ar domain
+Panic a domain.
+The exact behaviour of this command depends on the OS running in the domain.
+For OpenBSD the default behaviour is to enter
+.Xr ddb 4 .
.It Cm status Op Ar domain
Display status information for
.Ar domain ,
or for all domains running on the system.
.El
.Sh SEE ALSO
+.Xr ddb 4 ,
.Xr ldomd 8
.Sh HISTORY
The
diff --git a/usr.sbin/ldomctl/ldomctl.c b/usr.sbin/ldomctl/ldomctl.c
index d6cbf172d30..27ee1a0d61f 100644
--- a/usr.sbin/ldomctl/ldomctl.c
+++ b/usr.sbin/ldomctl/ldomctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldomctl.c,v 1.18 2012/11/28 11:17:23 kettenis Exp $ */
+/* $OpenBSD: ldomctl.c,v 1.19 2012/12/09 20:24:53 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -54,6 +54,7 @@ void xselect(int argc, char **argv);
void delete(int argc, char **argv);
void guest_start(int argc, char **argv);
void guest_stop(int argc, char **argv);
+void guest_panic(int argc, char **argv);
void guest_status(int argc, char **argv);
void init_system(int argc, char **argv);
@@ -65,6 +66,7 @@ struct command commands[] = {
{ "delete", delete },
{ "start", guest_start },
{ "stop", guest_stop },
+ { "panic", guest_panic },
{ "status", guest_status },
{ "init-system", init_system },
{ NULL, NULL }
@@ -157,7 +159,7 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s start|stop domain\n", __progname);
+ fprintf(stderr, "usage: %s start|stop|panic domain\n", __progname);
fprintf(stderr, " %s status [domain]\n", __progname);
exit(EXIT_FAILURE);
}
@@ -399,6 +401,32 @@ guest_stop(int argc, char **argv)
}
void
+guest_panic(int argc, char **argv)
+{
+ struct hvctl_msg msg;
+ ssize_t nbytes;
+
+ if (argc < 2)
+ usage();
+
+ /*
+ * Stop guest domain.
+ */
+ bzero(&msg, sizeof(msg));
+ msg.hdr.op = HVCTL_OP_GUEST_PANIC;
+ msg.hdr.seq = hvctl_seq++;
+ msg.msg.guestop.guestid = find_guest(argv[1]);
+ nbytes = write(hvctl_fd, &msg, sizeof(msg));
+ if (nbytes != sizeof(msg))
+ err(1, "write");
+
+ bzero(&msg, sizeof(msg));
+ nbytes = read(hvctl_fd, &msg, sizeof(msg));
+ if (nbytes != sizeof(msg))
+ err(1, "read");
+}
+
+void
guest_status(int argc, char **argv)
{
struct hvctl_msg msg;