From 6b5ccb8a92416454a4cdf08040f14cc5390011c6 Mon Sep 17 00:00:00 2001 From: hien Date: Mon, 10 Jul 2006 23:06:10 +0000 Subject: [PATCH] Fix problem with rhel4u4 kernel --- tapset/tcp.stp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tapset/tcp.stp b/tapset/tcp.stp index 29fcd0d81..1e41a7e81 100644 --- a/tapset/tcp.stp +++ b/tapset/tcp.stp @@ -21,9 +21,13 @@ function tcp_get_info_rto:long(sock:long) %{ unsigned long ptr = (unsigned long) THIS->sock; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + struct tcp_opt *tp = tcp_sk((struct sock *)ptr); + THIS->__retvalue = (int64_t) jiffies_to_usecs(tp->rto); +#else const struct inet_connection_sock *icsk = inet_csk((struct sock *)ptr); - THIS->__retvalue = (int64_t) jiffies_to_usecs(icsk->icsk_rto); +#endif %} //Get congestion window segment size. Initial value of congestion window size @@ -33,8 +37,11 @@ function tcp_get_info_rto:long(sock:long) function tcp_get_info_snd_cwnd:long(sock:long) %{ unsigned long ptr = (unsigned long) THIS->sock; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + struct tcp_opt *tp = tcp_sk((struct sock *)ptr); +#else struct tcp_sock *tp = tcp_sk((struct sock *)ptr); - +#endif THIS->__retvalue = (int64_t) tp->snd_cwnd; %} @@ -69,7 +76,11 @@ function tcp_ts_get_info_state:long(sock:long) function tcp_ts_get_info_snd_ssthresh:long(sock:long) %{ unsigned long ptr = (unsigned long) THIS->sock; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + struct tcp_opt *tp = tcp_sk((struct sock *)ptr); +#else struct tcp_sock *tp = tcp_sk((struct sock *)ptr); +#endif THIS->__retvalue = (int64_t) tp->snd_ssthresh; %} @@ -79,9 +90,13 @@ function tcp_ts_get_info_snd_ssthresh:long(sock:long) function tcp_ts_get_info_rcv_mss:long(sock:long) %{ unsigned long ptr = (unsigned long) THIS->sock; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + struct tcp_opt *tp = tcp_sk((struct sock *)ptr); + THIS->__retvalue = (int64_t) tp->ack.rcv_mss; +#else const struct inet_connection_sock *icsk = inet_csk((struct sock *)ptr); - THIS->__retvalue = (int64_t) icsk->icsk_ack.rcv_mss; +#endif %} // probe tcp.sendmsg @@ -111,7 +126,8 @@ probe tcp.sendmsg = kernel.function("tcp_sendmsg") { // size - number of bytes sent // probe tcp.sendmsg.return = kernel.function("tcp_sendmsg").return { - size = $return +# size = $return + size = retval() } // probe tcp.recvmsg @@ -141,7 +157,8 @@ probe tcp.recvmsg = kernel.function("tcp_recvmsg") { // size - number of bytes received // probe tcp.recvmsg.return = kernel.function("tcp_recvmsg").return { - size = $return +# size = $return + size = retval() } // probe tcp.disconnect -- 2.43.5