utility to halt a rump kernel

This commit is contained in:
pooka 2010-12-12 12:48:30 +00:00
parent 90c70dd232
commit 78e5870eec
7 changed files with 182 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.898 2010/12/08 23:56:01 njoly Exp $
# $NetBSD: mi,v 1.899 2010/12/12 12:48:31 pooka Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -588,6 +588,7 @@
./usr/bin/rs base-util-bin
./usr/bin/rsh base-netutil-bin
./usr/bin/rump_allserver base-util-bin
./usr/bin/rump.halt base-util-bin
./usr/bin/rup base-netutil-bin
./usr/bin/ruptime base-netutil-bin
./usr/bin/rusers base-netutil-bin

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1535 2010/12/11 10:41:11 rtr Exp $
# $NetBSD: mi,v 1.1536 2010/12/12 12:48:31 pooka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -3322,6 +3322,7 @@
./usr/libdata/debug/usr/bin/rs.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/rsh.debug comp-netutil-debug debug
./usr/libdata/debug/usr/bin/rump_allserver.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/rump.halt.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/rup.debug comp-netutil-debug debug
./usr/libdata/debug/usr/bin/ruptime.debug comp-netutil-debug debug
./usr/libdata/debug/usr/bin/rusers.debug comp-netutil-debug debug

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1262 2010/12/08 07:20:59 kefren Exp $
# $NetBSD: mi,v 1.1263 2010/12/12 12:48:32 pooka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -444,6 +444,7 @@
./usr/share/man/cat1/rs.0 man-util-catman .cat
./usr/share/man/cat1/rsh.0 man-netutil-catman .cat
./usr/share/man/cat1/rtld.0 man-shlib-catman .cat
./usr/share/man/cat1/rump.halt.0 man-netutil-catman .cat
./usr/share/man/cat1/rup.0 man-netutil-catman .cat
./usr/share/man/cat1/ruptime.0 man-netutil-catman .cat
./usr/share/man/cat1/rusers.0 man-netutil-catman .cat
@ -3221,6 +3222,7 @@
./usr/share/man/html1/rs.html man-util-htmlman html
./usr/share/man/html1/rsh.html man-netutil-htmlman html
./usr/share/man/html1/rtld.html man-shlib-htmlman html
./usr/share/man/html1/rump.halt.html man-netutil-htmlman html
./usr/share/man/html1/rup.html man-netutil-htmlman html
./usr/share/man/html1/ruptime.html man-netutil-htmlman html
./usr/share/man/html1/rusers.html man-netutil-htmlman html
@ -5656,6 +5658,7 @@
./usr/share/man/man1/rs.1 man-util-man .man
./usr/share/man/man1/rsh.1 man-netutil-man .man
./usr/share/man/man1/rtld.1 man-shlib-man .man
./usr/share/man/man1/rump.halt.1 man-netutil-man .man
./usr/share/man/man1/rup.1 man-netutil-man .man
./usr/share/man/man1/ruptime.1 man-netutil-man .man
./usr/share/man/man1/rusers.1 man-netutil-man .man

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.194 2010/12/05 17:45:08 pooka Exp $
# $NetBSD: Makefile,v 1.195 2010/12/12 12:48:30 pooka Exp $
# from: @(#)Makefile 8.3 (Berkeley) 1/7/94
.include <bsd.own.mk>
@ -22,7 +22,7 @@ SUBDIR= apply apropos asa at audio \
pagesize passwd paste patch pathchk pkill pmap pmc pr \
printenv printf progress pwhash qsubst quota radioctl rdist \
renice rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \
rump_allserver rup ruptime rusers rwall rwho \
rump_allserver rump_halt rup ruptime rusers rwall rwho \
script sdiff sdpquery sed seq shar shlock \
showmount shuffle sockstat soelim sort spell split stat su systat \
tabs tail talk tcopy tee telnet tftp tic time tip touch tput \

View File

@ -0,0 +1,9 @@
# $NetBSD: Makefile,v 1.1 2010/12/12 12:48:31 pooka Exp $
#
PROG= rump.halt
LDADD+= -lrumpclient
DPADD+= ${RUMPCLIENT}
.include <bsd.prog.mk>

View File

@ -0,0 +1,73 @@
.\" $NetBSD: rump.halt.1,v 1.1 2010/12/12 12:48:31 pooka Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)reboot.8 8.1 (Berkeley) 6/9/93
.\"
.Dd December 12, 2010
.Dt RUMP.HALT 1
.Os
.Sh NAME
.Nm rump.halt
.Nd halt a rump kernel
.Sh SYNOPSIS
.Nm
.Op Fl dhn
.Sh DESCRIPTION
The
.Nm
utility exits a rump kernel.
The file system cache, if present, is flushed.
Since a rump kernel does not control its clients, they are not
directly affected by
.Nm .
However, they will be unable to request further services from the
halted rump kernel.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl d
Create a core dump.
The core file is saved according to standard userland program
coredump rules, and can be later examined with a debugger.
.It Fl h
By default the process hosting the rump kernel exits.
Using this option shuts down rump kernel activity, but does not
cause the hosting process to exit.
.It Fl n
Do not flush the file system cache.
This option should be used with extreme caution.
It can be used if a virtual disk or a virtual processor is virtually on fire.
.El
.Sh SEE ALSO
.Xr rump 3
.Sh HISTORY
The
.Nm
command appeared in
.Nx 6.0 .

View File

@ -0,0 +1,90 @@
/* $NetBSD: rump.halt.c,v 1.1 2010/12/12 12:48:31 pooka Exp $ */
/*-
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: rump.halt.c,v 1.1 2010/12/12 12:48:31 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
#include <rump/rump.h>
#include <rump/rumpclient.h>
#include <rump/rump_syscalls.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define ARGFLAGS "dhn"
static void
usage(void)
{
fprintf(stderr, "usage: %s [-" ARGFLAGS "]\n", getprogname());
exit(1);
}
int
main(int argc, char *argv[])
{
int ch, flags;
setprogname(argv[0]);
flags = 0;
while ((ch = getopt(argc, argv, ARGFLAGS)) != -1) {
switch (ch) {
case 'd':
flags |= RUMP_RB_DUMP;
break;
case 'h':
flags |= RUMP_RB_HALT;
break;
case 'n':
flags |= RUMP_RB_NOSYNC;
break;
default:
usage();
break;
}
}
if (optind != argc)
usage();
if (rumpclient_init() == -1)
err(1, "init failed");
rump_sys_reboot(flags, NULL);
return 0;
}