Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src support rump.sockstat
details: https://anonhg.NetBSD.org/src/rev/eaf1d1d38fd7
branches: trunk
changeset: 761466:eaf1d1d38fd7
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Jan 28 18:52:48 2011 +0000
description:
support rump.sockstat
diffstat:
distrib/sets/lists/base/mi | 3 +-
distrib/sets/lists/comp/mi | 3 +-
usr.bin/sockstat/Makefile | 8 ++++-
usr.bin/sockstat/prog_ops.h | 50 +++++++++++++++++++++++++++++++++++++
usr.bin/sockstat/sockstat.c | 13 ++++++--
usr.bin/sockstat/sockstat_hostops.c | 41 ++++++++++++++++++++++++++++++
usr.bin/sockstat/sockstat_rumpops.c | 45 +++++++++++++++++++++++++++++++++
7 files changed, 155 insertions(+), 8 deletions(-)
diffs (255 lines):
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi Fri Jan 28 18:48:21 2011 +0000
+++ b/distrib/sets/lists/base/mi Fri Jan 28 18:52:48 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.918 2011/01/26 15:00:57 pooka Exp $
+# $NetBSD: mi,v 1.919 2011/01/28 18:52:48 pooka Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -629,6 +629,7 @@
./usr/bin/skeyinit base-util-bin skey
./usr/bin/slogin base-secsh-bin crypto
./usr/bin/sockstat base-util-bin
+./usr/bin/rump.sockstat base-util-bin
./usr/bin/sort base-util-bin
./usr/bin/spell base-util-bin
./usr/bin/split base-util-bin
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Fri Jan 28 18:48:21 2011 +0000
+++ b/distrib/sets/lists/comp/mi Fri Jan 28 18:52:48 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1577 2011/01/27 14:48:36 wiz Exp $
+# $NetBSD: mi,v 1.1578 2011/01/28 18:52:48 pooka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3369,6 +3369,7 @@
./usr/libdata/debug/usr/bin/skeyinfo.debug comp-util-debug skey,debug
./usr/libdata/debug/usr/bin/skeyinit.debug comp-util-debug skey,debug
./usr/libdata/debug/usr/bin/sockstat.debug comp-util-debug debug
+./usr/libdata/debug/usr/bin/rump.sockstat.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/soelim.debug comp-groff-debug debug
./usr/libdata/debug/usr/bin/sort.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/split.debug comp-util-debug debug
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 usr.bin/sockstat/Makefile
--- a/usr.bin/sockstat/Makefile Fri Jan 28 18:48:21 2011 +0000
+++ b/usr.bin/sockstat/Makefile Fri Jan 28 18:52:48 2011 +0000
@@ -1,8 +1,12 @@
-# $NetBSD: Makefile,v 1.2 2005/08/10 20:32:57 rpaulo Exp $
+# $NetBSD: Makefile,v 1.3 2011/01/28 18:52:49 pooka Exp $
.include <bsd.own.mk>
-PROG= sockstat
+RUMPPRG= sockstat
+
+.PATH: ${.CURDIR}/../../lib/libc/gen
+CPPFLAGS+= -DRUMP_ACTION
+RUMPSRCS+= sysctlgetmibinfo.c sysctlnametomib.c
.if (${USE_INET6} != "no")
CPPFLAGS+=-DINET6
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 usr.bin/sockstat/prog_ops.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sockstat/prog_ops.h Fri Jan 28 18:52:48 2011 +0000
@@ -0,0 +1,50 @@
+/* $NetBSD: prog_ops.h,v 1.1 2011/01/28 18:52:49 pooka Exp $ */
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _PROG_OPS_H_
+#define _PROG_OPS_H_
+
+#include <sys/types.h>
+
+#ifndef CRUNCHOPS
+struct prog_ops {
+ int (*op_init)(void);
+
+ int (*op_sysctl)(const int *, u_int, void *, size_t *,
+ const void *, size_t);
+};
+extern const struct prog_ops prog_ops;
+
+#define prog_init prog_ops.op_init
+#define prog_sysctl prog_ops.op_sysctl
+#else
+#define prog_init ((int (*)(void))NULL)
+#define prog_sysctl sysctl
+#endif
+
+#endif /* _PROG_OPS_H_ */
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 usr.bin/sockstat/sockstat.c
--- a/usr.bin/sockstat/sockstat.c Fri Jan 28 18:48:21 2011 +0000
+++ b/usr.bin/sockstat/sockstat.c Fri Jan 28 18:52:48 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sockstat.c,v 1.15 2009/04/13 10:56:56 lukem Exp $ */
+/* $NetBSD: sockstat.c,v 1.16 2011/01/28 18:52:49 pooka Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: sockstat.c,v 1.15 2009/04/13 10:56:56 lukem Exp $");
+__RCSID("$NetBSD: sockstat.c,v 1.16 2011/01/28 18:52:49 pooka Exp $");
#endif
#include <sys/types.h>
@@ -67,6 +67,8 @@
#include <unistd.h>
#include <util.h>
+#include "prog_ops.h"
+
#define satosun(sa) ((struct sockaddr_un *)(sa))
#define satosin(sa) ((struct sockaddr_in *)(sa))
#ifdef INET6
@@ -172,6 +174,9 @@
argc -= optind;
argv += optind;
+ if (prog_init && prog_init() == -1)
+ err(1, "init");
+
if ((portmap != NULL) && (pf_list == 0)) {
pf_list = PF_LIST_INET;
#ifdef INET6
@@ -355,7 +360,7 @@
v = NULL;
sz = 0;
do {
- rc = sysctl(&name[0], namelen, v, &sz, NULL, 0);
+ rc = prog_sysctl(&name[0], namelen, v, &sz, NULL, 0);
if (rc == -1 && errno != ENOMEM)
err(1, "sysctl");
if (rc == -1 && v != NULL) {
@@ -534,7 +539,7 @@
name[namelen++] = sz;
name[namelen++] = 1;
- return (sysctl(&name[0], namelen, p, &sz, NULL, 0));
+ return (prog_sysctl(&name[0], namelen, p, &sz, NULL, 0));
}
int
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 usr.bin/sockstat/sockstat_hostops.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sockstat/sockstat_hostops.c Fri Jan 28 18:52:48 2011 +0000
@@ -0,0 +1,41 @@
+/* $NetBSD: sockstat_hostops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $ */
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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: sockstat_hostops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+ .op_sysctl = sysctl,
+};
diff -r 2c16d56db4e5 -r eaf1d1d38fd7 usr.bin/sockstat/sockstat_rumpops.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sockstat/sockstat_rumpops.c Fri Jan 28 18:52:48 2011 +0000
@@ -0,0 +1,45 @@
+/* $NetBSD: sockstat_rumpops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $ */
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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: sockstat_rumpops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+
+#include <rump/rumpclient.h>
+#include <rump/rump_syscalls.h>
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+ .op_init = rumpclient_init,
+
+ .op_sysctl = rump_sys___sysctl,
+};
Home |
Main Index |
Thread Index |
Old Index