/usr/share/systemtap/tapset/linux
NameSizeModeActions
arm/-0755rm
arm64/-0755rm
i386/-0755rm
ia64/-0755rm
mips/-0755rm
powerpc/-0755rm
riscv/-0755rm
s390/-0755rm
x86_64/-0755rm
atomic.stp15630644editdlrm
aux_syscalls.stp1517020644editdlrm
context-caller.stp31480644editdlrm
context-envvar.stp17610644editdlrm
context-symbols.stp122760644editdlrm
context-unwind.stp32830644editdlrm
context.stp190150644editdlrm
context.stpm1250644editdlrm
conversions-guru.stp58760644editdlrm
conversions.stp172730644editdlrm
ctime.stp57500644editdlrm
dentry.stp106670644editdlrm
dev.stp20740644editdlrm
endian.stp6020644editdlrm
errno.stpm570644editdlrm
guru-delay.stp12300644editdlrm
guru-signal.stp10920644editdlrm
inet.stp14560644editdlrm
inet.stpm3830644editdlrm
inet_sock.stp12820644editdlrm
ioblock.stp155970644editdlrm
ioscheduler.stp140980644editdlrm
ip.stp54830644editdlrm
ipmib-filter-default.stp9650644editdlrm
ipmib.stp129810644editdlrm
irq.stp51200644editdlrm
json.stp91940644editdlrm
json.stpm62560644editdlrm
kprocess.stp47500644editdlrm
kretprobe.stp21530644editdlrm
linuxmib-filter-default.stp8760644editdlrm
linuxmib.stp37180644editdlrm
loadavg.stp19950644editdlrm
logging.stp25850644editdlrm
memory.stp192190644editdlrm
netfilter.stp363560644editdlrm
networking.stp96560644editdlrm
nfs.stp389970644editdlrm
nfsd.stp473790644editdlrm
nfsderrno.stp119790644editdlrm
nfs_proc.stp583250644editdlrm
nfs_proc.stpm12880644editdlrm
panic.stp10920644editdlrm
perf.stp52840644editdlrm
proc_mem.stp127020644editdlrm
pstrace.stp7730644editdlrm
rcu.stp9280644editdlrm
rlimit.stp13820644editdlrm
rpc.stp385780644editdlrm
scheduler.stp116610644editdlrm
scsi.stp97210644editdlrm
signal.stp293710644editdlrm
socket.stp350240644editdlrm
syscalls.stpm146430644editdlrm
syscalls_cfg_trunc.stp1110644editdlrm
syscall_any.stp15600644editdlrm
syscall_table.stp14750644editdlrm
sysc_accept.stp78680644editdlrm
sysc_accept4.stp78640644editdlrm
sysc_access.stp29110644editdlrm
sysc_acct.stp25830644editdlrm
sysc_add_key.stp35320644editdlrm
sysc_adjtimex.stp56720644editdlrm
sysc_alarm.stp28330644editdlrm
sysc_bdflush.stp31130644editdlrm
sysc_bind.stp69650644editdlrm
sysc_bpf.stp27380644editdlrm
sysc_brk.stp26290644editdlrm
sysc_capget.stp31010644editdlrm
sysc_capset.stp31020644editdlrm
sysc_chdir.stp26160644editdlrm
sysc_chmod.stp29590644editdlrm
sysc_chown.stp37750644editdlrm
sysc_chown16.stp31150644editdlrm
sysc_chroot.stp26790644editdlrm
sysc_clock_adjtime.stp52430644editdlrm
sysc_clock_getres.stp42480644editdlrm
sysc_clock_gettime.stp40350644editdlrm
sysc_clock_nanosleep.stp80410644editdlrm
sysc_clock_settime.stp55540644editdlrm
sysc_clone.stp67080644editdlrm
sysc_close.stp27710644editdlrm
sysc_connect.stp74520644editdlrm
sysc_copy_file_range.stp37690644editdlrm
sysc_creat.stp27280644editdlrm
sysc_delete_module.stp33660644editdlrm
sysc_dup.stp23830644editdlrm
sysc_dup2.stp29910644editdlrm
sysc_dup3.stp30730644editdlrm
sysc_epoll_create.stp57420644editdlrm
sysc_epoll_ctl.stp39980644editdlrm
sysc_epoll_pwait.stp41570644editdlrm
sysc_epoll_wait.stp48500644editdlrm
sysc_eventfd.stp54110644editdlrm
sysc_execve.stp62570644editdlrm
sysc_execveat.stp69420644editdlrm
sysc_exit.stp19840644editdlrm
sysc_exit_group.stp21460644editdlrm
sysc_faccessat.stp37360644editdlrm
sysc_faccessat2.stp44340644editdlrm
sysc_fadvise64.stp86390644editdlrm
sysc_fallocate.stp39180644editdlrm
sysc_fanotify_init.stp34320644editdlrm
sysc_fanotify_mark.stp75720644editdlrm
sysc_fchdir.stp25250644editdlrm
sysc_fchmod.stp28800644editdlrm
sysc_fchmodat.stp37340644editdlrm
sysc_fchown.stp37220644editdlrm
sysc_fchown16.stp30230644editdlrm
sysc_fchownat.stp39030644editdlrm
sysc_fcntl.stp48060644editdlrm
sysc_fdatasync.stp26920644editdlrm
sysc_fgetxattr.stp37200644editdlrm
sysc_finit_module.stp33820644editdlrm
sysc_flistxattr.stp30000644editdlrm
sysc_flock.stp25790644editdlrm
sysc_fork.stp25860644editdlrm
sysc_fremovexattr.stp32290644editdlrm
sysc_fsetxattr.stp41870644editdlrm
sysc_fstat.stp61630644editdlrm
sysc_fstatat.stp57890644editdlrm
sysc_fstatfs.stp32660644editdlrm
sysc_fstatfs64.stp32400644editdlrm
sysc_fsync.stp24190644editdlrm
sysc_ftruncate.stp62120644editdlrm
sysc_futex.stp58100644editdlrm
sysc_futimesat.stp66390644editdlrm
sysc_getcpu.stp30340644editdlrm
sysc_getcwd.stp27470644editdlrm
sysc_getdents.stp56180644editdlrm
sysc_getegid.stp35420644editdlrm
sysc_geteuid.stp34840644editdlrm
sysc_getgid.stp34020644editdlrm
sysc_getgroups.stp42740644editdlrm
sysc_gethostname.stp12490644editdlrm
sysc_getitimer.stp53550644editdlrm
sysc_getpeername.stp75220644editdlrm
sysc_getpgid.stp28590644editdlrm
sysc_getpgrp.stp20900644editdlrm
sysc_getpid.stp20310644editdlrm
sysc_getppid.stp21120644editdlrm
sysc_getpriority.stp29430644editdlrm
sysc_getrandom.stp31840644editdlrm
sysc_getresgid.stp41720644editdlrm
sysc_getresuid.stp39720644editdlrm
sysc_getrlimit.stp44600644editdlrm
sysc_getrusage.stp38030644editdlrm
sysc_getsid.stp25090644editdlrm
sysc_getsockname.stp75500644editdlrm
sysc_getsockopt.stp85200644editdlrm
sysc_gettid.stp20570644editdlrm
sysc_gettimeofday.stp40780644editdlrm
sysc_getuid.stp34270644editdlrm
sysc_getxattr.stp38120644editdlrm
sysc_get_mempolicy.stp46710644editdlrm
sysc_get_robust_list.stp45720644editdlrm
sysc_init_module.stp32410644editdlrm
sysc_inotify_add_watch.stp38610644editdlrm
sysc_inotify_init.stp55480644editdlrm
sysc_inotify_rm_watch.stp32770644editdlrm
sysc_ioctl.stp35360644editdlrm
sysc_ioperm.stp28190644editdlrm
sysc_ioprio_get.stp30180644editdlrm
sysc_ioprio_set.stp32470644editdlrm
sysc_io_cancel.stp33180644editdlrm
sysc_io_destroy.stp28160644editdlrm
sysc_io_getevents.stp49940644editdlrm
sysc_io_setup.stp38380644editdlrm
sysc_io_submit.stp39830644editdlrm
sysc_kcmp.stp30070644editdlrm
sysc_kexec_file_load.stp40410644editdlrm
sysc_kexec_load.stp45130644editdlrm
sysc_keyctl.stp37220644editdlrm
sysc_kill.stp25910644editdlrm
sysc_lchown.stp38800644editdlrm
sysc_lchown16.stp31940644editdlrm
sysc_lgetxattr.stp39120644editdlrm
sysc_link.stp28850644editdlrm
sysc_linkat.stp40050644editdlrm
sysc_listen.stp66240644editdlrm
sysc_listxattr.stp33180644editdlrm
sysc_llistxattr.stp33790644editdlrm
sysc_llseek.stp33710644editdlrm
sysc_lookup_dcookie.stp40890644editdlrm
sysc_lremovexattr.stp40010644editdlrm
sysc_lseek.stp45000644editdlrm
sysc_lsetxattr.stp40970644editdlrm
sysc_lstat.stp64550644editdlrm
sysc_madvise.stp29760644editdlrm
sysc_mbind.stp43030644editdlrm
sysc_membarrier.stp30170644editdlrm
sysc_memfd_create.stp32470644editdlrm
sysc_memfd_secret.stp28150644editdlrm
sysc_migrate_pages.stp43740644editdlrm
sysc_mincore.stp29000644editdlrm
sysc_mkdir.stp28970644editdlrm
sysc_mkdirat.stp34450644editdlrm
sysc_mknod.stp29580644editdlrm
sysc_mknodat.stp36440644editdlrm
sysc_mlock.stp26180644editdlrm
sysc_mlock2.stp28820644editdlrm
sysc_mlockall.stp27710644editdlrm
sysc_mmap2.stp62290644editdlrm
sysc_modify_ldt.stp31120644editdlrm
sysc_mount.stp44990644editdlrm
sysc_move_pages.stp47250644editdlrm
sysc_mprotect.stp29660644editdlrm
sysc_mq_getsetattr.stp44600644editdlrm
sysc_mq_notify.stp39360644editdlrm
sysc_mq_open.stp53850644editdlrm
sysc_mq_timedreceive.stp61830644editdlrm
sysc_mq_timedsend.stp59280644editdlrm
sysc_mq_unlink.stp30180644editdlrm
sysc_mremap.stp35770644editdlrm
sysc_msgctl.stp82550644editdlrm
sysc_msgget.stp44230644editdlrm
sysc_msgrcv.stp106890644editdlrm
sysc_msgsnd.stp88660644editdlrm
sysc_msync.stp28510644editdlrm
sysc_munlock.stp27440644editdlrm
sysc_munlockall.stp23420644editdlrm
sysc_munmap.stp27090644editdlrm
sysc_name_to_handle_at.stp41500644editdlrm
sysc_nanosleep.stp58240644editdlrm
sysc_nfsservctl.stp22840644editdlrm
sysc_nice.stp24400644editdlrm
sysc_ni_syscall.stp14330644editdlrm
sysc_open.stp43290644editdlrm
sysc_openat.stp39160644editdlrm
sysc_open_by_handle_at.stp42980644editdlrm
sysc_pause.stp25640644editdlrm
sysc_perf_event_open.stp38080644editdlrm
sysc_personality.stp30770644editdlrm
sysc_pipe.stp105960644editdlrm
sysc_pivot_root.stp33140644editdlrm
sysc_pkey_alloc.stp30570644editdlrm
sysc_pkey_free.stp27190644editdlrm
sysc_pkey_mprotect.stp33920644editdlrm
sysc_poll.stp27690644editdlrm
sysc_ppoll.stp64930644editdlrm
sysc_prctl.stp29930644editdlrm
sysc_pread.stp54270644editdlrm
sysc_preadv.stp52830644editdlrm
sysc_preadv2.stp56670644editdlrm
sysc_prlimit64.stp34950644editdlrm
sysc_process_vm_readv.stp47750644editdlrm
sysc_process_vm_writev.stp48970644editdlrm
sysc_pselect6.stp64570644editdlrm
sysc_pselect7.stp36680644editdlrm
sysc_ptrace.stp36610644editdlrm
sysc_pwrite.stp72390644editdlrm
sysc_pwritev.stp54140644editdlrm
sysc_pwritev2.stp57740644editdlrm
sysc_quotactl.stp46910644editdlrm
sysc_read.stp37210644editdlrm
sysc_readahead.stp36010644editdlrm
sysc_readdir.stp40430644editdlrm
sysc_readlink.stp31140644editdlrm
sysc_readlinkat.stp38330644editdlrm
sysc_readv.stp35020644editdlrm
sysc_reboot.stp32530644editdlrm
sysc_recv.stp72600644editdlrm
sysc_recvfrom.stp85540644editdlrm
sysc_recvmmsg.stp64620644editdlrm
sysc_recvmsg.stp109620644editdlrm
sysc_remap_file_pages.stp39350644editdlrm
sysc_removexattr.stp33200644editdlrm
sysc_rename.stp30380644editdlrm
sysc_renameat.stp41910644editdlrm
sysc_renameat2.stp45000644editdlrm
sysc_request_key.stp41380644editdlrm
sysc_restart_syscall.stp25650644editdlrm
sysc_rmdir.stp26570644editdlrm
sysc_rt_sigaction.stp69520644editdlrm
sysc_rt_sigpending.stp47990644editdlrm
sysc_rt_sigprocmask.stp91050644editdlrm
sysc_rt_sigqueueinfo.stp47500644editdlrm
sysc_rt_sigreturn.stp16390644editdlrm
sysc_rt_sigsuspend.stp38790644editdlrm
sysc_rt_sigtimedwait.stp60240644editdlrm
sysc_rt_tgsigqueueinfo.stp44600644editdlrm
sysc_sched_getaffinity.stp41020644editdlrm
sysc_sched_getattr.stp36710644editdlrm
sysc_sched_getparam.stp32360644editdlrm
sysc_sched_getscheduler.stp32960644editdlrm
sysc_sched_get_priority_max.stp36400644editdlrm
sysc_sched_get_priority_min.stp36400644editdlrm
sysc_sched_rr_get_interval.stp48640644editdlrm
sysc_sched_setaffinity.stp39600644editdlrm
sysc_sched_setattr.stp34450644editdlrm
sysc_sched_setparam.stp32210644editdlrm
sysc_sched_setscheduler.stp36660644editdlrm
sysc_sched_yield.stp23150644editdlrm
sysc_seccomp.stp33650644editdlrm
sysc_select.stp63590644editdlrm
sysc_semctl.stp82060644editdlrm
sysc_semget.stp45960644editdlrm
sysc_semop.stp57700644editdlrm
sysc_semtimedop.stp99360644editdlrm
sysc_send.stp73690644editdlrm
sysc_sendfile.stp49120644editdlrm
sysc_sendmmsg.stp93050644editdlrm
sysc_sendmsg.stp121100644editdlrm
sysc_sendto.stp83570644editdlrm
sysc_setdomainname.stp37290644editdlrm
sysc_setfsgid.stp47960644editdlrm
sysc_setfsuid.stp48390644editdlrm
sysc_setgid.stp45730644editdlrm
sysc_setgroups.stp45190644editdlrm
sysc_sethostname.stp32740644editdlrm
sysc_setitimer.stp62860644editdlrm
sysc_setns.stp28040644editdlrm
sysc_setpgid.stp27600644editdlrm
sysc_setpriority.stp32180644editdlrm
sysc_setregid.stp66600644editdlrm
sysc_setresgid.stp70400644editdlrm
sysc_setresuid.stp70550644editdlrm
sysc_setreuid.stp66300644editdlrm
sysc_setrlimit.stp40300644editdlrm
sysc_setsid.stp21010644editdlrm
sysc_setsockopt.stp84440644editdlrm
sysc_settimeofday.stp66460644editdlrm
sysc_setuid.stp45720644editdlrm
sysc_setxattr.stp39930644editdlrm
sysc_set_mempolicy.stp41710644editdlrm
sysc_set_robust_list.stp43580644editdlrm
sysc_set_tid_address.stp31950644editdlrm
sysc_sgetmask.stp21690644editdlrm
sysc_shmat.stp67770644editdlrm
sysc_shmctl.stp81390644editdlrm
sysc_shmdt.stp39820644editdlrm
sysc_shmget.stp45010644editdlrm
sysc_shutdown.stp69090644editdlrm
sysc_sigaction.stp57820644editdlrm
sysc_sigaltstack.stp42670644editdlrm
sysc_signal.stp28670644editdlrm
sysc_signalfd.stp124640644editdlrm
sysc_sigpending.stp37120644editdlrm
sysc_sigprocmask.stp41720644editdlrm
sysc_sigreturn.stp14610644editdlrm
sysc_sigsuspend.stp45750644editdlrm
sysc_socket.stp74380644editdlrm
sysc_socketpair.stp82970644editdlrm
sysc_splice.stp33630644editdlrm
sysc_ssetmask.stp28100644editdlrm
sysc_stat.stp65350644editdlrm
sysc_statfs.stp34910644editdlrm
sysc_statfs64.stp34590644editdlrm
sysc_statx.stp41180644editdlrm
sysc_stime.stp30830644editdlrm
sysc_swapoff.stp28750644editdlrm
sysc_swapon.stp31210644editdlrm
sysc_symlink.stp30280644editdlrm
sysc_symlinkat.stp40600644editdlrm
sysc_sync.stp19250644editdlrm
sysc_syncfs.stp25710644editdlrm
sysc_sync_file_range.stp60110644editdlrm
sysc_sysctl.stp30950644editdlrm
sysc_sysfs.stp36480644editdlrm
sysc_sysinfo.stp32860644editdlrm
sysc_syslog.stp28260644editdlrm
sysc_tee.stp27430644editdlrm
sysc_tgkill.stp28830644editdlrm
sysc_time.stp35050644editdlrm
sysc_timerfd.stp18290644editdlrm
sysc_timerfd_create.stp33940644editdlrm
sysc_timerfd_gettime.stp42190644editdlrm
sysc_timerfd_settime.stp52820644editdlrm
sysc_timer_create.stp49750644editdlrm
sysc_timer_delete.stp29420644editdlrm
sysc_timer_getoverrun.stp32070644editdlrm
sysc_timer_gettime.stp46700644editdlrm
sysc_timer_settime.stp60750644editdlrm
sysc_times.stp31670644editdlrm
sysc_tkill.stp26950644editdlrm
sysc_truncate.stp70310644editdlrm
sysc_tux.stp10680644editdlrm
sysc_umask.stp25220644editdlrm
sysc_umount.stp53600644editdlrm
sysc_uname.stp51450644editdlrm
sysc_unlink.stp28660644editdlrm
sysc_unlinkat.stp33800644editdlrm
sysc_unshare.stp28140644editdlrm
sysc_uselib.stp28710644editdlrm
sysc_userfaultfd.stp30050644editdlrm
sysc_ustat.stp53330644editdlrm
sysc_utime.stp61730644editdlrm
sysc_utimensat.stp70440644editdlrm
sysc_utimes.stp63310644editdlrm
sysc_vfork.stp20290644editdlrm
sysc_vhangup.stp21280644editdlrm
sysc_vmsplice.stp63370644editdlrm
sysc_wait4.stp50970644editdlrm
sysc_waitid.stp42530644editdlrm
sysc_waitpid.stp34600644editdlrm
sysc_write.stp39390644editdlrm
sysc_writev.stp36560644editdlrm
target_set.stp17690644editdlrm
task.stp228800644editdlrm
task.stpm2530644editdlrm
task_ancestry.stp16210644editdlrm
task_time.stp78610644editdlrm
tcp.stp226420644editdlrm
tcpmib-filter-default.stp8850644editdlrm
tcpmib.stp108240644editdlrm
timestamp.stp17610644editdlrm
timestamp_gtod.stp16290644editdlrm
timestamp_monotonic.stp55890644editdlrm
tty.stp73510644editdlrm
tzinfo.stp8030644editdlrm
ucontext-symbols.stp88420644editdlrm
ucontext-unwind.stp76450644editdlrm
ucontext.stp22370644editdlrm
udp.stp60970644editdlrm
utrace.stp13630644editdlrm
vfs.stp338260644editdlrm
Edit: /usr/share/systemtap/tapset/linux/socket.stp (35024B)
// Socket tapset // Copyright (C) 2006 IBM Corp. // Copyright (C) 2010-2017 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General // Public License (GPL); either version 2, or (at your option) any // later version. // // This family of probe points is used to probe socket activities. // %{ #include #include %} ################### # INTERNAL MACROS # ################### // Note that since these macros are defined in this file, they are // local to this file. They are internal only. // // Note the '&@sock[0]' usage below. This allows calling the macros // with either a dwarf variable (like '$sock') or casts (like // '@cast(_sock, "socket", "kernel") without needing additional casts // inside the macros (which would then lose type information when // called with a dwarf variable). // Return whether the operation was successful. @define _sock_success_check(ret) %( ( @ret >= 0 ? 1 : 0 ) %) // Return the socket protocol number. @define _sock_prot_num(sock) %( ( &@sock[0] ? ( @sock->sk ? @sock->sk->sk_protocol : -1 ) : -1 ) %) // Return the socket family number. @define _sock_fam_num(sock) %( ( &@sock[0] ? ( @sock->ops ? @sock->ops->family : -1 ) : -1 ) %) // Return the socket state number. @define _sock_state_num(sock) %( ( &@sock[0] ? @sock->state : -1 ) %) // Return the socket type number. @define _sock_type_num(sock) %( ( &@sock[0] ? @sock->type : -1 ) %) // Return the socket flags number. @define _sock_flags_num(sock) %( ( &@sock[0] ? @sock->flags : -1 ) %) // A macro that acts just like the kernel's iov_iter_count() (which is // an inlined function in include/linux/uio.h). @define iov_iter_count(i) %( ( @i->count ) %) // A macro that acts just like the kernel's msg_data_left() (which is // an inlined function in include/linux/socket.h). @define msg_data_left(msg) %( ( @iov_iter_count(@msg->msg_iter) ) %) ################# # PROBE ALIASES # ################# ### GENERAL SEND/RECEIVE PROBES ### /** * probe socket.send - Message sent on a socket. * @name: Name of this probe * @size: Size of message sent (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was send successful? (1 = yes, 0 = no) * * Context: * The message sender */ probe socket.send = socket.sendmsg.return, socket.writev.return ?, socket.aio_write.return ?, socket.write_iter.return ? { name = "socket.send" } /** * probe socket.receive - Message received on a socket. * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was send successful? (1 = yes, 0 = no) * * Context: * The message receiver */ probe socket.receive = socket.recvmsg.return, socket.readv.return ?, socket.aio_read.return ?, socket.read_iter.return ? { name = "socket.receive" } ### FUNCTION SPECIFIC SEND/RECEIVE PROBES ### /** * probe socket.sendmsg - Message is currently being sent on a socket. * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of sending a message on a socket * via the sock_sendmsg() function */ // // 4.1-rc1: // int sock_sendmsg(struct socket *sock, struct msghdr *msg); // before 4.1-rc1: // int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); // probe socket.sendmsg = kernel.function ("sock_sendmsg") { name = "socket.sendmsg" size = @choose_defined($size, @msg_data_left($msg)) protocol = @_sock_prot_num($sock) family = @_sock_fam_num($sock) state = @_sock_state_num($sock) flags = @_sock_flags_num($sock) type = @_sock_type_num($sock) } /** * probe socket.sendmsg.return - Return from socket.sendmsg. * @name: Name of this probe * @size: Size of message sent (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was send successful? (1 = yes, 0 = no) * * Context: * The message sender. * * Fires at the conclusion of sending a message on a socket * via the sock_sendmsg() function */ probe socket.sendmsg.return = kernel.function("sock_sendmsg").return { name = "socket.sendmsg.return" size = $return protocol = @entry(@_sock_prot_num($sock)) family = @entry(@_sock_fam_num($sock)) state = @entry(@_sock_state_num($sock)) flags = @entry(@_sock_flags_num($sock)) type = @entry(@_sock_type_num($sock)) success = @_sock_success_check($return) } /** * probe socket.recvmsg - Message being received on socket * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message receiver. * * Fires at the beginning of receiving a message on a socket * via the sock_recvmsg() function * */ probe socket.recvmsg = kernel.function("sock_recvmsg") { name = "socket.recvmsg" size = @choose_defined($size, @msg_data_left($msg)) protocol = @_sock_prot_num($sock) family = @_sock_fam_num($sock) state = @_sock_state_num($sock) flags = @_sock_flags_num($sock) type = @_sock_type_num($sock) } /** * probe socket.recvmsg.return - Return from Message being received on socket * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of receiving a message on a socket * via the sock_recvmsg() function. * * */ probe socket.recvmsg.return = kernel.function("sock_recvmsg").return { name = "socket.recvmsg.return" size = $return protocol = @entry(@_sock_prot_num($sock)) family = @entry(@_sock_fam_num($sock)) state = @entry(@_sock_state_num($sock)) flags = @entry(@_sock_flags_num($sock)) type = @entry(@_sock_type_num($sock)) success = @_sock_success_check($return) } /** * probe socket.aio_write - Message send via sock_aio_write() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of sending a message on a socket * via the sock_aio_write() function */ // // 2.6.9~2.6.15: // static ssize_t sock_aio_write(struct kiocb *iocb, // const char __user *ubuf, size_t size, loff_t pos); // 2.6.16~2.6.18: // static ssize_t sock_aio_write(struct kiocb *iocb, // const char __user *ubuf, size_t count, loff_t pos); // 2.6.19~2.6.26: // static ssize_t sock_aio_write(struct kiocb *iocb, // const struct iovec *iov, unsigned long nr_segs, loff_t pos); // 4.0: // sock_aio_write() was removed in kernel 4.0 in favor of // sock_write_iter(). probe socket.aio_write = kernel.function("sock_aio_write") ? { name = "socket.aio_write" _sock = _get_sock_addr($iocb->ki_filp) size = (@defined($iov) ? _get_sock_size($iov, $nr_segs) : @choose_defined($count, $size)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.aio_write.return - Conclusion of message send via sock_aio_write() * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of sending a message on a socket * via the sock_aio_write() function */ probe socket.aio_write.return = kernel.function("sock_aio_write").return ? { name = "socket.aio_write.return" size = $return _sock = _get_sock_addr(@entry($iocb->ki_filp)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.aio_read - Receiving message via sock_aio_read() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of receiving a message on a socket * via the sock_aio_read() function */ // // 2.6.9~2.6.15: // static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, // size_t size, loff_t pos); // 2.6.16~2.6.18: // static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, // size_t count, loff_t pos); // 2.6.19~2.6.26: // static ssize_t sock_aio_read(struct kiocb *iocb, // const struct iovec *iov, unsigned long nr_segs, loff_t pos); // 4.0: // sock_aio_read() was removed in kernel 4.0 in favor of // sock_read_iter(). probe socket.aio_read = kernel.function("sock_aio_read") ? { name = "socket.aio_read" _sock = _get_sock_addr($iocb->ki_filp) size = (@defined($iov) ? _get_sock_size($iov, $nr_segs) : @choose_defined($count, $size)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.aio_read.return - Conclusion of message received via sock_aio_read() * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of receiving a message on a socket * via the sock_aio_read() function */ probe socket.aio_read.return = kernel.function("sock_aio_read").return ? { name = "socket.aio_read.return" size = $return _sock = _get_sock_addr(@entry($iocb->ki_filp)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.write_iter - Message send via sock_write_iter() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of sending a message on a socket * via the sock_write_iter() function */ // // 4.0: // static ssize_t sock_write_iter(struct kiocb *iocb, // struct iov_iter *from); probe socket.write_iter = kernel.function("sock_write_iter") ? { name = "socket.write_iter" _sock = _get_sock_addr($iocb->ki_filp) if ($from->type & @const("ITER_IOVEC")) size = __iov_length($from->iov, $from->nr_segs, 1, @const("VERIFY_READ")) else size = 0 protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.write_iter.return - Conclusion of message send via sock_write_iter() * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of sending a message on a socket * via the sock_write_iter() function */ probe socket.write_iter.return = kernel.function("sock_write_iter").return ? { name = "socket.write_iter.return" size = $return _sock = _get_sock_addr(@entry($iocb->ki_filp)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.read_iter - Receiving message via sock_read_iter() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of receiving a message on a socket * via the sock_read_iter() function */ // // 4.0: // static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to); probe socket.read_iter = kernel.function("sock_read_iter") ? { name = "socket.read_iter" _sock = _get_sock_addr($iocb->ki_filp) if ($to->type & @const("ITER_IOVEC")) size = __iov_length($to->iov, $to->nr_segs, 1, @const("VERIFY_WRITE")) else size = 0 protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.read_iter.return - Conclusion of message received via sock_read_iter() * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of receiving a message on a socket * via the sock_read_iter() function */ probe socket.read_iter.return = kernel.function("sock_read_iter").return ? { name = "socket.read_iter.return" size = $return _sock = _get_sock_addr(@entry($iocb->ki_filp)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.writev - Message sent via socket_writev() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of sending a message on a socket * via the sock_writev() function */ probe socket.writev = kernel.function("sock_writev") ? { name = "socket.writev" _sock = _get_sock_addr($file) size = (@defined($iov) ? _get_sock_size($iov, $nr_segs) : _get_sock_size($vector, $count)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.writev.return - Conclusion of message sent via socket_writev() * @name: Name of this probe * @size: Size of message sent (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was send successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of sending a message on a socket * via the sock_writev() function */ probe socket.writev.return = kernel.function("sock_writev").return ? { name = "socket.writev.return" size = $return _sock = _get_sock_addr(@entry($file)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.readv - Receiving a message via sock_readv() * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The message sender * * Fires at the beginning of receiving a message on a socket * via the sock_readv() function */ probe socket.readv = kernel.function("sock_readv") ? { name = "socket.readv" _sock = _get_sock_addr($file) size = (@defined($iov) ? _get_sock_size($iov, $nr_segs) : _get_sock_size($vector, $count)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) } /** * probe socket.readv.return - Conclusion of receiving a message via sock_readv() * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * @success: Was receive successful? (1 = yes, 0 = no) * * Context: * The message receiver. * * Fires at the conclusion of receiving a message on a socket * via the sock_readv() function */ probe socket.readv.return = kernel.function("sock_readv").return ? { name = "socket.readv.return" size = $return _sock = _get_sock_addr(@entry($file)) protocol = @_sock_prot_num(@cast(_sock, "socket", "kernel")) family = @_sock_fam_num(@cast(_sock, "socket", "kernel")) state = @_sock_state_num(@cast(_sock, "socket", "kernel")) flags = @_sock_flags_num(@cast(_sock, "socket", "kernel")) type = @_sock_type_num(@cast(_sock, "socket", "kernel")) success = @_sock_success_check($return) } /** * probe socket.create - Creation of a socket * @name: Name of this probe * @protocol: Protocol value * @family: Protocol family value * @type: Socket type value * @requester: Requested by user process or the kernel (1 = kernel, 0 = user) * * Context: * The requester (see requester variable) * * Fires at the beginning of creating a socket. */ probe socket.create = kernel.function("__sock_create") { name = "socket.create" protocol = $protocol family = $family type = $type requester = $kern } /** * probe socket.create.return - Return from Creation of a socket * @name: Name of this probe * @protocol: Protocol value * @family: Protocol family value * @type: Socket type value * @requester: Requested by user process or the kernel (1 = kernel, 0 = user) * @err: Error code if success == 0 * @success: Was socket creation successful? (1 = yes, 0 = no) * * Context: * The requester (user process or kernel) * * Fires at the conclusion of creating a socket. */ probe socket.create.return = kernel.function("__sock_create").return { name = "socket.create.return" protocol = @entry($protocol) family = @entry($family) type = @entry($type) requester = @entry($kern) err = $return success = @_sock_success_check($return) } /** * probe socket.close - Close a socket * @name: Name of this probe * @protocol: Protocol value * @family: Protocol family value * @state: Socket state value * @flags: Socket flags value * @type: Socket type value * * Context: * The requester (user process or kernel) * * Fires at the beginning of closing a socket. */ probe socket.close = kernel.function("sock_release") { name = "socket.close" protocol = @_sock_prot_num($sock) family = @_sock_fam_num($sock) state = @_sock_state_num($sock) flags = @_sock_flags_num($sock) type = @_sock_type_num($sock) } /** * probe socket.close.return - Return from closing a socket * @name: Name of this probe * * Context: * The requester (user process or kernel) * * Fires at the conclusion of closing a socket. */ probe socket.close.return = kernel.function("sock_release").return { name = "socket.close.return" /* void return */ } ################## # USER FUNCTIONS # ################## ####### PROTOCOL HELPER FUNCTIONS ######## /** * sfunction sock_prot_num2str - Given a protocol number, return a string representation * @proto: The protocol number */ function sock_prot_num2str:string(proto:long) { return (proto in _prot_num2str ? _prot_num2str[proto] : "UNDEF") } /** * sfunction sock_prot_str2num - Given a protocol name (string), return the corresponding protocol number * @proto: The protocol name */ function sock_prot_str2num:long(proto:string) { return (proto in _prot_str2num ? _prot_str2num[proto] : -1) } ######### PROTOCOL FAMILY HELPER FUNCTIONS ########### /** * sfunction sock_fam_num2str - Given a protocol family number, return a string representation * @family: The family number */ function sock_fam_num2str:string(family:long) { return (family in _fam_num2str ? _fam_num2str[family] : "UNDEF") } /** * sfunction sock_fam_str2num - Given a protocol family name (string), return the corresponding protocol family number * @family: The family name */ function sock_fam_str2num:long(family:string) { return (family in _fam_str2num ? _fam_str2num[family] : -1) } ######### SOCKET STATE HELPER FUNCTIONS ########## /** * sfunction sock_state_num2str - Given a socket state number, return a string representation * @state: The state number */ function sock_state_num2str:string(state:long) { return (state in _state_num2str ? _state_num2str[state] : "UNDEF") } /** * sfunction sock_state_str2num - Given a socket state string, return the corresponding state number * @state: The state name */ function sock_state_str2num:long(state:string) { return (state in _state_str2num ? _state_str2num[state] : -1) } ######## SOCKET TYPE HELPER FUNCTIONS ######## function sock_type_num2str:string(type:long) { return (type in _type_num2str ? _type_num2str[type] : "UNDEF") } function sock_type_str2num:long(type:string) { return (type in _type_str2num ? _type_str2num[type] : -1) } ######### SOCKET FLAGS HELPER FUNCTIONS ######### function sock_flags_num2str:string(flags:long) %{ /* pure */ #ifndef SOCK_PASSCRED #define SOCK_PASSCRED 3 /* introduced in 2.6.12? */ #endif #ifndef SOCK_PASSSEC #define SOCK_PASSSEC 4 /* introduced in 2.6.18 */ #endif #ifndef SOCKWQ_ASYNC_NOSPACE /* renamed in 4.4 */ #define SOCKWQ_ASYNC_NOSPACE SOCK_ASYNC_NOSPACE #endif #ifndef SOCKWQ_ASYNC_WAITDATA /* renamed in 4.4 */ #define SOCKWQ_ASYNC_WAITDATA SOCK_ASYNC_WAITDATA #endif unsigned long flags = STAP_ARG_flags; STAP_RETVALUE[0] = '\0'; if (test_bit(SOCKWQ_ASYNC_NOSPACE, &flags)) strlcat(STAP_RETVALUE, "ASYNC_NOSPACE|", MAXSTRINGLEN); if (test_bit(SOCKWQ_ASYNC_WAITDATA, &flags)) strlcat(STAP_RETVALUE, "ASYNC_WAITDATA|", MAXSTRINGLEN); if (test_bit(SOCK_NOSPACE, &flags)) strlcat(STAP_RETVALUE, "NOSPACE|", MAXSTRINGLEN); if (test_bit(SOCK_PASSCRED, &flags)) strlcat(STAP_RETVALUE, "PASSCRED|", MAXSTRINGLEN); if (test_bit(SOCK_PASSSEC, &flags)) strlcat(STAP_RETVALUE, "PASSSEC|", MAXSTRINGLEN); if (STAP_RETVALUE[0] != '\0') STAP_RETVALUE[strlen(STAP_RETVALUE)-1] = '\0'; %} ######### MESSAGE FLAGS HELPER FUNCTIONS ######### function msg_flags_num2str:string(flags:long) %{ /* pure */ STAP_RETVALUE[0] = '\0'; if (STAP_ARG_flags & MSG_OOB) strlcat(STAP_RETVALUE, "OOB|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_PEEK) strlcat(STAP_RETVALUE, "PEEK|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_DONTROUTE) strlcat(STAP_RETVALUE, "DONTROUTE|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_TRYHARD) strlcat(STAP_RETVALUE, "TRYHARD|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_CTRUNC) strlcat(STAP_RETVALUE, "CTRUNC|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_PROBE) strlcat(STAP_RETVALUE, "PROBE|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_TRUNC) strlcat(STAP_RETVALUE, "TRUNC|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_DONTWAIT) strlcat(STAP_RETVALUE, "DONTWAIT|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_EOR) strlcat(STAP_RETVALUE, "EOR|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_WAITALL) strlcat(STAP_RETVALUE, "WAITALL|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_FIN) strlcat(STAP_RETVALUE, "FIN|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_SYN) strlcat(STAP_RETVALUE, "SYN|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_CONFIRM) strlcat(STAP_RETVALUE, "CONFIRM|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_RST) strlcat(STAP_RETVALUE, "RST|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_ERRQUEUE) strlcat(STAP_RETVALUE, "ERRQUEUE|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_NOSIGNAL) strlcat(STAP_RETVALUE, "NOSIGNAL|", MAXSTRINGLEN); if (STAP_ARG_flags & MSG_MORE) strlcat(STAP_RETVALUE, "MORE|", MAXSTRINGLEN); if (STAP_RETVALUE[0] != '\0') STAP_RETVALUE[strlen(STAP_RETVALUE)-1] = '\0'; %} ########################### # INTERNAL MAPPING ARRAYS # ########################### @__private30 global _prot_num2str[138], _prot_str2num[138] @__private30 global _fam_num2str[34], _fam_str2num[34] @__private30 global _state_num2str[5], _state_str2num[5] @__private30 global _type_num2str[11], _type_str2num[11] probe init { /* From /etc/protocols. * Many of these protocols aren't currently used over * sockets, but are included for completeness */ _prot_num2str[0] = "IP" _prot_num2str[1] = "ICMP" _prot_num2str[2] = "IGMP" _prot_num2str[3] = "GGP" _prot_num2str[4] = "IPENCAP" _prot_num2str[5] = "ST" _prot_num2str[6] = "TCP" _prot_num2str[7] = "CBT" _prot_num2str[8] = "EGP" _prot_num2str[9] = "IGP" _prot_num2str[10] = "BBN-RCC" _prot_num2str[11] = "NVP" _prot_num2str[12] = "PUP" _prot_num2str[13] = "ARGUS" _prot_num2str[14] = "EMCON" _prot_num2str[15] = "XNET" _prot_num2str[16] = "CHAOS" _prot_num2str[17] = "UDP" _prot_num2str[18] = "MUX" _prot_num2str[19] = "DCN" _prot_num2str[20] = "HMP" _prot_num2str[21] = "PRM" _prot_num2str[22] = "XNS-IDP" _prot_num2str[23] = "TRUNK-1" _prot_num2str[24] = "TRUNK-2" _prot_num2str[25] = "LEAF-1" _prot_num2str[26] = "LEAF-2" _prot_num2str[27] = "RDP" _prot_num2str[28] = "IRTP" _prot_num2str[29] = "ISO-TP4" _prot_num2str[30] = "NETBLT" _prot_num2str[31] = "MFE-NSP" _prot_num2str[32] = "MERIT-INP" _prot_num2str[33] = "SEP" _prot_num2str[34] = "3PC" _prot_num2str[35] = "IDPR" _prot_num2str[36] = "XTP" _prot_num2str[37] = "DDP" _prot_num2str[38] = "IDPR-CMTP" _prot_num2str[39] = "TP++" _prot_num2str[40] = "IL" _prot_num2str[41] = "IPV6" _prot_num2str[42] = "SDRP" _prot_num2str[43] = "IPV6-ROUTE" _prot_num2str[44] = "IPV6-FRAG" _prot_num2str[45] = "IDRP" _prot_num2str[46] = "RSVP" _prot_num2str[47] = "GRE" _prot_num2str[48] = "MHRP" _prot_num2str[49] = "BNA" _prot_num2str[50] = "IPV6-CRYPT" _prot_num2str[51] = "IPV6-AUTH" _prot_num2str[52] = "I-NLSP" _prot_num2str[53] = "SWIPE" _prot_num2str[54] = "NARP" _prot_num2str[55] = "MOBILE" _prot_num2str[56] = "TLSP" _prot_num2str[57] = "SKIP" _prot_num2str[58] = "IPV6-ICMP" _prot_num2str[59] = "IPV6-NONXT" _prot_num2str[60] = "IPV6-OPTS" _prot_num2str[62] = "CFTP" _prot_num2str[64] = "SAT-EXPAK" _prot_num2str[65] = "KRYPTOLAN" _prot_num2str[66] = "RVD" _prot_num2str[67] = "IPPC" _prot_num2str[69] = "SAT-MON" _prot_num2str[70] = "VISA" _prot_num2str[71] = "IPCV" _prot_num2str[72] = "CPNX" _prot_num2str[73] = "CPHB" _prot_num2str[74] = "WSN" _prot_num2str[75] = "PVP" _prot_num2str[76] = "BR-SAT-MON" _prot_num2str[77] = "SUN-ND" _prot_num2str[78] = "WB-MON" _prot_num2str[79] = "WB-EXPAK" _prot_num2str[80] = "ISO-IP" _prot_num2str[81] = "VMTP" _prot_num2str[82] = "SECURE-VMTP" _prot_num2str[83] = "VINES" _prot_num2str[84] = "TTP" _prot_num2str[85] = "NSFNET-IGP" _prot_num2str[86] = "DGP" _prot_num2str[87] = "TCF" _prot_num2str[88] = "EIGRP" _prot_num2str[89] = "OSPF" _prot_num2str[90] = "SPRITE-RPC" _prot_num2str[91] = "LARP" _prot_num2str[92] = "MTP" _prot_num2str[93] = "AX.25" _prot_num2str[94] = "IPIP" _prot_num2str[95] = "MICP" _prot_num2str[96] = "SCC-SP" _prot_num2str[97] = "ETHERIP" _prot_num2str[98] = "ENCAP" _prot_num2str[100] = "GMTP" _prot_num2str[101] = "IFMP" _prot_num2str[102] = "PNNI" _prot_num2str[103] = "PIM" _prot_num2str[104] = "ARIS" _prot_num2str[105] = "SCPS" _prot_num2str[106] = "QNX" _prot_num2str[107] = "A/N" _prot_num2str[108] = "IPCOMP" _prot_num2str[109] = "SNP" _prot_num2str[110] = "COMPAQ-PEER" _prot_num2str[111] = "IPX-IN-IP" _prot_num2str[112] = "VRRP" _prot_num2str[113] = "PGM" _prot_num2str[115] = "L2TP" _prot_num2str[116] = "DDX" _prot_num2str[117] = "IATP" _prot_num2str[118] = "STP" _prot_num2str[119] = "SRP" _prot_num2str[120] = "UTI" _prot_num2str[121] = "SMP" _prot_num2str[122] = "SM" _prot_num2str[123] = "PTP" _prot_num2str[124] = "ISIS" _prot_num2str[125] = "FIRE" _prot_num2str[126] = "CRTP" _prot_num2str[127] = "CRDUP" _prot_num2str[128] = "SSCOPMCE" _prot_num2str[129] = "IPLT" _prot_num2str[130] = "SPS" _prot_num2str[131] = "PIPE" _prot_num2str[132] = "SCTP" _prot_num2str[133] = "FC" _prot_num2str[134] = "RSVP-E2E-IGNORE" _prot_num2str[135] = "Mobility-Header" _prot_num2str[136] = "UDPLite" _prot_num2str[137] = "MPLS-IN-IP" foreach (num in _prot_num2str) _prot_str2num[_prot_num2str[num]] = num /* from include/linux/socket.h */ _fam_num2str[0] = "UNSPEC" _fam_num2str[1] = "LOCAL" _fam_num2str[2] = "INET" _fam_num2str[3] = "AX25" _fam_num2str[4] = "IPX" _fam_num2str[5] = "APPLETALK" _fam_num2str[6] = "NETROM" _fam_num2str[7] = "BRIDGE" _fam_num2str[8] = "ATMPVC" _fam_num2str[9] = "X25" _fam_num2str[10] = "INET6" _fam_num2str[11] = "ROSE" _fam_num2str[12] = "DECNET" _fam_num2str[13] = "NETBEUI" _fam_num2str[14] = "SECURITY" _fam_num2str[15] = "KEY" _fam_num2str[16] = "NETLINK" _fam_num2str[17] = "PACKET" _fam_num2str[18] = "ASH" _fam_num2str[19] = "ECONET" _fam_num2str[20] = "ATMSVC" _fam_num2str[22] = "SNA" _fam_num2str[23] = "IRDA" _fam_num2str[24] = "PPPOX" _fam_num2str[25] = "WANPIPE" _fam_num2str[26] = "LLC" _fam_num2str[30] = "TIPC" _fam_num2str[31] = "BLUETOOTH" _fam_num2str[32] = "IUCV" _fam_num2str[33] = "RXRPC" foreach (num in _fam_num2str) _fam_str2num[_fam_num2str[num]] = num /* from include/linux/net.h */ _state_num2str[0] = "FREE" _state_num2str[1] = "UNCONNECTED" _state_num2str[2] = "CONNECTING" _state_num2str[3] = "CONNECTED" _state_num2str[4] = "DISCONNECTING" foreach (num in _state_num2str) _state_str2num[_state_num2str[num]] = num /* from include/linux/net.h */ _type_num2str[1] = "STREAM" _type_num2str[2] = "DGRAM" _type_num2str[3] = "RAW" _type_num2str[4] = "RDM" _type_num2str[5] = "SEQPACKET" _type_num2str[6] = "DCCP" _type_num2str[10] = "PACKET" foreach (num in _type_num2str) _type_str2num[_type_num2str[num]] = num } ###################### # INTERNAL FUNCTIONS # ###################### @__private30 function _get_sock_addr:long(file:long) %{ /* pure */ struct file *filep = (struct file *)(uintptr_t)(STAP_ARG_file); struct socket *sockp; if (filep) { #ifdef STAPCONF_DPATH_PATH struct dentry *dentry = kread(&(filep->f_path.dentry)); #else struct dentry *dentry = kread(&(filep->f_dentry)); #endif struct inode *inode = kread(&(dentry->d_inode)); sockp = &container_of(inode, struct socket_alloc, vfs_inode)->socket; } else { sockp = NULL; } if (sockp == NULL) STAP_RETVALUE = -1; else STAP_RETVALUE = (long) sockp; CATCH_DEREF_FAULT(); %} @__private30 function _get_sock_size:long(iov:long, nr_segs:long) %{ /* pure */ struct iovec *iovp = (struct iovec *)(uintptr_t)(STAP_ARG_iov); if (iovp == NULL) STAP_RETVALUE = -1; else { int i; STAP_RETVALUE = 0; for (i = 0 ; i < STAP_ARG_nr_segs ; i++) STAP_RETVALUE += kread(&(iovp[i].iov_len)); } CATCH_DEREF_FAULT(); %} %( systemtap_v < "2.3" %? function _success_check:long(ret:long) { return @_sock_success_check(ret) } function _sock_prot_num:long(sock:long) { return @_sock_prot_num(@cast(sock, "socket", "kernel")) } function _sock_fam_num:long(sock:long) { return @_sock_fam_num(@cast(sock, "socket", "kernel")) } function _sock_state_num:long(sock:long) { return @_sock_state_num(@cast(sock, "socket", "kernel")) } function _sock_type_num:long(sock:long) { return @_sock_type_num(@cast(sock, "socket", "kernel")) } function _sock_flags_num:long(sock:long) { return @_sock_flags_num(@cast(sock, "socket", "kernel")) } %)