RUMP_ACTION -> RUMPPRG
This commit is contained in:
parent
e3d9b779d8
commit
f9740ada7f
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.15 2010/11/11 22:56:38 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.16 2010/12/13 17:42:17 pooka Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/5/93
|
||||
|
||||
USE_FORT?= yes # setuid
|
||||
PROG= ping
|
||||
RUMPPRG=ping
|
||||
MAN= ping.8
|
||||
BINOWN= root
|
||||
BINMODE=4555
|
||||
|
@ -12,16 +12,4 @@ CPPFLAGS+= -DIPSEC
|
|||
LDADD+= -lipsec
|
||||
DPADD+= ${LIBIPSEC}
|
||||
|
||||
#
|
||||
# Compile-time debug flag. If compiled with "make RUMP_ACTION=1",
|
||||
# make rump system calls. This allows to single-step ioctl commands
|
||||
# to figure out where ioctl's go in the kernel.
|
||||
#
|
||||
.ifdef RUMP_ACTION
|
||||
CPPFLAGS+= -DRUMP_SYS_NETWORKING -DRUMP_SYS_IOCTL -DRUMP_SYS_CLOSE
|
||||
CPPFLAGS+= -DRUMP_ACTION
|
||||
LDADD+= -lrumpclient
|
||||
DBG= -g
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $ */
|
||||
/* $NetBSD: ping.c,v 1.92 2010/12/13 17:42:17 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $");
|
||||
__RCSID("$NetBSD: ping.c,v 1.92 2010/12/13 17:42:17 pooka Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -92,12 +92,7 @@ __RCSID("$NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $");
|
|||
#include <netinet6/ipsec.h>
|
||||
#endif /*IPSEC*/
|
||||
|
||||
#ifdef RUMP_ACTION
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
#include <rump/rumpclient.h>
|
||||
#define poll(a,b,c) rump_sys_poll(a,b,c)
|
||||
#endif
|
||||
#include "prog_ops.h"
|
||||
|
||||
#define FLOOD_INTVL 0.01 /* default flood output interval */
|
||||
#define MAXPACKET (IP_MAXPACKET-60-8) /* max packet size */
|
||||
|
@ -251,21 +246,19 @@ main(int argc, char *argv[])
|
|||
struct sigaction sa;
|
||||
#endif
|
||||
|
||||
#ifdef RUMP_ACTION
|
||||
if (rumpclient_init() == -1)
|
||||
err(1, "rumpclient init failed");
|
||||
#endif
|
||||
if (prog_init && prog_init() == -1)
|
||||
err(1, "init failed");
|
||||
|
||||
if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
|
||||
if ((s = prog_socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
|
||||
err(1, "Cannot create socket");
|
||||
if ((sloop = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
|
||||
if ((sloop = prog_socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
|
||||
err(1, "Cannot create socket");
|
||||
|
||||
/*
|
||||
* sloop is never read on. This prevents packets from
|
||||
* queueing in its recv buffer.
|
||||
*/
|
||||
if (shutdown(sloop, SHUT_RD) == -1)
|
||||
if (prog_shutdown(sloop, SHUT_RD) == -1)
|
||||
warn("Cannot shutdown for read");
|
||||
|
||||
if (setuid(getuid()) == -1)
|
||||
|
@ -472,23 +465,23 @@ main(int argc, char *argv[])
|
|||
ident = arc4random() & 0xFFFF;
|
||||
|
||||
if (options & SO_DEBUG) {
|
||||
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
||||
if (prog_setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
||||
(char *)&on, sizeof(on)) == -1)
|
||||
warn("Can't turn on socket debugging");
|
||||
}
|
||||
if (options & SO_DONTROUTE) {
|
||||
if (setsockopt(s, SOL_SOCKET, SO_DONTROUTE,
|
||||
if (prog_setsockopt(s, SOL_SOCKET, SO_DONTROUTE,
|
||||
(char *)&on, sizeof(on)) == -1)
|
||||
warn("SO_DONTROUTE");
|
||||
}
|
||||
|
||||
if (options & SO_DEBUG) {
|
||||
if (setsockopt(sloop, SOL_SOCKET, SO_DEBUG,
|
||||
if (prog_setsockopt(sloop, SOL_SOCKET, SO_DEBUG,
|
||||
(char *)&on, sizeof(on)) == -1)
|
||||
warn("Can't turn on socket debugging");
|
||||
}
|
||||
if (options & SO_DONTROUTE) {
|
||||
if (setsockopt(sloop, SOL_SOCKET, SO_DONTROUTE,
|
||||
if (prog_setsockopt(sloop, SOL_SOCKET, SO_DONTROUTE,
|
||||
(char *)&on, sizeof(on)) == -1)
|
||||
warn("SO_DONTROUTE");
|
||||
}
|
||||
|
@ -513,7 +506,8 @@ main(int argc, char *argv[])
|
|||
- optlen);
|
||||
(void) memcpy(opack_ip + 1, optspace, optlen);
|
||||
|
||||
if (setsockopt(s,IPPROTO_IP,IP_HDRINCL, (char *) &on, sizeof(on)) < 0)
|
||||
if (prog_setsockopt(s,IPPROTO_IP,IP_HDRINCL,
|
||||
(char *) &on, sizeof(on)) < 0)
|
||||
err(1, "Can't set special IP header");
|
||||
|
||||
opack_ip->ip_v = IPVERSION;
|
||||
|
@ -528,24 +522,25 @@ main(int argc, char *argv[])
|
|||
if (pingflags & F_MCAST) {
|
||||
if (pingflags & F_MCAST_NOLOOP) {
|
||||
u_char loop = 0;
|
||||
if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP,
|
||||
if (prog_setsockopt(s, IPPROTO_IP,
|
||||
IP_MULTICAST_LOOP,
|
||||
(char *) &loop, 1) < 0)
|
||||
err(1, "Can't disable multicast loopback");
|
||||
}
|
||||
|
||||
if (ttl != 0
|
||||
&& setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL,
|
||||
&& prog_setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL,
|
||||
(char *) &ttl, 1) < 0)
|
||||
err(1, "Can't set multicast time-to-live");
|
||||
|
||||
if ((pingflags & F_SOURCE_ADDR)
|
||||
&& setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
&& prog_setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
(char *) &src_addr.sin_addr,
|
||||
sizeof(src_addr.sin_addr)) < 0)
|
||||
err(1, "Can't set multicast source interface");
|
||||
|
||||
} else if (pingflags & F_SOURCE_ADDR) {
|
||||
if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
if (prog_setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
(char *) &src_addr.sin_addr,
|
||||
sizeof(src_addr.sin_addr)) < 0)
|
||||
err(1, "Can't set source interface/address");
|
||||
|
@ -559,7 +554,7 @@ main(int argc, char *argv[])
|
|||
buf = ipsec_set_policy(policy_in, strlen(policy_in));
|
||||
if (buf == NULL)
|
||||
errx(1, "%s", ipsec_strerror());
|
||||
if (setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
if (prog_setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
buf, ipsec_get_policylen(buf)) < 0) {
|
||||
err(1, "ipsec policy cannot be configured");
|
||||
}
|
||||
|
@ -569,7 +564,7 @@ main(int argc, char *argv[])
|
|||
buf = ipsec_set_policy(policy_out, strlen(policy_out));
|
||||
if (buf == NULL)
|
||||
errx(1, "%s", ipsec_strerror());
|
||||
if (setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
if (prog_setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
buf, ipsec_get_policylen(buf)) < 0) {
|
||||
err(1, "ipsec policy cannot be configured");
|
||||
}
|
||||
|
@ -579,7 +574,7 @@ main(int argc, char *argv[])
|
|||
buf = ipsec_set_policy("out bypass", strlen("out bypass"));
|
||||
if (buf == NULL)
|
||||
errx(1, "%s", ipsec_strerror());
|
||||
if (setsockopt(sloop, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
if (prog_setsockopt(sloop, IPPROTO_IP, IP_IPSEC_POLICY,
|
||||
buf, ipsec_get_policylen(buf)) < 0) {
|
||||
#if 0
|
||||
warnx("ipsec is not configured");
|
||||
|
@ -595,27 +590,27 @@ main(int argc, char *argv[])
|
|||
if (pingflags & F_AUTHHDR) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
#ifdef IP_AUTH_TRANS_LEVEL
|
||||
(void)setsockopt(s, IPPROTO_IP, IP_AUTH_TRANS_LEVEL,
|
||||
(void)prog_setsockopt(s, IPPROTO_IP, IP_AUTH_TRANS_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
#else
|
||||
(void)setsockopt(s, IPPROTO_IP, IP_AUTH_LEVEL,
|
||||
(void)prog_setsockopt(s, IPPROTO_IP, IP_AUTH_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
#endif
|
||||
}
|
||||
if (pingflags & F_ENCRYPT) {
|
||||
optval = IPSEC_LEVEL_REQUIRE;
|
||||
(void)setsockopt(s, IPPROTO_IP, IP_ESP_TRANS_LEVEL,
|
||||
(void)prog_setsockopt(s, IPPROTO_IP, IP_ESP_TRANS_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
}
|
||||
optval = IPSEC_LEVEL_BYPASS;
|
||||
#ifdef IP_AUTH_TRANS_LEVEL
|
||||
(void)setsockopt(sloop, IPPROTO_IP, IP_AUTH_TRANS_LEVEL,
|
||||
(void)prog_setsockopt(sloop, IPPROTO_IP, IP_AUTH_TRANS_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
#else
|
||||
(void)setsockopt(sloop, IPPROTO_IP, IP_AUTH_LEVEL,
|
||||
(void)prog_setsockopt(sloop, IPPROTO_IP, IP_AUTH_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
#endif
|
||||
(void)setsockopt(sloop, IPPROTO_IP, IP_ESP_TRANS_LEVEL,
|
||||
(void)prog_setsockopt(sloop, IPPROTO_IP, IP_ESP_TRANS_LEVEL,
|
||||
(char *)&optval, sizeof(optval));
|
||||
}
|
||||
#endif /*IPSEC_POLICY_IPSEC*/
|
||||
|
@ -629,7 +624,7 @@ main(int argc, char *argv[])
|
|||
* are trying to stress the ethernet, or just want to
|
||||
* fill the arp cache to get some stuff for /etc/ethers.
|
||||
*/
|
||||
while (0 > setsockopt(s, SOL_SOCKET, SO_RCVBUF,
|
||||
while (0 > prog_setsockopt(s, SOL_SOCKET, SO_RCVBUF,
|
||||
(char*)&bufspace, sizeof(bufspace))) {
|
||||
if ((bufspace -= 4096) <= 0)
|
||||
err(1, "Cannot set the receive buffer size");
|
||||
|
@ -638,7 +633,7 @@ main(int argc, char *argv[])
|
|||
/* make it possible to send giant probes, but do not worry now
|
||||
* if it fails, since we probably won't send giant probes.
|
||||
*/
|
||||
(void)setsockopt(s, SOL_SOCKET, SO_SNDBUF,
|
||||
(void)prog_setsockopt(s, SOL_SOCKET, SO_SNDBUF,
|
||||
(char*)&bufspace, sizeof(bufspace));
|
||||
|
||||
(void)signal(SIGINT, prefinish);
|
||||
|
@ -717,7 +712,7 @@ doit(void)
|
|||
|
||||
fdmaskp[0].fd = s;
|
||||
fdmaskp[0].events = POLLIN;
|
||||
cc = poll(fdmaskp, 1, (int)(sec * 1000));
|
||||
cc = prog_poll(fdmaskp, 1, (int)(sec * 1000));
|
||||
if (cc <= 0) {
|
||||
if (cc < 0) {
|
||||
if (errno == EINTR)
|
||||
|
@ -729,7 +724,7 @@ doit(void)
|
|||
}
|
||||
|
||||
fromlen = sizeof(from);
|
||||
cc = recvfrom(s, (char *) packet, packlen,
|
||||
cc = prog_recvfrom(s, (char *) packet, packlen,
|
||||
0, (struct sockaddr *)&from,
|
||||
&fromlen);
|
||||
if (cc < 0) {
|
||||
|
@ -838,10 +833,11 @@ pinger(void)
|
|||
opack_icmp.icmp_cksum = in_cksum((u_int16_t *)&opack_icmp,
|
||||
PHDR_LEN);
|
||||
sw = 0;
|
||||
if (setsockopt(sloop,IPPROTO_IP,IP_HDRINCL,
|
||||
if (prog_setsockopt(sloop,IPPROTO_IP,IP_HDRINCL,
|
||||
(char *)&sw,sizeof(sw)) < 0)
|
||||
err(1, "Can't turn off special IP header");
|
||||
if (sendto(sloop, (char *) &opack_icmp, PHDR_LEN, MSG_DONTROUTE,
|
||||
if (prog_sendto(sloop, (char *) &opack_icmp,
|
||||
PHDR_LEN, MSG_DONTROUTE,
|
||||
(struct sockaddr *)&loc_addr,
|
||||
sizeof(struct sockaddr_in)) < 0) {
|
||||
/*
|
||||
|
@ -854,7 +850,7 @@ pinger(void)
|
|||
warn("failed to clear cached route");
|
||||
}
|
||||
sw = 1;
|
||||
if (setsockopt(sloop,IPPROTO_IP,IP_HDRINCL,
|
||||
if (prog_setsockopt(sloop,IPPROTO_IP,IP_HDRINCL,
|
||||
(char *)&sw, sizeof(sw)) < 0)
|
||||
err(1, "Can't set special IP header");
|
||||
|
||||
|
@ -873,7 +869,7 @@ pinger(void)
|
|||
|
||||
cc += opack_ip->ip_hl<<2;
|
||||
opack_ip->ip_len = cc;
|
||||
i = sendto(s, (char *) opack_ip, cc, 0,
|
||||
i = prog_sendto(s, (char *) opack_ip, cc, 0,
|
||||
(struct sockaddr *)&send_addr, sizeof(struct sockaddr_in));
|
||||
if (i != cc) {
|
||||
jiggle_flush(1);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* $NetBSD: ping_hostops.c,v 1.1 2010/12/13 17:42:17 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: ping_hostops.c,v 1.1 2010/12/13 17:42:17 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "prog_ops.h"
|
||||
|
||||
const struct prog_ops prog_ops = {
|
||||
.op_socket = socket,
|
||||
.op_setsockopt = setsockopt,
|
||||
.op_shutdown = shutdown,
|
||||
.op_poll = poll,
|
||||
.op_recvfrom = recvfrom,
|
||||
.op_sendto = sendto,
|
||||
.op_close = close,
|
||||
};
|
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: ping_rumpops.c,v 1.1 2010/12/13 17:42:17 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: ping_rumpops.c,v 1.1 2010/12/13 17:42:17 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
#include <rump/rumpclient.h>
|
||||
|
||||
#include "prog_ops.h"
|
||||
|
||||
const struct prog_ops prog_ops = {
|
||||
.op_init = rumpclient_init,
|
||||
|
||||
.op_socket = rump_sys_socket,
|
||||
.op_setsockopt= rump_sys_setsockopt,
|
||||
.op_shutdown = rump_sys_shutdown,
|
||||
.op_poll = rump_sys_poll,
|
||||
.op_sendto = rump_sys_sendto,
|
||||
.op_recvfrom = rump_sys_recvfrom,
|
||||
.op_close = rump_sys_close,
|
||||
};
|
|
@ -0,0 +1,61 @@
|
|||
/* $NetBSD: prog_ops.h,v 1.1 2010/12/13 17:42:17 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_socket)(int, int, int);
|
||||
int (*op_setsockopt)(int, int, int, const void *, socklen_t);
|
||||
int (*op_shutdown)(int, int);
|
||||
|
||||
int (*op_poll)(struct pollfd *, nfds_t, int);
|
||||
|
||||
ssize_t (*op_recvfrom)(int, void *, size_t, int,
|
||||
struct sockaddr *, socklen_t *);
|
||||
ssize_t (*op_sendto)(int, const void *, size_t, int,
|
||||
const struct sockaddr *, socklen_t);
|
||||
|
||||
int (*op_close)(int);
|
||||
};
|
||||
extern const struct prog_ops prog_ops;
|
||||
|
||||
#define prog_init prog_ops.op_init
|
||||
#define prog_socket prog_ops.op_socket
|
||||
#define prog_setsockopt prog_ops.op_setsockopt
|
||||
#define prog_shutdown prog_ops.op_shutdown
|
||||
#define prog_poll prog_ops.op_poll
|
||||
#define prog_recvfrom prog_ops.op_recvfrom
|
||||
#define prog_sendto prog_ops.op_sendto
|
||||
#define prog_close prog_ops.op_close
|
||||
|
||||
#endif /* _PROG_OPS_H_ */
|
|
@ -1,19 +1,16 @@
|
|||
# $NetBSD: Makefile,v 1.19 2010/11/05 15:55:23 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.20 2010/12/13 17:47:40 pooka Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
#CFLAGS+=-g
|
||||
|
||||
PROG= sysctl
|
||||
RUMPPRG=sysctl
|
||||
MAN= sysctl.8
|
||||
|
||||
SRCS= sysctl.c
|
||||
|
||||
.ifdef RUMP_ACTION
|
||||
.PATH: ${.CURDIR}/../../lib/libc/gen
|
||||
CPPFLAGS+= -DRUMP_ACTION
|
||||
LDADD+= -lrumpclient
|
||||
SRCS+= sysctlgetmibinfo.c
|
||||
.endif
|
||||
RUMPSRCS+= sysctlbyname.c sysctlgetmibinfo.c
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: prog_ops.h,v 1.1 2010/12/13 17:47:40 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_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysctl.c,v 1.132 2010/11/05 15:55:23 pooka Exp $ */
|
||||
/* $NetBSD: sysctl.c,v 1.133 2010/12/13 17:47:40 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sysctl.c,v 1.132 2010/11/05 15:55:23 pooka Exp $");
|
||||
__RCSID("$NetBSD: sysctl.c,v 1.133 2010/12/13 17:47:40 pooka Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -105,12 +105,7 @@ __RCSID("$NetBSD: sysctl.c,v 1.132 2010/11/05 15:55:23 pooka Exp $");
|
|||
#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
|
||||
#include "prog_ops.h"
|
||||
|
||||
/*
|
||||
* this needs to be able to do the printing and the setting
|
||||
|
@ -276,11 +271,6 @@ main(int argc, char *argv[])
|
|||
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':
|
||||
|
@ -337,6 +327,9 @@ main(int argc, char *argv[])
|
|||
if ((Aflag || Mflag || dflag) && argc == 0 && fn == NULL)
|
||||
aflag = 1;
|
||||
|
||||
if (prog_init && prog_init() == -1)
|
||||
err(1, "prog init failed");
|
||||
|
||||
if (Aflag)
|
||||
warnfp = stdout;
|
||||
stale = req = 0;
|
||||
|
@ -667,7 +660,7 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
}
|
||||
|
||||
if (type != CTLTYPE_NODE && pnode->sysctl_size == 0) {
|
||||
rc = sysctl(&name[0], namelen, NULL, &sz, NULL, 0);
|
||||
rc = prog_sysctl(&name[0], namelen, NULL, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
*sp = *dp = '\0';
|
||||
|
@ -718,7 +711,7 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
}
|
||||
case CTLTYPE_INT: {
|
||||
int i;
|
||||
rc = sysctl(name, namelen, &i, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &i, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
break;
|
||||
|
@ -728,7 +721,7 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
}
|
||||
case CTLTYPE_BOOL: {
|
||||
bool b;
|
||||
rc = sysctl(name, namelen, &b, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &b, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
break;
|
||||
|
@ -740,14 +733,14 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
unsigned char buf[1024], *tbuf;
|
||||
tbuf = buf;
|
||||
sz = sizeof(buf);
|
||||
rc = sysctl(&name[0], namelen, tbuf, &sz, NULL, 0);
|
||||
rc = prog_sysctl(&name[0], namelen, tbuf, &sz, NULL, 0);
|
||||
if (rc == -1 && errno == ENOMEM) {
|
||||
tbuf = malloc(sz);
|
||||
if (tbuf == NULL) {
|
||||
sysctlerror(1);
|
||||
break;
|
||||
}
|
||||
rc = sysctl(&name[0], namelen, tbuf, &sz, NULL, 0);
|
||||
rc = prog_sysctl(&name[0], namelen, tbuf, &sz, NULL, 0);
|
||||
}
|
||||
if (rc == -1)
|
||||
sysctlerror(1);
|
||||
|
@ -760,7 +753,7 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
case CTLTYPE_QUAD: {
|
||||
u_quad_t q;
|
||||
sz = sizeof(q);
|
||||
rc = sysctl(&name[0], namelen, &q, &sz, NULL, 0);
|
||||
rc = prog_sysctl(&name[0], namelen, &q, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
break;
|
||||
|
@ -780,7 +773,7 @@ print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
|
|||
fprintf(warnfp, "%s: !malloc failed!\n", gsname);
|
||||
break;
|
||||
}
|
||||
rc = sysctl(&name[0], namelen, d, &sz, NULL, 0);
|
||||
rc = prog_sysctl(&name[0], namelen, d, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
break;
|
||||
|
@ -1023,7 +1016,7 @@ parse_create(char *l)
|
|||
}
|
||||
|
||||
/*
|
||||
* note that we (mostly) let the invoker of sysctl(8)
|
||||
* note that we (mostly) let the invoker of prog_sysctl(8)
|
||||
* play rampant here and depend on the kernel to tell
|
||||
* them that they were wrong. well...within reason.
|
||||
* we later check the various parameters against each
|
||||
|
@ -1417,7 +1410,7 @@ parse_create(char *l)
|
|||
name[namelen++] = CTL_CREATE;
|
||||
|
||||
sz = sizeof(node);
|
||||
rc = sysctl(&name[0], namelen, &node, &sz, &node, sizeof(node));
|
||||
rc = prog_sysctl(&name[0], namelen, &node, &sz, &node, sizeof(node));
|
||||
|
||||
if (rc == -1) {
|
||||
sysctlperror("%s: CTL_CREATE failed: %s\n",
|
||||
|
@ -1460,7 +1453,7 @@ parse_destroy(char *l)
|
|||
name[namelen - 1] = CTL_DESTROY;
|
||||
|
||||
sz = sizeof(node);
|
||||
rc = sysctl(&name[0], namelen, &node, &sz, &node, sizeof(node));
|
||||
rc = prog_sysctl(&name[0], namelen, &node, &sz, &node, sizeof(node));
|
||||
|
||||
if (rc == -1) {
|
||||
sysctlperror("%s: CTL_DESTROY failed: %s\n",
|
||||
|
@ -1509,7 +1502,7 @@ parse_describe(char *l)
|
|||
newdesc.sysctl_num = name[namelen - 1];
|
||||
newdesc.sysctl_desc = value;
|
||||
name[namelen - 1] = CTL_DESCRIBE;
|
||||
rc = sysctl(name, namelen, d, &sz, &newdesc, sizeof(newdesc));
|
||||
rc = prog_sysctl(name, namelen, d, &sz, &newdesc, sizeof(newdesc));
|
||||
if (rc == -1)
|
||||
sysctlperror("%s: CTL_DESCRIBE failed: %s\n",
|
||||
gsname, strerror(errno));
|
||||
|
@ -1558,7 +1551,7 @@ getdesc1(int *name, u_int namelen, struct sysctlnode *pnode)
|
|||
node.sysctl_flags = SYSCTL_VERSION;
|
||||
node.sysctl_num = name[namelen - 1];
|
||||
name[namelen - 1] = CTL_DESCRIBE;
|
||||
rc = sysctl(name, namelen, d, &sz, &node, sizeof(node));
|
||||
rc = prog_sysctl(name, namelen, d, &sz, &node, sizeof(node));
|
||||
|
||||
if (rc == -1 ||
|
||||
d->descr_len == 1 ||
|
||||
|
@ -1600,7 +1593,7 @@ getdesc(int *name, u_int namelen, struct sysctlnode *pnode)
|
|||
d = malloc(sz);
|
||||
if (d == NULL)
|
||||
return;
|
||||
rc = sysctl(name, namelen + 1, d, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen + 1, d, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
free(d);
|
||||
d = NULL;
|
||||
|
@ -1764,7 +1757,7 @@ write_number(int *name, u_int namelen, struct sysctlnode *node, char *value)
|
|||
break;
|
||||
}
|
||||
|
||||
rc = sysctl(name, namelen, o, &so, i, si);
|
||||
rc = prog_sysctl(name, namelen, o, &so, i, si);
|
||||
if (rc == -1) {
|
||||
sysctlerror(0);
|
||||
return;
|
||||
|
@ -1806,7 +1799,7 @@ write_string(int *name, u_int namelen, struct sysctlnode *node, char *value)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
rc = sysctl(name, namelen, o, &so, i, si);
|
||||
rc = prog_sysctl(name, namelen, o, &so, i, si);
|
||||
if (rc == -1) {
|
||||
sysctlerror(0);
|
||||
return;
|
||||
|
@ -2047,14 +2040,14 @@ printother(HANDLER_ARGS)
|
|||
* okay...you asked for it, so let's give it a go
|
||||
*/
|
||||
while (type != CTLTYPE_NODE && (xflag || rflag)) {
|
||||
rc = sysctl(name, namelen, NULL, &sz1, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, NULL, &sz1, NULL, 0);
|
||||
if (rc == -1 || sz1 == 0)
|
||||
break;
|
||||
p = malloc(sz1);
|
||||
if (p == NULL)
|
||||
break;
|
||||
sz2 = sz1;
|
||||
rc = sysctl(name, namelen, p, &sz2, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, p, &sz2, NULL, 0);
|
||||
if (rc == -1 || sz1 != sz2) {
|
||||
free(p);
|
||||
break;
|
||||
|
@ -2106,7 +2099,7 @@ kern_clockrate(HANDLER_ARGS)
|
|||
int rc;
|
||||
|
||||
sz = sizeof(clkinfo);
|
||||
rc = sysctl(name, namelen, &clkinfo, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &clkinfo, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2136,7 +2129,7 @@ kern_boottime(HANDLER_ARGS)
|
|||
int rc;
|
||||
|
||||
sz = sizeof(timeval);
|
||||
rc = sysctl(name, namelen, &timeval, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &timeval, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2167,7 +2160,7 @@ kern_consdev(HANDLER_ARGS)
|
|||
int rc;
|
||||
|
||||
sz = sizeof(cons);
|
||||
rc = sysctl(name, namelen, &cons, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &cons, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2225,7 +2218,7 @@ kern_cp_time(HANDLER_ARGS)
|
|||
}
|
||||
|
||||
osz = sz;
|
||||
rc = sysctl(name, namelen, cp_time + (n != -1) * CPUSTATES, &osz,
|
||||
rc = prog_sysctl(name, namelen, cp_time + (n != -1) * CPUSTATES, &osz,
|
||||
NULL, 0);
|
||||
|
||||
if (rc == -1) {
|
||||
|
@ -2301,7 +2294,7 @@ kern_drivers(HANDLER_ARGS)
|
|||
int rc;
|
||||
const char *comma;
|
||||
|
||||
rc = sysctl(name, namelen, NULL, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, NULL, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2316,7 +2309,7 @@ kern_drivers(HANDLER_ARGS)
|
|||
return;
|
||||
}
|
||||
|
||||
rc = sysctl(name, namelen, kd, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, kd, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2371,7 +2364,7 @@ kern_cp_id(HANDLER_ARGS)
|
|||
}
|
||||
|
||||
osz = sz;
|
||||
rc = sysctl(name, namelen, cp_id, &osz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, cp_id, &osz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
free(cp_id);
|
||||
|
@ -2428,7 +2421,7 @@ vm_loadavg(HANDLER_ARGS)
|
|||
int rc;
|
||||
|
||||
sz = sizeof(loadavg);
|
||||
rc = sysctl(name, namelen, &loadavg, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &loadavg, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2482,7 +2475,7 @@ proc_limit(HANDLER_ARGS)
|
|||
newp = NULL;
|
||||
}
|
||||
|
||||
rc = sysctl(name, namelen, &olim, &osz, newp, nsz);
|
||||
rc = prog_sysctl(name, namelen, &olim, &osz, newp, nsz);
|
||||
if (rc == -1) {
|
||||
sysctlerror(newp == NULL);
|
||||
return;
|
||||
|
@ -2520,7 +2513,7 @@ machdep_diskinfo(HANDLER_ARGS)
|
|||
size_t sz;
|
||||
uint i, b, lim;
|
||||
|
||||
rc = sysctl(name, namelen, NULL, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, NULL, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2530,7 +2523,7 @@ machdep_diskinfo(HANDLER_ARGS)
|
|||
sysctlerror(1);
|
||||
return;
|
||||
}
|
||||
rc = sysctl(name, namelen, dl, &sz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, dl, &sz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlerror(1);
|
||||
return;
|
||||
|
@ -2590,7 +2583,7 @@ mode_bits(HANDLER_ARGS)
|
|||
nsz = sizeof(m);
|
||||
newp = &m;
|
||||
errno = 0;
|
||||
rc = sysctl(name, namelen, &tt, &ttsz, NULL, 0);
|
||||
rc = prog_sysctl(name, namelen, &tt, &ttsz, NULL, 0);
|
||||
if (rc == -1) {
|
||||
sysctlperror("%s: failed query\n", sname);
|
||||
return;
|
||||
|
@ -2618,7 +2611,7 @@ mode_bits(HANDLER_ARGS)
|
|||
newp = NULL;
|
||||
}
|
||||
|
||||
rc = sysctl(name, namelen, &o, &osz, newp, nsz);
|
||||
rc = prog_sysctl(name, namelen, &o, &osz, newp, nsz);
|
||||
if (rc == -1) {
|
||||
sysctlerror(newp == NULL);
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/* $NetBSD: sysctl_hostops.c,v 1.1 2010/12/13 17:47:40 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: sysctl_hostops.c,v 1.1 2010/12/13 17:47:40 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,
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: sysctl_rumpops.c,v 1.1 2010/12/13 17:47:40 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: sysctl_rumpops.c,v 1.1 2010/12/13 17:47:40 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
#include <rump/rumpclient.h>
|
||||
|
||||
#include "prog_ops.h"
|
||||
|
||||
const struct prog_ops prog_ops = {
|
||||
.op_init = rumpclient_init,
|
||||
|
||||
.op_sysctl = rump_sys___sysctl,
|
||||
};
|
Loading…
Reference in New Issue