Module Name: src Committed By: pooka Date: Fri Jan 28 18:52:50 UTC 2011
Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/comp: mi src/usr.bin/sockstat: Makefile sockstat.c Added Files: src/usr.bin/sockstat: prog_ops.h sockstat_hostops.c sockstat_rumpops.c Log Message: support rump.sockstat To generate a diff of this commit: cvs rdiff -u -r1.918 -r1.919 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1577 -r1.1578 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.2 -r1.3 src/usr.bin/sockstat/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/sockstat/prog_ops.h \ src/usr.bin/sockstat/sockstat_hostops.c \ src/usr.bin/sockstat/sockstat_rumpops.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/sockstat/sockstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.918 src/distrib/sets/lists/base/mi:1.919 --- src/distrib/sets/lists/base/mi:1.918 Wed Jan 26 15:00:57 2011 +++ src/distrib/sets/lists/base/mi Fri Jan 28 18:52:48 2011 @@ -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 Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1577 src/distrib/sets/lists/comp/mi:1.1578 --- src/distrib/sets/lists/comp/mi:1.1577 Thu Jan 27 14:48:36 2011 +++ src/distrib/sets/lists/comp/mi Fri Jan 28 18:52:48 2011 @@ -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 Index: src/usr.bin/sockstat/Makefile diff -u src/usr.bin/sockstat/Makefile:1.2 src/usr.bin/sockstat/Makefile:1.3 --- src/usr.bin/sockstat/Makefile:1.2 Wed Aug 10 20:32:57 2005 +++ src/usr.bin/sockstat/Makefile Fri Jan 28 18:52:49 2011 @@ -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 Index: src/usr.bin/sockstat/sockstat.c diff -u src/usr.bin/sockstat/sockstat.c:1.15 src/usr.bin/sockstat/sockstat.c:1.16 --- src/usr.bin/sockstat/sockstat.c:1.15 Mon Apr 13 10:56:56 2009 +++ src/usr.bin/sockstat/sockstat.c Fri Jan 28 18:52:49 2011 @@ -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 Added files: Index: src/usr.bin/sockstat/prog_ops.h diff -u /dev/null src/usr.bin/sockstat/prog_ops.h:1.1 --- /dev/null Fri Jan 28 18:52:50 2011 +++ src/usr.bin/sockstat/prog_ops.h Fri Jan 28 18:52:49 2011 @@ -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_ */ Index: src/usr.bin/sockstat/sockstat_hostops.c diff -u /dev/null src/usr.bin/sockstat/sockstat_hostops.c:1.1 --- /dev/null Fri Jan 28 18:52:50 2011 +++ src/usr.bin/sockstat/sockstat_hostops.c Fri Jan 28 18:52:49 2011 @@ -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, +}; Index: src/usr.bin/sockstat/sockstat_rumpops.c diff -u /dev/null src/usr.bin/sockstat/sockstat_rumpops.c:1.1 --- /dev/null Fri Jan 28 18:52:50 2011 +++ src/usr.bin/sockstat/sockstat_rumpops.c Fri Jan 28 18:52:49 2011 @@ -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, +};