summaryrefslogtreecommitdiffstats
path: root/net/inet_bind.stp
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-06-10 11:21:37 -0400
committerSteve Dickson <steved@redhat.com>2009-06-10 11:21:37 -0400
commitdfdce363041b4fb72910837174bf40019923c9bc (patch)
tree827cf40c3a311e8314c0e6719cebd7e0c34919ec /net/inet_bind.stp
parentaaa6513f6db3a54691cfa7022bfbd979db42672e (diff)
downloadsystemtap-dfdce363041b4fb72910837174bf40019923c9bc.tar.gz
systemtap-dfdce363041b4fb72910837174bf40019923c9bc.tar.xz
systemtap-dfdce363041b4fb72910837174bf40019923c9bc.zip
Reorganised scripts into local directories
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'net/inet_bind.stp')
-rw-r--r--net/inet_bind.stp102
1 files changed, 102 insertions, 0 deletions
diff --git a/net/inet_bind.stp b/net/inet_bind.stp
new file mode 100644
index 0000000..621473a
--- /dev/null
+++ b/net/inet_bind.stp
@@ -0,0 +1,102 @@
+%{
+#include <net/sock.h>
+#include <net/inet_hashtables.h>
+#include <linux/in.h>
+%}
+
+function _inet_ntoa:string (_uaddr:long) %{
+ struct sockaddr_in *addr;
+ unsigned char *bytes;
+
+ addr = (struct sockaddr_in *)(long)kread(&THIS->_uaddr);
+ bytes = (unsigned char *)&addr->sin_addr.s_addr;
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "%d.%d.%d.%d:%d", bytes[0], bytes[1], bytes[2], bytes[3],
+ addr->sin_port);
+
+ CATCH_DEREF_FAULT();
+%}
+function _socket_dump:string (_sock:long) %{
+ struct socket *sock;
+
+ sock = (struct socket *)(long)kread(&THIS->_sock);
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "state %d type %d", sock->state, sock->type);
+
+ CATCH_DEREF_FAULT();
+%}
+function _sock_dump:string (_sk:long) %{
+ struct sock *sk;
+
+ sk = (struct sock *)(long)kread(&THIS->_sk);
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "reuse %d state %d", sk->sk_reuse, sk->sk_state);
+
+ CATCH_DEREF_FAULT();
+%}
+function _tb_dump:string (_tp:long) %{
+ struct inet_bind_bucket *tp;
+
+ tp = (struct inet_bind_bucket *)(long)kread(&THIS->_tp);
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "port %d fastreuse %d", tp->port, tp->fastreuse);
+
+ CATCH_DEREF_FAULT();
+%}
+
+probe kernel.function("inet_bind") {
+ if (isinstr(execname(), "rpc.nfsd")) {
+ printf("inet_bind(%s): socket [%s] uaddr %s addr_len %d\n",
+ execname(), _socket_dump($sock), _inet_ntoa($uaddr), $addr_len);
+ }
+}
+probe kernel.function("inet_bind").return {
+ if (isinstr(execname(), "rpc.nfsd"))
+ printf("inet_bind: return %d (%s)\n", $return, errno_str($return));
+}
+probe kernel.function("inet_listen") {
+ if (isinstr(execname(), "rpc.nfsd")) {
+ printf("inet_listen(%s): socket [%s] backlog %d\n",
+ execname(), _socket_dump($sock), $backlog);
+ }
+}
+probe kernel.function("inet_listen").return {
+ if (isinstr(execname(), "rpc.nfsd"))
+ printf("inet_listen: return %d (%s)\n", $return, errno_str($return));
+}
+probe kernel.function("udp_v4_get_port") {
+ if (isinstr(execname(), "rpc.nfsd")) {
+ printf(" udp_v4_get_port(%s): sock %p snum %d\n",
+ execname(), $sk, $snum);
+ }
+}
+probe kernel.function("udp_v4_get_port").return {
+ if (isinstr(execname(), "rpc.nfsd"))
+ printf(" udp_v4_get_port: return %d (%s)\n",
+ $return, errno_str($return));
+}
+probe kernel.function("tcp_v4_get_port") {
+ if (isinstr(execname(), "rpc.nfsd")) {
+ printf(" tcp_v4_get_port(%s): sock [%s] snum %d\n",
+ execname(), _sock_dump($sk), $snum);
+ }
+}
+probe kernel.function("tcp_v4_get_port").return {
+ if (isinstr(execname(), "rpc.nfsd"))
+ printf(" tcp_v4_get_port: return %d (%s)\n",
+ $return, errno_str($return));
+}
+probe kernel.function("inet_csk_bind_conflict") {
+ if (isinstr(execname(), "rpc.nfsd")) {
+ printf(" bind_conflict(%s): sock [%s] tb [%s]\n",
+ execname(), _sock_dump($sk), _tb_dump($tb));
+ }
+}
+probe kernel.function("inet_csk_bind_conflict").return {
+ if (isinstr(execname(), "rpc.nfsd"))
+ printf(" bind_conflict: return %d (%s)\n",
+ $return, errno_str($return));
+}
+probe begin { log("starting inet_bind probe") }
+probe end { log("ending inet_bind probe") }