summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-04-29 22:57:33 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-04-29 22:57:33 -0400
commitba6f838d2471c57fc3d8fc6d325766ff95ce108a (patch)
treedeb1d028b85d1a68b06c06eec4700367cfe793a3 /tapset
parent8c392b1a21fbe01e785c20df6bd7a254f8e517d0 (diff)
downloadsystemtap-steved-ba6f838d2471c57fc3d8fc6d325766ff95ce108a.tar.gz
systemtap-steved-ba6f838d2471c57fc3d8fc6d325766ff95ce108a.tar.xz
systemtap-steved-ba6f838d2471c57fc3d8fc6d325766ff95ce108a.zip
PR6466: broad side-effect free statement elision
Diffstat (limited to 'tapset')
-rw-r--r--tapset/ChangeLog7
-rw-r--r--tapset/tcp.stp65
2 files changed, 41 insertions, 31 deletions
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index f269b468..cf41c9cb 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,10 @@
+2008-04-29 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 6466
+ * tcp.stp (tcp_sockstate_str, tcp_sockopt_str): Initialize
+ number->string lookup tables here, instead of "probe begin(-1)"
+ block that can be elided/warned.
+
2008-04-16 Wenji Huang <wenji.huang@oracle.com>
* scsi.stp (scsi.iodispatching): Correct for 2.6.25 kernel.
diff --git a/tapset/tcp.stp b/tapset/tcp.stp
index 3c3bd23b..7fa48000 100644
--- a/tapset/tcp.stp
+++ b/tapset/tcp.stp
@@ -71,7 +71,23 @@ function tcp_ts_get_info_state:long(sock:long)
CATCH_DEREF_FAULT();
%}
+global sockstate[13], sockstate_init_p
function tcp_sockstate_str:string (state:long) {
+ if (! sockstate_init_p) {
+ sockstate_init_p = 1
+ sockstate[1] = "TCP_ESTABLISHED"
+ sockstate[2] = "TCP_SYN_SENT"
+ sockstate[3] = "TCP_SYN_RECV"
+ sockstate[4] = "TCP_FIN_WAIT1"
+ sockstate[5] = "TCP_FIN_WAIT2"
+ sockstate[6] = "TCP_TIME_WAIT"
+ sockstate[7] = "TCP_CLOSE"
+ sockstate[8] = "TCP_CLOSE_WAIT"
+ sockstate[9] = "TCP_LAST_ACK"
+ sockstate[10] = "TCP_LISTEN"
+ sockstate[11] = "TCP_CLOSING"
+ sockstate[12] = "TCP_MAX_STATES"
+ }
return (state in sockstate ? sockstate[state] : "UNDEF")
}
@@ -105,7 +121,25 @@ function tcp_ts_get_info_rcv_mss:long(sock:long)
CATCH_DEREF_FAULT();
%}
+global sockopt[15], sockopt_init_p
function tcp_sockopt_str:string (optname:long) {
+ if (!sockopt_init_p) {
+ sockopt_init_p=1
+ sockopt[1] = "TCP_NODELAY"
+ sockopt[2] = "TCP_MAXSEG"
+ sockopt[3] = "TCP_CORK"
+ sockopt[4] = "TCP_KEEPIDLE"
+ sockopt[5] = "TCP_KEEPINTVL"
+ sockopt[6] = "TCP_KEEPCNT"
+ sockopt[7] = "TCP_SYNCNT"
+ sockopt[8] = "TCP_LINGER2"
+ sockopt[9] = "TCP_DEFER_ACCEPT"
+ sockopt[10] = "TCP_WINDOW_CLAMP"
+ sockopt[11] = "TCP_INFO"
+ sockopt[12] = "TCP_QUICKACK"
+ sockopt[13] = "TCP_CONGESTION"
+ sockopt[14] = "TCP_MD5SIG"
+ }
return (optname in sockopt ? sockopt[optname] : "UNDEF")
}
@@ -257,34 +291,3 @@ probe tcp.setsockopt.return = kernel.function("tcp_setsockopt").return {
ret = $return
}
-global sockopt[15], sockstate[13]
-
-probe begin(-1) {
- sockopt[1] = "TCP_NODELAY"
- sockopt[2] = "TCP_MAXSEG"
- sockopt[3] = "TCP_CORK"
- sockopt[4] = "TCP_KEEPIDLE"
- sockopt[5] = "TCP_KEEPINTVL"
- sockopt[6] = "TCP_KEEPCNT"
- sockopt[7] = "TCP_SYNCNT"
- sockopt[8] = "TCP_LINGER2"
- sockopt[9] = "TCP_DEFER_ACCEPT"
- sockopt[10] = "TCP_WINDOW_CLAMP"
- sockopt[11] = "TCP_INFO"
- sockopt[12] = "TCP_QUICKACK"
- sockopt[13] = "TCP_CONGESTION"
- sockopt[14] = "TCP_MD5SIG"
-
- sockstate[1] = "TCP_ESTABLISHED"
- sockstate[2] = "TCP_SYN_SENT"
- sockstate[3] = "TCP_SYN_RECV"
- sockstate[4] = "TCP_FIN_WAIT1"
- sockstate[5] = "TCP_FIN_WAIT2"
- sockstate[6] = "TCP_TIME_WAIT"
- sockstate[7] = "TCP_CLOSE"
- sockstate[8] = "TCP_CLOSE_WAIT"
- sockstate[9] = "TCP_LAST_ACK"
- sockstate[10] = "TCP_LISTEN"
- sockstate[11] = "TCP_CLOSING"
- sockstate[12] = "TCP_MAX_STATES"
-}