Skip to content
Hadi Moshayedi edited this page Sep 13, 2024 · 8 revisions

Observing unix domain sockets

# netstat -a | grep -E "vhost|spdk"
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     319842   /var/storage/vhost/vm57hq88_0
unix  2      [ ACC ]     SEQPACKET  LISTENING     13840    /home/spdk/dpdk/spdk_pid1890/dpdk_telemetry.v2
unix  2      [ ACC ]     STREAM     LISTENING     13853    /home/spdk/spdk-v23.09-ubi-0.2.sock
unix  2      [ ACC ]     STREAM     LISTENING     226082   /var/storage/vhost/vm7s9ycb_0

From man netstat:

RefCnt
       The reference count (i.e. attached processes via this socket).
# sudo lsof /home/spdk/spdk-v23.09-ubi-0.2.sock
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF  NODE NAME
reactor_0 1890 spdk   37u  unix 0xff4715464cc69100      0t0 13853 /home/spdk/spdk-v23.09-ubi-0.2.sock type=STREAM

# sudo lsof /var/storage/vhost/vm7s9ycb_0
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF   NODE NAME
reactor_0 1890 spdk   42u  unix 0xff4715464cc69980      0t0 226082 /var/storage/vhost/vm7s9ycb_0 type=STREAM
# lsof +E -aUc cloud
COMMAND    PID     USER   FD   TYPE             DEVICE SIZE/OFF   NODE NAME
systemd      1     root  111u  unix 0xff47154630bbb740      0t0 159958 /run/systemd/journal/stdout type=STREAM ->INO=29839 2814,cloud-hyp,2u 2814,cloud-hyp,1u
systemd-j 1486     root   37u  unix 0xff47154630bbb740      0t0 159958 /run/systemd/journal/stdout type=STREAM ->INO=29839 2814,cloud-hyp,2u 2814,cloud-hyp,1u
cloud-hyp 2814 vm7s9ycb    1u  unix 0xff47154630bbd940      0t0  29839 type=STREAM ->INO=159958 1486,systemd-j,37u 1,systemd,111u
cloud-hyp 2814 vm7s9ycb    2u  unix 0xff47154630bbd940      0t0  29839 type=STREAM ->INO=159958 1486,systemd-j,37u 1,systemd,111u
# pstree 2814 --thread-names --show-pids
cloud-hyperviso(2814)─┬─{__rng}(2900)
                      ├─{_disk0}(2904)
                      ├─{_disk1_q0}(2905)
                      ├─{_net2_ctrl}(2901)
                      ├─{_net2_qp0}(2902)
                      ├─{_net2_qp1}(2903)
                      ├─{http-server}(2816)
                      ├─{iou-wrk-2905}(3040)
                      ├─{vcpu0}(2869)
                      ├─{vcpu1}(2870)
                      ├─{vmm_signal_hand}(2817)
                      └─{vmm}(2815)
# ss -xp
Netid State Recv-Q Send-Q                Local Address:Port   Peer Address:Port  Process
u_str ESTAB 0      0                                 * 29839             * 159958 users:(("cloud-hyperviso",pid=2814,fd=2),("cloud-hyperviso",pid=2814,fd=1))
# ps -fp $(pgrep -u vm7s9ycb)
UID          PID    PPID  C STIME TTY      STAT   TIME CMD
vm7s9ycb    2812       1  0 03:50 ?        Ss     0:00 /usr/local/sbin/dnsmasq -k -h -C /vm/vm7s9ycb/dnsmasq.conf --log-debug -i ncee061nca --user=vm7s9ycb --group=vm7s9ycb
vm7s9ycb    2814       1  0 03:50 ?        Ssl    0:20 /opt/cloud-hypervisor/v35.1/cloud-hypervisor -v --api-socket path=/vm/vm7s9ycb/ch-api.sock --kernel /opt/fw/CLOUDHV-202311.fd --disk vhost_user=true,socket=/var/storage/vm7s9ycb/0/vhost.sock,num_qu

Clone this wiki locally