summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorbrendan <none@none>2007-05-22 10:56:13 -0700
committerbrendan <none@none>2007-05-22 10:56:13 -0700
commit4edabff493bc4820f4297f981943f11de1cbf3be (patch)
tree03792f8eb95533562f7b3fea45dcbc94eae7e2c5 /usr/src/lib
parenteee42cb8793fcf3f72a7d16b2a1e9371d5bf60ab (diff)
downloadillumos-joyent-4edabff493bc4820f4297f981943f11de1cbf3be.tar.gz
6558517 need DTrace versions of IP address to string functions, like inet_ntop()
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libdtrace/Makefile.com5
-rw-r--r--usr/src/lib/libdtrace/common/dt_open.c6
-rw-r--r--usr/src/lib/libdtrace/common/ip.d.in31
-rw-r--r--usr/src/lib/libdtrace/common/ip.sed.in41
4 files changed, 83 insertions, 0 deletions
diff --git a/usr/src/lib/libdtrace/Makefile.com b/usr/src/lib/libdtrace/Makefile.com
index a281d38343..e20ba2320e 100644
--- a/usr/src/lib/libdtrace/Makefile.com
+++ b/usr/src/lib/libdtrace/Makefile.com
@@ -76,6 +76,7 @@ DRTIOBJ = $(DRTISRC:%.c=%.o)
DLIBSRCS += \
errno.d \
io.d \
+ ip.d \
procfs.d \
regs.d \
sched.d \
@@ -93,6 +94,7 @@ SRCDIR = ../common
CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
CLEANFILES += ../common/procfs.sed ../common/procfs.d
CLEANFILES += ../common/io.sed ../common/io.d
+CLEANFILES += ../common/ip.sed ../common/ip.d
CLEANFILES += ../common/errno.d ../common/signal.d
CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
@@ -165,6 +167,9 @@ pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
../common/io.d: ../common/io.sed ../common/io.d.in
sed -f ../common/io.sed < ../common/io.d.in > $@
+../common/ip.d: ../common/ip.sed ../common/ip.d.in
+ sed -f ../common/ip.sed < ../common/ip.d.in > $@
+
../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
diff --git a/usr/src/lib/libdtrace/common/dt_open.c b/usr/src/lib/libdtrace/common/dt_open.c
index 53e970df26..4859d0040c 100644
--- a/usr/src/lib/libdtrace/common/dt_open.c
+++ b/usr/src/lib/libdtrace/common/dt_open.c
@@ -232,6 +232,12 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_type, "uint_t" },
{ "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" },
+{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
+ DT_VERS_1_0, &dt_idops_func, "string(ipaddr_t *)" },
+{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
+ DT_VERS_1_0, &dt_idops_func, "string(in6_addr_t *)" },
+{ "inet_ntop", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOP, DT_ATTR_STABCMN,
+ DT_VERS_1_0, &dt_idops_func, "string(int, void *)" },
{ "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint_t" },
{ "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
diff --git a/usr/src/lib/libdtrace/common/ip.d.in b/usr/src/lib/libdtrace/common/ip.d.in
new file mode 100644
index 0000000000..da886eea66
--- /dev/null
+++ b/usr/src/lib/libdtrace/common/ip.d.in
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+inline int AF_INET = @AF_INET@;
+#pragma D binding "1.0" AF_INET
+inline int AF_INET6 = @AF_INET6@;
+#pragma D binding "1.0" AF_INET6
diff --git a/usr/src/lib/libdtrace/common/ip.sed.in b/usr/src/lib/libdtrace/common/ip.sed.in
new file mode 100644
index 0000000000..0083edf2de
--- /dev/null
+++ b/usr/src/lib/libdtrace/common/ip.sed.in
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values. After preprocessing, the sed script is run over ip.d.in to
+ * replace the #define tokens listed below to create the finished ip.d.
+ * Refer to the rules in libdtrace/Makefile.com for more information.
+ */
+
+#include <sys/socket.h>
+
+#define SED_REPLACE(x) s/#x/x/g
+
+SED_REPLACE(AF_INET)
+SED_REPLACE(AF_INET6)