Source-Changes-HG archive

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

[src/trunk]: src/sbin/ping add compile-conditional rumpclient support



details:   https://anonhg.NetBSD.org/src/rev/1f27a2d12dcf
branches:  trunk
changeset: 758640:1f27a2d12dcf
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Nov 11 22:56:38 2010 +0000

description:
add compile-conditional rumpclient support

diffstat:

 sbin/ping/Makefile |  14 +++++++++++++-
 sbin/ping/ping.c   |  16 ++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r bfec073d871d -r 1f27a2d12dcf sbin/ping/Makefile
--- a/sbin/ping/Makefile        Thu Nov 11 22:48:47 2010 +0000
+++ b/sbin/ping/Makefile        Thu Nov 11 22:56:38 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.14 2007/05/28 12:06:23 tls Exp $
+#      $NetBSD: Makefile,v 1.15 2010/11/11 22:56:38 pooka Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/5/93
 
 USE_FORT?= yes # setuid
@@ -12,4 +12,16 @@
 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>
diff -r bfec073d871d -r 1f27a2d12dcf sbin/ping/ping.c
--- a/sbin/ping/ping.c  Thu Nov 11 22:48:47 2010 +0000
+++ b/sbin/ping/ping.c  Thu Nov 11 22:56:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping.c,v 1.90 2009/11/02 00:47:09 christos Exp $       */
+/*     $NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -58,7 +58,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping.c,v 1.90 2009/11/02 00:47:09 christos Exp $");
+__RCSID("$NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $");
 #endif
 
 #include <stdio.h>
@@ -92,6 +92,13 @@
 #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
+
 #define FLOOD_INTVL    0.01            /* default flood output interval */
 #define        MAXPACKET       (IP_MAXPACKET-60-8)     /* max packet size */
 
@@ -244,6 +251,11 @@
        struct sigaction sa;
 #endif
 
+#ifdef RUMP_ACTION
+       if (rumpclient_init() == -1)
+               err(1, "rumpclient init failed");
+#endif
+
        if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
                err(1, "Cannot create socket");
        if ((sloop = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)



Home | Main Index | Thread Index | Old Index