[ltt-dev] [PATCH 2/2] Make ltt support separate socketcall tracepoint

Zhaolei zhaolei at cn.fujitsu.com
Sun Feb 8 23:01:19 EST 2009


So ltt can trace these socket syscalls.

Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>
---
 ltt/probes/net-trace.c |  112 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 97 insertions(+), 15 deletions(-)

diff --git a/ltt/probes/net-trace.c b/ltt/probes/net-trace.c
index a30530d..83cf33a 100644
--- a/ltt/probes/net-trace.c
+++ b/ltt/probes/net-trace.c
@@ -75,30 +75,112 @@ void probe_ipv6_addr_del(struct inet6_ifaddr *ifa)
 		addr[3], addr[2], addr[1], addr[0]);
 }
 
-void probe_socket_sendmsg(struct socket *sock, struct msghdr *msg,
-		size_t size, int ret)
+void probe_socket_create(int family, int type, int protocol,
+	struct socket *sock, int ret)
+{
+	trace_mark_tp(net, socket_create, socket_create, probe_socket_create,
+		"family %d type %d protocol %d sock %p ret %d",
+		family, type, protocol, sock, ret);
+}
+
+void probe_socket_bind(int fd, struct sockaddr __user *umyaddr, int addrlen,
+	int ret)
+{
+	trace_mark_tp(net, socket_bind, socket_bind, probe_socket_bind,
+		"fd %d umyaddr %p addrlen %d ret %d",
+		fd, umyaddr, addrlen, ret);
+}
+
+void probe_socket_connect(int fd, struct sockaddr __user *uservaddr,
+	int addrlen, int ret)
+{
+	trace_mark_tp(net, socket_connect, socket_connect, probe_socket_connect,
+		"fd %d uservaddr %p addrlen %d ret %d",
+		fd, uservaddr, addrlen, ret);
+}
+
+void probe_socket_listen(int fd, int backlog, int ret)
+{
+	trace_mark_tp(net, socket_listen, socket_listen, probe_socket_listen,
+		"fd %d backlog %d ret %d",
+		fd, backlog, ret);
+}
+
+void probe_socket_accept(int fd, struct sockaddr __user *upeer_sockaddr,
+	int __user *upeer_addrlen, int flags, int ret)
+{
+	trace_mark_tp(net, socket_accept, socket_accept, probe_socket_accept,
+		"fd %d upeer_sockaddr %p upeer_addrlen %p flags %d ret %d",
+		fd, upeer_sockaddr, upeer_addrlen, flags, ret);
+}
+
+void probe_socket_getsockname(int fd, struct sockaddr __user *usockaddr,
+	int __user *usockaddr_len, int ret)
+{
+	trace_mark_tp(net, socket_getsockname, socket_getsockname,
+		probe_socket_getsockname,
+		"fd %d usockaddr %p usockaddr_len %p ret %d",
+		fd, usockaddr, usockaddr_len, ret);
+}
+
+void probe_socket_getpeername(int fd, struct sockaddr __user *usockaddr,
+	int __user *usockaddr_len, int ret)
+{
+	trace_mark_tp(net, socket_getpeername, socket_getpeername,
+		probe_socket_getpeername,
+		"fd %d usockaddr %p usockaddr_len %p ret %d",
+		fd, usockaddr, usockaddr_len, ret);
+}
+
+void probe_socket_socketpair(int family, int type, int protocol,
+	int __user *usockvec, int ret)
+{
+	trace_mark_tp(net, socket_socketpair, socket_socketpair,
+		probe_socket_socketpair,
+		"family %d type %d protocol %d usockvec %p ret %d",
+		family, type, protocol, usockvec, ret);
+}
+
+void probe_socket_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
+	int ret)
 {
 	trace_mark_tp(net, socket_sendmsg, socket_sendmsg, probe_socket_sendmsg,
-		"sock %p family %d type %d protocol %d size %zu",
-		sock, sock->sk->sk_family, sock->sk->sk_type,
-		sock->sk->sk_protocol, size);
+		"sock %p msg %p size %zu ret %d",
+		sock, msg, size, ret);
 }
 
-void probe_socket_recvmsg(struct socket *sock, struct msghdr *msg,
-		size_t size, int flags, int ret)
+void probe_socket_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
+	int flags, int ret)
 {
 	trace_mark_tp(net, socket_recvmsg, socket_recvmsg, probe_socket_recvmsg,
-		"sock %p family %d type %d protocol %d size %zu",
-		sock, sock->sk->sk_family, sock->sk->sk_type,
-		sock->sk->sk_protocol, size);
+		"sock %p msg %p size %zu flags %d ret %d",
+		sock, msg, size, flags, ret);
 }
 
-void probe_socket_create(struct socket *sock, int fd)
+void probe_socket_setsockopt(int fd, int level, int optname,
+	char __user *optval, int optlen, int ret)
 {
-	trace_mark_tp(net, socket_create, socket_create, probe_socket_create,
-		"sock %p family %d type %d protocol %d fd %d",
-		sock, sock->sk->sk_family, sock->sk->sk_type,
-		sock->sk->sk_protocol, fd);
+	trace_mark_tp(net, socket_setsockopt, socket_setsockopt,
+		probe_socket_setsockopt,
+		"fd %d level %d optname %d optval %p optlen %d ret %d",
+		fd, level, optname, optval, optlen, ret);
+}
+
+void probe_socket_getsockopt(int fd, int level, int optname,
+	char __user *optval, int __user *optlen, int ret)
+{
+	trace_mark_tp(net, socket_getsockopt, socket_getsockopt,
+		probe_socket_getsockopt,
+		"fd %d level %d optname %d optval %p optlen %p ret %d",
+		fd, level, optname, optval, optlen, ret);
+}
+
+void probe_socket_shutdown(int fd, int how, int ret)
+{
+	trace_mark_tp(net, socket_shutdown, socket_shutdown,
+		probe_socket_shutdown,
+		"fd %d how %d ret %d",
+		fd, how, ret);
 }
 
 void probe_socket_call(int call, unsigned long a0)
-- 
1.5.5.3






More information about the lttng-dev mailing list