SIGUSR1 for real-time stats.
tcpstat: tcpstat.c
gcc -Wall \
- -D__WITH_THREADS__ \
tcpstat.c \
- -lpcap -lpthread \
+ -lpcap \
-o tcpstat
tcpstat_dbg: tcpstat.c
gcc -Wall -ggdb -O0 -D__DEBUG__ \
- -D__WITH_THREADS__ \
tcpstat.c \
- -lpcap -lpthread \
+ -lpcap \
-o tcpstat_dbg
tcpstat_noether: tcpstat.c
gcc -Wall \
- -D__WITH_THREADS__ -D__NO_ETHERNET__ \
+ -D__NO_ETHERNET__ \
tcpstat.c \
- -lpcap -lpthread \
+ -lpcap \
-o tcpstat_noether
tcpstat_noether_dbg: tcpstat.c
gcc -Wall -ggdb -O0 -D__DEBUG__ \
- -D__WITH_THREADS__ -D__NO_ETHERNET__ \
+ -D__NO_ETHERNET__ \
tcpstat.c \
- -lpcap -lpthread \
+ -lpcap \
-o tcpstat_noether_dbg
# All packets processed will be written to file ./tun0.pcap
sudo ./tcpstat_noether_dbg -i tun0
+# Signals: receipt of SIGUSR1 will print current packet counts to stdout
+sudo pkill --signal SIGUSR1 -x tcpstat