Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src make sysctl(8) work as a rump client



details:   https://anonhg.NetBSD.org/src/rev/17384512bfd8
branches:  trunk
changeset: 758477:17384512bfd8
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Nov 05 15:55:23 2010 +0000

description:
make sysctl(8) work as a rump client

diffstat:

 lib/libc/gen/sysctlgetmibinfo.c |  11 +++++++++--
 sbin/sysctl/Makefile            |  11 ++++++++++-
 sbin/sysctl/sysctl.c            |  16 ++++++++++++++--
 3 files changed, 33 insertions(+), 5 deletions(-)

diffs (105 lines):

diff -r cdcee92effe3 -r 17384512bfd8 lib/libc/gen/sysctlgetmibinfo.c
--- a/lib/libc/gen/sysctlgetmibinfo.c   Fri Nov 05 15:49:37 2010 +0000
+++ b/lib/libc/gen/sysctlgetmibinfo.c   Fri Nov 05 15:55:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctlgetmibinfo.c,v 1.7 2009/02/12 04:13:08 lukem Exp $ */
+/*     $NetBSD: sysctlgetmibinfo.c,v 1.8 2010/11/05 15:55:23 pooka Exp $ */
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -31,13 +31,15 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sysctlgetmibinfo.c,v 1.7 2009/02/12 04:13:08 lukem Exp $");
+__RCSID("$NetBSD: sysctlgetmibinfo.c,v 1.8 2010/11/05 15:55:23 pooka Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#ifndef RUMP_ACTION
 #include "namespace.h"
 #ifdef _REENTRANT
 #include "reentrant.h"
 #endif /* _REENTRANT */
+#endif /* RUMP_ACTION */
 #include <sys/param.h>
 #include <sys/sysctl.h>
 
@@ -51,6 +53,11 @@
 __weak_alias(sysctlgetmibinfo,_sysctlgetmibinfo)
 #endif
 
+#ifdef RUMP_ACTION
+#include <rump/rump_syscalls.h>
+#define sysctl(a,b,c,d,e,f) rump_sys___sysctl(a,b,c,d,e,f)
+#endif
+
 /*
  * the place where we attach stuff we learn on the fly, not
  * necessarily used.
diff -r cdcee92effe3 -r 17384512bfd8 sbin/sysctl/Makefile
--- a/sbin/sysctl/Makefile      Fri Nov 05 15:49:37 2010 +0000
+++ b/sbin/sysctl/Makefile      Fri Nov 05 15:55:23 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.18 2009/02/13 16:02:05 uebayasi Exp $
+#      $NetBSD: Makefile,v 1.19 2010/11/05 15:55:23 pooka Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 .include <bsd.own.mk>
@@ -7,4 +7,13 @@
 PROG=  sysctl
 MAN=   sysctl.8
 
+SRCS=  sysctl.c
+
+.ifdef RUMP_ACTION
+.PATH: ${.CURDIR}/../../lib/libc/gen
+CPPFLAGS+= -DRUMP_ACTION
+LDADD+=        -lrumpclient
+SRCS+= sysctlgetmibinfo.c
+.endif
+
 .include <bsd.prog.mk>
diff -r cdcee92effe3 -r 17384512bfd8 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Fri Nov 05 15:49:37 2010 +0000
+++ b/sbin/sysctl/sysctl.c      Fri Nov 05 15:55:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.131 2010/04/11 01:52:10 mrg Exp $ */
+/*     $NetBSD: sysctl.c,v 1.132 2010/11/05 15:55:23 pooka Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.131 2010/04/11 01:52:10 mrg Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.132 2010/11/05 15:55:23 pooka Exp $");
 #endif
 #endif /* not lint */
 
@@ -105,6 +105,13 @@
 #include <time.h>
 #include <unistd.h>
 
+#ifdef RUMP_ACTION
+#include <rump/rumpclient.h>
+#include <rump/rump_syscalls.h>
+
+#define sysctl(a,b,c,d,e,f) rump_sys___sysctl(a,b,c,d,e,f)
+#endif
+
 /*
  * this needs to be able to do the printing and the setting
  */
@@ -269,6 +276,11 @@
        int name[CTL_MAXNAME];
        int ch;
 
+#ifdef RUMP_ACTION
+       if (rumpclient_init() == -1)
+               err(1, "rumpclient init failed");
+#endif
+
        while ((ch = getopt(argc, argv, "Aabdef:Mnqrwx")) != -1) {
                switch (ch) {
                case 'A':



Home | Main Index | Thread Index | Old Index