This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: problem about compile script use guru mode
On 03/20/2012 03:22 AM, ch huang wrote:
> i write this script ,but failed in compiling,any one can help?
>
> %{
> #include <linux/version.h>
> #include <net/sock.h>
> #include <net/tcp.h>
> #include <net/ip.h>
> #include <linux/skbuff.h>
> %}
>
> function tcp_ts_get_info_state:long(sock:long)
> %{
> struct sock *sk = (struct sock *)(long) THIS->sock;
> THIS->__retvalue = (int64_t) kread(&(sk->sk_state));
> CATCH_DEREF_FAULT();
> %}
>
> probe tcp.sendmsg {
> printf("%s: TCP: Sending message. state is : %d , Flags %d. Size
> %d\n", execname(),tcp_ts_get_info_state($sk), $sk->sk_flags, size)
> }
Besides renaming the duplicated function, another solution here would be
to remove the function all together, like the following.
probe tcp.sendmsg {
printf("%s: TCP: Sending message. state is : %d , Flags %d. Size %d\n",
execname(), $sk->__sk_common->skc_state, $sk->sk_flags, size)
}
Note that the above will work on current era kernels. It won't work on
older kernels (before several fields were moved to the sock_common
structure), but even that could be worked around by using @defined().
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)