Add netstat rump client. For now, it always sets -X, i.e. will

use only sysctl and no kvm (implementing /dev/mem for a rump kernel
would probably not be hard, but still a non-zero effort).

Note: since there is absolutely no network activity in a fresh rump
kernel, rump.netstat usually displays exactly nothing when invoked
without parameters.  Arguments like -r, -bi, -p icmp etc. produce
more stuff.
This commit is contained in:
pooka 2010-12-13 21:15:30 +00:00
parent c7407d6266
commit f2ee316255
14 changed files with 200 additions and 43 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.903 2010/12/13 20:51:11 pooka Exp $
# $NetBSD: mi,v 1.904 2010/12/13 21:15:30 pooka Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -534,6 +534,7 @@
./usr/bin/netpgpkeys base-crypto-bin crypto
./usr/bin/netpgpverify base-crypto-bin crypto
./usr/bin/netstat base-netutil-bin
./usr/bin/rump.netstat base-netutil-bin
./usr/bin/newaliases base-mailwrapper-bin
./usr/bin/newgrp base-util-bin
./usr/bin/newsyslog base-util-bin

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1540 2010/12/13 20:51:11 pooka Exp $
# $NetBSD: mi,v 1.1541 2010/12/13 21:15:30 pooka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -3271,6 +3271,7 @@
./usr/libdata/debug/usr/bin/netpgpkeys.debug comp-crypto-debug crypto,debug
./usr/libdata/debug/usr/bin/netpgpverify.debug comp-crypto-debug crypto,debug
./usr/libdata/debug/usr/bin/netstat.debug comp-netutil-debug debug
./usr/libdata/debug/usr/bin/rump.netstat.debug comp-netutil-debug debug
./usr/libdata/debug/usr/bin/newgrp.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/newsyslog.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/nfsstat.debug comp-nfsclient-debug debug

View File

