An example output:
# ./lsfd -Q 'TYPE == "UNIX" && SOCK.TYPE == "dgram"' \
-oCOMMAND,PID,TYPE,INODE,UNIX.IPEER,NAME | head
COMMAND PID TYPE INODE UNIX.IPEER NAME
systemd 1 UNIX 3239 13482 state=connected type=dgram
systemd 1 UNIX
1649064 1649065 state=connected type=dgram
systemd 1 UNIX
1649065 1649064 state=connected type=dgram
systemd 1 UNIX 13465 0 state=connected path=/run/systemd/notify type=dgram
...
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
UID <``number``>::
User ID number.
+UNIX.IPEER < number >::
+Inode number for the peer of the UNIX domain socket.
++
+If *lsfd* runs in a container, it may not fill _UNIX.IPEER_ column.
+See the description of _UNIX_ in _ENDPOINTS_ column for more details.
+
UNIX.PATH <``string``>::
Filesystem pathname for UNIX domain socket.
[COL_UID] = { "UID",
0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
N_("user ID number of the process") },
+ [COL_UNIX_IPEER] = { "UNIX.IPEER",
+ 0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
+ N_("inode number for the peer of the UNIX domain socket") },
[COL_UNIX_PATH] = { "UNIX.PATH",
0.4, SCOLS_FL_TRUNC, SCOLS_JSON_STRING,
N_("filesystem pathname for UNIX domain socket") },
COL_UDPLITE_LPORT,
COL_UDPLITE_RPORT,
COL_UID, /* process */
+ COL_UNIX_IPEER,
COL_UNIX_PATH,
COL_USER, /* process */
COL_VSOCK_LADDR,
return true;
}
break;
+ case COL_UNIX_IPEER:
+ if (ux->unix_ipc) {
+ xasprintf(str, "%llu", (unsigned long long)ux->unix_ipc->ipeer);
+ return true;
+ }
+ break;
case COL_ENDPOINTS:
if (ux->unix_ipc == NULL)
break;
--- /dev/null
+inode_s: 0
+inode_c: 0
+ipeer_s: 0
+ipeer_c: 0
+ipeer_s == 0: 0
+ipeer_s == inode_s: 0
ts_finalize_subtest
fi
+ts_init_subtest "UNIX.IPEEER-column"
+if ts_is_in_docker; then
+ ts_skip_subtest "unsupported in docker environment"
+else
+ {
+ coproc MKFDS { "$TS_HELPER_MKFDS" unix-dgram $FDS $FDC \
+ path=test_mkfds-unix-dgram \
+ abstract=true ; }
+
+ if read -r -u "${MKFDS[0]}" PID; then
+ inode_s=$(${TS_CMD_LSFD} -n -r -p "${PID}" -Q "FD == $FDS" -o INODE)
+ echo inode_s: $?
+ inode_c=$(${TS_CMD_LSFD} -n -r -p "${PID}" -Q "FD == $FDC" -o INODE)
+ echo inode_c: $?
+
+ ipeer_s=$(${TS_CMD_LSFD} -n -r -p "${PID}" -Q "FD == $FDS" -o UNIX.IPEER)
+ echo ipeer_s: $?
+
+ ipeer_c=$(${TS_CMD_LSFD} -n -r -p "${PID}" -Q "FD == $FDC" -o UNIX.IPEER)
+ echo ipeer_c: $?
+
+ test "$ipeer_s" = 0
+ echo "ipeer_s == 0:" $?
+
+ test "$ipeer_c" = "$inode_s"
+ echo "ipeer_s == inode_s:" $?
+
+ echo DONE >&"${MKFDS[1]}"
+ fi
+ wait "${MKFDS_PID}"
+ } > "$TS_OUTPUT" 2>&1
+ ts_finalize_subtest
+fi
+
ts_finalize