%{ #include #include %} function get_local_port:long(sk) %{ unsigned long ptr = (unsigned long) THIS->sk; struct inet_sock *inet = (struct inet_sock *) ptr; THIS->__retvalue = (long long) inet->num; %} probe kernel.function("tcp_accept") { print(execname()." [".string(pid())."] ".string(get_local_port($sk))) }