diff options
author | kn <kn@cvs.openbsd.org> | 2020-01-17 22:49:55 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2020-01-17 22:49:55 +0000 |
commit | 2969d729dfaa4195ed418c306f4dc705e5d57941 (patch) | |
tree | 46687177f01ed664ded8f2c93e7d6c5a0517f15d /usr.sbin/ldomctl | |
parent | 379cc1d7bfaba1dd861b5cdaf35d6b4a71ba47d1 (diff) |
Implement "panic -c" just like "start -c"
Requested by Andrew Grillet
OK kettenis
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r-- | usr.sbin/ldomctl/ldomctl.8 | 10 | ||||
-rw-r--r-- | usr.sbin/ldomctl/ldomctl.c | 29 |
2 files changed, 31 insertions, 8 deletions
diff --git a/usr.sbin/ldomctl/ldomctl.8 b/usr.sbin/ldomctl/ldomctl.8 index 308893da8d0..93d29ff38fc 100644 --- a/usr.sbin/ldomctl/ldomctl.8 +++ b/usr.sbin/ldomctl/ldomctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldomctl.8,v 1.26 2020/01/16 16:46:47 schwarze Exp $ +.\" $OpenBSD: ldomctl.8,v 1.27 2020/01/17 22:49:54 kn 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: January 16 2020 $ +.Dd $Mdocdate: January 17 2020 $ .Dt LDOMCTL 8 sparc64 .Os .Sh NAME @@ -84,13 +84,17 @@ and the configuration which will be used next (after resetting the machine) if it differs from the currently running one. .It Cm list-io List available PCIe devices. -.It Cm panic Ar domain +.It Cm panic Oo Fl c Oc Ar domain Panic a guest domain. The exact behaviour of this command depends on the OS running in the domain. For .Ox the default behaviour is to enter .Xr ddb 4 . +.Bl -tag -width 3n +.It Fl c +Automatically connect to the guest console. +.El .It Cm select Ar configuration Select the next logical domain configuration to use (after resetting the machine). diff --git a/usr.sbin/ldomctl/ldomctl.c b/usr.sbin/ldomctl/ldomctl.c index be9fbd3f23d..89553f9c70f 100644 --- a/usr.sbin/ldomctl/ldomctl.c +++ b/usr.sbin/ldomctl/ldomctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldomctl.c,v 1.36 2020/01/17 10:50:20 kn Exp $ */ +/* $OpenBSD: ldomctl.c,v 1.37 2020/01/17 22:49:54 kn Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -131,8 +131,8 @@ usage(void) "\t%1$s dump|list|list-io\n" "\t%1$s init-system [-n] file\n" "\t%1$s create-vdisk -s size file\n" - "\t%1$s start [-c] domain\n" - "\t%1$s console|panic|status|stop [domain]\n", + "\t%1$s panic|start [-c] domain\n" + "\t%1$s console|status|stop [domain]\n", getprogname()); exit(EXIT_FAILURE); @@ -503,19 +503,35 @@ guest_panic(int argc, char **argv) { struct hvctl_msg msg; ssize_t nbytes; + uint64_t gid; + int ch, console = 0; - if (argc != 2) + while ((ch = getopt(argc, argv, "c")) != -1) { + switch (ch) { + case 'c': + console = 1; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc != 1) usage(); hv_config(); + gid = find_guest(argv[0]); + /* * 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]); + msg.msg.guestop.guestid = gid; nbytes = write(hvctl_fd, &msg, sizeof(msg)); if (nbytes != sizeof(msg)) err(1, "write"); @@ -524,6 +540,9 @@ guest_panic(int argc, char **argv) nbytes = read(hvctl_fd, &msg, sizeof(msg)); if (nbytes != sizeof(msg)) err(1, "read"); + + if (console) + console_exec(gid); } void |