@ -1,11 +1,11 @@
# $NetBSD: Makefile,v 1.29 2009/09/14 10:36:50 degroote Exp $
# $NetBSD: Makefile,v 1.30 2010/12/13 21:15:30 pooka Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/12/93
.include <bsd.own.mk>
USE_FORT?= yes # setgid
PROG= netstat
RUMPPRG=netstat
SRCS= atalk.c bpf.c fast_ipsec.c if.c inet.c inet6.c ipsec.c iso.c \
main.c mbuf.c mroute.c mroute6.c show.c route.c tp_astring.c \
unix.c
@ -17,6 +17,12 @@ DPADD= ${LIBKVM}
CPPFLAGS+= -DIPSEC
CPPFLAGS+= -I${NETBSDSRCDIR}/sys/dist/pf
.PATH: ${.CURDIR}/../../lib/libc/gen
.PATH: ${.CURDIR}/../../lib/libc/net
CPPFLAGS+= -DRUMP_ACTION
RUMPSRCS+= sysctlbyname.c sysctlgetmibinfo.c sysctlnametomib.c
RUMPSRCS+= if_indextoname.c getifaddrs.c
.if (${USE_INET6} != "no")
CPPFLAGS+= -DINET6
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: bpf.c,v 1.9 2009/04/12 16:08:37 lukem Exp $ */
/* $NetBSD: bpf.c,v 1.10 2010/12/13 21:15:30 pooka Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -44,6 +44,7 @@
#include <net/bpfdesc.h>
#include <net/bpf.h>
#include "netstat.h"
#include "prog_ops.h"
void
bpf_stats(void)
@ -92,7 +93,8 @@ bpf_dump(const char *bpfif)
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: net.bpf.peers");
if (rc == -1 && v != NULL) {
@ -158,7 +160,7 @@ bpf_dump(const char *bpfif)
name[namelen++] = szproc;
name[namelen++] = 1;
if (sysctl(&name[0], namelen, &p, &szproc,
if (prog_sysctl(&name[0], namelen, &p, &szproc,
NULL, 0) == -1)
printf("-\n");
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.69 2010/07/09 07:04:30 enami Exp $ */
/* $NetBSD: if.c,v 1.70 2010/12/13 21:15:30 pooka Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: if.c,v 1.69 2010/07/09 07:04:30 enami Exp $");
__RCSID("$NetBSD: if.c,v 1.70 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -65,6 +65,7 @@ __RCSID("$NetBSD: if.c,v 1.69 2010/07/09 07:04:30 enami Exp $");
#include <err.h>
#include "netstat.h"
#include "prog_ops.h"
#define MAXIF 100
@ -163,11 +164,11 @@ intpr_sysctl(void)
size_t len;
char name[IFNAMSIZ + 1]; /* + 1 for `*' */
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
if (prog_sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
err(1, "sysctl");
if ((buf = malloc(len)) == NULL)
err(1, NULL);
if (sysctl(mib, 6, buf, &len, NULL, 0) == -1)
if (prog_sysctl(mib, 6, buf, &len, NULL, 0) == -1)
err(1, "sysctl");
intpr_header();
@ -983,11 +984,11 @@ fetchifs(void)
char name[IFNAMSIZ];
size_t len;
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
if (prog_sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
err(1, "sysctl");
if ((buf = malloc(len)) == NULL)
err(1, NULL);
if (sysctl(mib, 6, buf, &len, NULL, 0) == -1)
if (prog_sysctl(mib, 6, buf, &len, NULL, 0) == -1)
err(1, "sysctl");
lim = buf + len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet.c,v 1.92 2009/12/07 18:48:45 christos Exp $ */
/* $NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet.c,v 1.92 2009/12/07 18:48:45 christos Exp $");
__RCSID("$NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -88,6 +88,7 @@ __RCSID("$NetBSD: inet.c,v 1.92 2009/12/07 18:48:45 christos Exp $");
#include <stdlib.h>
#include <err.h>
#include "netstat.h"
#include "prog_ops.h"
char *inetname(struct in_addr *);
void inetprint(struct in_addr *, u_int16_t, const char *, int);
@ -194,8 +195,8 @@ protopr(u_long off, const char *name)
if (sysctlnametomib(mibname, mib, &namelen) == -1)
err(1, "sysctlnametomib: %s", mibname);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
NULL, &size, NULL, 0) == -1)
err(1, "sysctl (query)");
if ((pcblist = malloc(size)) == NULL)
@ -205,8 +206,8 @@ protopr(u_long off, const char *name)
mib[6] = sizeof(*pcblist);
mib[7] = size / sizeof(*pcblist);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), pcblist,
&size, NULL, 0) == -1)
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
pcblist, &size, NULL, 0) == -1)
err(1, "sysctl (copy)");
for (i = 0; i < size / sizeof(*pcblist); i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet6.c,v 1.52 2009/04/12 16:08:37 lukem Exp $ */
/* $NetBSD: inet6.c,v 1.53 2010/12/13 21:15:30 pooka Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
@ -64,7 +64,7 @@
#if 0
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet6.c,v 1.52 2009/04/12 16:08:37 lukem Exp $");
__RCSID("$NetBSD: inet6.c,v 1.53 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -129,6 +129,7 @@ extern const char * const tcpstates[];
#include <string.h>
#include <unistd.h>
#include "netstat.h"
#include "prog_ops.h"
#ifdef INET6
@ -252,8 +253,8 @@ ip6protopr(u_long off, const char *name)
err(1, "sysctlnametomib: %s", mibname);
}
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
NULL, &size, NULL, 0) == -1)
err(1, "sysctl (query)");
if ((pcblist = malloc(size)) == NULL)
@ -263,7 +264,7 @@ ip6protopr(u_long off, const char *name)
mib[6] = sizeof(*pcblist);
mib[7] = size / sizeof(*pcblist);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), pcblist,
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib), pcblist,
&size, NULL, 0) == -1)
err(1, "sysctl (copy)");

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.76 2010/06/29 12:38:12 kefren Exp $ */
/* $NetBSD: main.c,v 1.77 2010/12/13 21:15:30 pooka Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
__RCSID("$NetBSD: main.c,v 1.76 2010/06/29 12:38:12 kefren Exp $");
__RCSID("$NetBSD: main.c,v 1.77 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -64,6 +64,7 @@ __RCSID("$NetBSD: main.c,v 1.76 2010/06/29 12:38:12 kefren Exp $");
#include <string.h>
#include <unistd.h>
#include "netstat.h"
#include "prog_ops.h"
struct nlist nl[] = {
#define N_MBSTAT 0
@ -422,6 +423,12 @@ main(argc, argv)
char *cp;
u_long pcbaddr;
if (prog_init) {
if (prog_init() == -1)
err(1, "init failed");
force_sysctl = 1; /* cheap trick */
}
egid = getegid();
(void)setegid(getgid());
tp = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbuf.c,v 1.29 2009/04/12 16:08:37 lukem Exp $ */
/* $NetBSD: mbuf.c,v 1.30 2010/12/13 21:15:30 pooka Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: mbuf.c,v 1.29 2009/04/12 16:08:37 lukem Exp $");
__RCSID("$NetBSD: mbuf.c,v 1.30 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -55,6 +55,7 @@ __RCSID("$NetBSD: mbuf.c,v 1.29 2009/04/12 16:08:37 lukem Exp $");
#include <err.h>
#include <stdbool.h>
#include "netstat.h"
#include "prog_ops.h"
#define YES 1
@ -109,7 +110,7 @@ mbpr(mbaddr, msizeaddr, mclbaddr, mbpooladdr, mclpooladdr)
if (use_sysctl) {
size_t mbstatlen = sizeof(mbstat);
if (sysctl(mbstats_ctl,
if (prog_sysctl(mbstats_ctl,
sizeof(mbstats_ctl) / sizeof(mbstats_ctl[0]),
&mbstat, &mbstatlen, NULL, 0) < 0) {
warn("mbstat: sysctl failed");
@ -202,8 +203,9 @@ dump_drain:
if (!use_sysctl)
return;
if (sysctl(mowners_ctl, sizeof(mowners_ctl)/sizeof(mowners_ctl[0]),
NULL, &len, NULL, 0) < 0) {
if (prog_sysctl(mowners_ctl,
sizeof(mowners_ctl)/sizeof(mowners_ctl[0]),
NULL, &len, NULL, 0) < 0) {
if (errno == ENOENT)
return;
warn("mowners: sysctl test");
@ -216,8 +218,9 @@ dump_drain:
return;
}
if (sysctl(mowners_ctl, sizeof(mowners_ctl)/sizeof(mowners_ctl[0]),
data, &len, NULL, 0) < 0) {
if (prog_sysctl(mowners_ctl,
sizeof(mowners_ctl)/sizeof(mowners_ctl[0]),
data, &len, NULL, 0) < 0) {
warn("mowners: sysctl get");
free(data);
return;

View File

@ -0,0 +1,41 @@
/* $NetBSD: netstat_hostops.c,v 1.1 2010/12/13 21:15:30 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: netstat_hostops.c,v 1.1 2010/12/13 21:15:30 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,
};

View File

@ -0,0 +1,46 @@
/* $NetBSD: netstat_rumpops.c,v 1.1 2010/12/13 21:15:30 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: netstat_rumpops.c,v 1.1 2010/12/13 21:15:30 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
#include <rump/rump.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,
};

View File

@ -0,0 +1,45 @@
/* $NetBSD: prog_ops.h,v 1.1 2010/12/13 21:15:30 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>
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
#endif /* _PROG_OPS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: show.c,v 1.10 2010/06/27 06:52:38 kefren Exp $ */
/* $NetBSD: show.c,v 1.11 2010/12/13 21:15:30 pooka Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
/*
@ -57,6 +57,7 @@
#include <unistd.h>
#include "netstat.h"
#include "prog_ops.h"
char *any_ntoa(const struct sockaddr *);
char *link_print(struct sockaddr *);
@ -123,12 +124,12 @@ p_rttables(int paf)
mib[3] = paf;
mib[4] = NET_RT_DUMP;
mib[5] = 0;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
if (prog_sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
err(1, "route-sysctl-estimate");
if (needed > 0) {
if ((buf = malloc(needed)) == 0)
err(1, NULL);
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
if (prog_sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
err(1, "sysctl of routing table");
lim = buf + needed;
}
@ -157,7 +158,7 @@ p_rttables(int paf)
mib[3] = NET_KEY_SPD_DUMP;
mib[4] = mib[5] = 0;
if (sysctl(mib, 4, NULL, &needed, NULL, 0) == -1) {
if (prog_sysctl(mib, 4, NULL, &needed, NULL, 0) == -1) {
if (errno == ENOPROTOOPT)
return;
err(1, "spd-sysctl-estimate");
@ -165,7 +166,7 @@ p_rttables(int paf)
if (needed > 0) {
if ((buf = malloc(needed)) == 0)
err(1, NULL);
if (sysctl(mib, 4, buf, &needed, NULL, 0) == -1)
if (prog_sysctl(mib, 4, buf, &needed, NULL, 0) == -1)
err(1,"sysctl of spd");
lim = buf + needed;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: unix.c,v 1.30 2010/04/22 14:37:06 plunky Exp $ */
/* $NetBSD: unix.c,v 1.31 2010/12/13 21:15:30 pooka Exp $ */
/*-
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: unix.c,v 1.30 2010/04/22 14:37:06 plunky Exp $");
__RCSID("$NetBSD: unix.c,v 1.31 2010/12/13 21:15:30 pooka Exp $");
#endif
#endif /* not lint */
@ -64,6 +64,7 @@ __RCSID("$NetBSD: unix.c,v 1.30 2010/04/22 14:37:06 plunky Exp $");
#include <kvm.h>
#include <err.h>
#include "netstat.h"
#include "prog_ops.h"
static void unixdomainprhdr(void);
static void unixdomainpr0(u_long, u_long, u_long, u_long, u_long, u_long,
@ -163,8 +164,8 @@ unixpr(off)
&namelen) == -1)
err(1, "sysctlnametomib: %s", mibname);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &size,
NULL, 0) == -1)
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
NULL, &size, NULL, 0) == -1)
err(1, "sysctl (query)");
if ((pcblist = malloc(size)) == NULL)
@ -174,7 +175,7 @@ unixpr(off)
mib[6] = sizeof(*pcblist);
mib[7] = size / sizeof(*pcblist);
if (sysctl(mib, sizeof(mib) / sizeof(*mib), pcblist,
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib), pcblist,
&size, NULL, 0) == -1)
err(1, "sysctl (copy)");