summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2007-10-05 02:19:35 +0000
committerfche <fche>2007-10-05 02:19:35 +0000
commitbfb724429e55072f53e82f3d4037f2b7e80f1203 (patch)
treeb6e0cc03a0483c1ed4de4957dfb998eeb1de8a85
parent0986ac384c966a2c789d7a0fd63fa190029143be (diff)
downloadsystemtap-steved-bfb724429e55072f53e82f3d4037f2b7e80f1203.tar.gz
systemtap-steved-bfb724429e55072f53e82f3d4037f2b7e80f1203.tar.xz
systemtap-steved-bfb724429e55072f53e82f3d4037f2b7e80f1203.zip
rhbz 319611: htonl and friends in tapset
2007-10-04 Frank Ch. Eigler <fche@elastic.org> * stapfuncs.5.in: Document inet.stp tapset functions. * buildok/inet-embedded.stp: Test inet.stp functions. * inet.stp: New tapset for htonl and friends.
-rw-r--r--ChangeLog4
-rw-r--r--stapfuncs.5.in23
-rw-r--r--tapset/ChangeLog4
-rw-r--r--tapset/inet.stp8
-rw-r--r--testsuite/ChangeLog4
-rwxr-xr-xtestsuite/buildok/inet-embedded.stp6
6 files changed, 49 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0cd3c197..8c2b1535 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-04 Frank Ch. Eigler <fche@elastic.org>
+
+ * stapfuncs.5.in: Document inet.stp tapset functions.
+
2007-10-04 David Smith <dsmith@redhat.com>
* buildrun.cxx (compile_pass): Tweaked build system for the
diff --git a/stapfuncs.5.in b/stapfuncs.5.in
index 71af8c9b..fe8c45b8 100644
--- a/stapfuncs.5.in
+++ b/stapfuncs.5.in
@@ -352,6 +352,29 @@ Returns the string representation of the given socket flags value.
msg_flags_num2str:string (flags:long)
Returns the string representation of the given message flags bit map.
+.SS INET
+These functions convert between network (big-endian) and host byte order, like their
+namesake C functions.
+.TP
+ntohll:long (x:long)
+Convert from network to host byte order, 64-bit.
+.TP
+ntohl:long (x:long)
+Convert from network to host byte order, 32-bit.
+.TP
+ntohs:long (x:long)
+Convert from network to host byte order, 16-bit.
+.TP
+htonll:long (x:long)
+Convert from host to network byte order, 64-bit.
+.TP
+htonl:long (x:long)
+Convert from host to network byte order, 32-bit.
+.TP
+htons:long (x:long)
+Convert from host to network byte order, 16-bit.
+
+
.SH FILES
.nh
.IR @prefix@/share/systemtap/tapset
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index dc48455b..e22dde29 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-04 Frank Ch. Eigler <fche@elastic.org>
+
+ * inet.stp: New tapset for htonl and friends.
+
2007-10-04 Zhaolei <zhaolei@cn.fujitsu.com>
* queue_stats.stp (qsq_print): Make value of ops/s output as float
diff --git a/tapset/inet.stp b/tapset/inet.stp
new file mode 100644
index 00000000..0fdd4bab
--- /dev/null
+++ b/tapset/inet.stp
@@ -0,0 +1,8 @@
+/* Some functions from libc <arpa/inet.h> */
+
+function htonll:long (x:long) %{ THIS->__retvalue = (int64_t) cpu_to_be64 ((u64) THIS->x); %}
+function htonl:long (x:long) %{ THIS->__retvalue = (int64_t) cpu_to_be32 ((u32) THIS->x); %}
+function htons:long (x:long) %{ THIS->__retvalue = (int64_t) cpu_to_be16 ((u16) THIS->x); %}
+function ntohll:long (x:long) %{ THIS->__retvalue = (int64_t) be64_to_cpu ((u64) THIS->x); %}
+function ntohl:long (x:long) %{ THIS->__retvalue = (int64_t) be32_to_cpu ((u32) THIS->x); %}
+function ntohs:long (x:long) %{ THIS->__retvalue = (int64_t) be16_to_cpu ((u16) THIS->x); %}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 55b0c44a..88a3eb48 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-04 Frank Ch. Eigler <fche@elastic.org>
+
+ * buildok/inet-embedded.stp: Test inet.stp functions.
+
2007-10-04 Mike Mason <mmlnx@us.ibm.com>
* buildok/memory-all-probes.stp: New test that uses wildcarding to
diff --git a/testsuite/buildok/inet-embedded.stp b/testsuite/buildok/inet-embedded.stp
new file mode 100755
index 00000000..94b6fcda
--- /dev/null
+++ b/testsuite/buildok/inet-embedded.stp
@@ -0,0 +1,6 @@
+#! stap -p4
+#
+probe begin {
+ print (ntohll(0xfedcba9876543210) + ntohl(0xdeadbeef) + ntohs(0xd00d) +
+ htonll(0x0123456789abcdef) + htonl(0xff0000ff) + htons(0xabcd))
+}