# Tracing Functions Called in Network Socket Code

This section describes how to trace functions called from the kernel's `net/socket.c` file. This task helps you identify, in finer detail, how each process interacts with the network at the kernel level.

## socket-trace.stp

sockettrace is identical to thread_indent, which was earlier used in systemtapscript-functions to illustrate how `thread_indent()` works.

## sockettrace Sample Output

    [...]
    0 Xorg(3611): -> sock_poll
    3 Xorg(3611): <- sock_poll
    0 Xorg(3611): -> sock_poll
    3 Xorg(3611): <- sock_poll
    0 gnome-terminal(11106): -> sock_poll
    5 gnome-terminal(11106): <- sock_poll
    0 scim-bridge(3883): -> sock_poll
    3 scim-bridge(3883): <- sock_poll
    0 scim-bridge(3883): -> sys_socketcall
    4 scim-bridge(3883):  -> sys_recv
    8 scim-bridge(3883):   -> sys_recvfrom
    12 scim-bridge(3883):-> sock_from_file
    16 scim-bridge(3883):<- sock_from_file
    20 scim-bridge(3883):-> sock_recvmsg
    24 scim-bridge(3883):<- sock_recvmsg
    28 scim-bridge(3883):   <- sys_recvfrom
    31 scim-bridge(3883):  <- sys_recv
    35 scim-bridge(3883): <- sys_socketcall
    [...]

sockettraceoutput contains a 3-second excerpt of the output for sockettrace. For more information about the output of this script as provided by `thread_indent()`, refer to systemtapscript-functions thread_indent.