Module Name: src Committed By: hannken Date: Sun Dec 16 14:03:37 UTC 2018
Modified Files: src/lib/librumphijack: hijack.c rumphijack.3 Log Message: Add an option "modctl" to capture modctl(). To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/lib/librumphijack/hijack.c cvs rdiff -u -r1.12 -r1.13 src/lib/librumphijack/rumphijack.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.125 src/lib/librumphijack/hijack.c:1.126 --- src/lib/librumphijack/hijack.c:1.125 Thu Jun 28 06:20:36 2018 +++ src/lib/librumphijack/hijack.c Sun Dec 16 14:03:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.125 2018/06/28 06:20:36 ozaki-r Exp $ */ +/* $NetBSD: hijack.c,v 1.126 2018/12/16 14:03:37 hannken Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -34,7 +34,7 @@ #include <rump/rumpuser_port.h> #if !defined(lint) -__RCSID("$NetBSD: hijack.c,v 1.125 2018/06/28 06:20:36 ozaki-r Exp $"); +__RCSID("$NetBSD: hijack.c,v 1.126 2018/12/16 14:03:37 hannken Exp $"); #endif #include <sys/param.h> @@ -138,6 +138,7 @@ enum dualcall { #ifdef __NetBSD__ DUALCALL___SYSCTL, + DUALCALL_MODCTL, #endif #ifdef __NetBSD__ @@ -351,6 +352,7 @@ struct sysnames { #ifdef __NetBSD__ { DUALCALL___SYSCTL, "__sysctl", RSYS_NAME(__SYSCTL) }, + { DUALCALL_MODCTL, "modctl", RSYS_NAME(MODCTL) }, #endif #ifdef __NetBSD__ @@ -814,6 +816,30 @@ sysctlparser(char *buf) errx(1, "sysctl value should be y(es)/n(o), gave: %s", buf); } +static bool rumpmodctl = false; + +static void +modctlparser(char *buf) +{ + + if (buf == NULL) { + rumpmodctl = true; + return; + } + + if (strcasecmp(buf, "y") == 0 || strcasecmp(buf, "yes") == 0 || + strcasecmp(buf, "yep") == 0 || strcasecmp(buf, "tottakai") == 0) { + rumpmodctl = true; + return; + } + if (strcasecmp(buf, "n") == 0 || strcasecmp(buf, "no") == 0) { + rumpmodctl = false; + return; + } + + errx(1, "modctl value should be y(es)/n(o), gave: %s", buf); +} + static void fdoffparser(char *buf) { @@ -841,6 +867,7 @@ static struct { { blanketparser, "blanket", true }, { vfsparser, "vfs", true }, { sysctlparser, "sysctl", false }, + { modctlparser, "modctl", false }, { fdoffparser, "fdoff", true }, { NULL, NULL, false }, }; @@ -2334,6 +2361,20 @@ __sysctl(const int *name, unsigned int n return op___sysctl(name, namelen, old, oldlenp, new, newlen); } +int modctl(int, void *); +int +modctl(int operation, void *argp) +{ + int (*op_modctl)(int operation, void *argp); + + if (rumpmodctl) { + op_modctl = GETSYSCALL(rump, MODCTL); + } else { + op_modctl = GETSYSCALL(host, MODCTL); + } + + return op_modctl(operation, argp); +} #endif /* Index: src/lib/librumphijack/rumphijack.3 diff -u src/lib/librumphijack/rumphijack.3:1.12 src/lib/librumphijack/rumphijack.3:1.13 --- src/lib/librumphijack/rumphijack.3:1.12 Mon Mar 14 15:21:22 2011 +++ src/lib/librumphijack/rumphijack.3 Sun Dec 16 14:03:37 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: rumphijack.3,v 1.12 2011/03/14 15:21:22 pooka Exp $ +.\" $NetBSD: rumphijack.3,v 1.13 2018/12/16 14:03:37 hannken Exp $ .\" .\" Copyright (c) 2011 Antti Kantee. All rights reserved. .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 14, 2011 +.Dd December 16, 2018 .Dt RUMPHIJACK 3 .Os .Sh NAME @@ -173,6 +173,15 @@ Acceptable values are and .Dq no , meaning to call the rump or the host kernel, respectively. +.It Dq modctl +Direct the +.Fn modctl +call to the rump kernel. +Acceptable values are +.Dq yes +and +.Dq no , +meaning to call the rump or the host kernel, respectively. .It Dq fdoff Adjust the library's fd offset to the specified value. All rump kernel descriptors have the offset added to them