If compiled with RUMP_ACTION, access rump kernel instead of host

kernel.  This is an easy way to browse & modify the sysctl tree
offered by a rump kernel instance.
This commit is contained in:
pooka 2010-08-06 15:04:13 +00:00
parent e8deba048f
commit c7528563f1
2 changed files with 23 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 2009/04/22 15:23:07 lukem Exp $
# $NetBSD: Makefile,v 1.4 2010/08/06 15:04:13 pooka Exp $
PROG= mount_sysctlfs
SRCS= sysctlfs.c
@ -8,4 +8,9 @@ LDADD+= -lpuffs -lutil
MAN= mount_sysctlfs.8
.ifdef RUMP_ACTION
CPPFLAGS+= -DRUMP_ACTION
LDADD+= -lrump -lrumpuser -lpthread
.endif
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctlfs.c,v 1.14 2010/04/11 15:08:17 pooka Exp $ */
/* $NetBSD: sysctlfs.c,v 1.15 2010/08/06 15:04:13 pooka Exp $ */
/*-
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: sysctlfs.c,v 1.14 2010/04/11 15:08:17 pooka Exp $");
__RCSID("$NetBSD: sysctlfs.c,v 1.15 2010/08/06 15:04:13 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -50,6 +50,13 @@ __RCSID("$NetBSD: sysctlfs.c,v 1.14 2010/04/11 15:08:17 pooka Exp $");
#include <unistd.h>
#include <util.h>
#ifdef RUMP_ACTION
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#define sysctl(a,b,c,d,e,f) rump_sys___sysctl(a,b,c,d,e,f)
#endif
PUFFSOP_PROTOS(sysctlfs)
struct sfsnode {
@ -292,6 +299,14 @@ main(int argc, char *argv[])
if (puffs_daemon(pu, 1, 1) == -1)
err(1, "puffs_daemon");
#ifdef RUMP_ACTION
{
extern int puffs_fakecc;
puffs_fakecc = 1;
rump_init();
}
#endif
if (puffs_mount(pu, argv[1], mntflags, puffs_getroot(pu)) == -1)
err(1, "puffs_mount");
if (puffs_mainloop(pu) == -1)