]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: <breaking comaptiblity> move PROTONAME column to SOCK. column namespace
authorMasatake YAMATO <yamato@redhat.com>
Sat, 1 Oct 2022 21:16:29 +0000 (06:16 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Mon, 3 Oct 2022 12:52:17 +0000 (21:52 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-sock.c
misc-utils/lsfd.1.adoc
misc-utils/lsfd.c
misc-utils/lsfd.h
tests/expected/lsfd/mkfds-mapped-packet-socket
tests/expected/lsfd/mkfds-socketpair
tests/ts/lsfd/mkfds-mapped-packet-socket
tests/ts/lsfd/mkfds-socketpair

index ff2f179b0043f622f59c76d6b57d89d222d3a0ad..e99e2350891d990f11daa15edf1b1c1476f75347 100644 (file)
@@ -48,7 +48,7 @@ static bool sock_fill_column(struct proc *proc __attribute__((__unused__)),
                if (!sock->protoname)
                        return false;
                /* FALL THROUGH */
-       case COL_PROTONAME:
+       case COL_SOCK_PROTONAME:
                if (sock->protoname)
                        if (scols_line_set_data(ln, column_index, sock->protoname))
                                err(EXIT_FAILURE, _("failed to add output data"));
index f095f4b5f5164d446ac519f92f523fbbaf06340f..c5e6f056235567ab6cce84a5cc46960d58564f37 100644 (file)
@@ -254,9 +254,6 @@ PID of the process targeted by the pidfd.
 POS <``number``>::
 File position.
 
-PROTONAME <``string``>::
-Protocol name.
-
 RDEV <``string``>::
 Device ID (if special file).
 
@@ -269,6 +266,9 @@ Listening socket.
 SOCK.NETS <``number``>::
 Inode identifying network namespace where the socket belogs to.
 
+SOCK.PROTONAME <``string``>::
+Protocol name.
+
 SOCK.STATE <``string``>::
 State of socket.
 
@@ -307,7 +307,7 @@ Thread ID of the process opening the file.
 
 TYPE <``string``>::
 Cooked version of STTYPE. It is same as STTYPE with exceptions.
-For SOCK, print the value for PROTONAME.
+For SOCK, print the value for SOCK.PROTONAME.
 For UNKN, print the value for AINODECLASS if SOURCE is anon_inodefs.
 
 UID <``number``>::
index 2f94072372d2fea3ec8ba028ad09b9cb197eccc8..b109c1a9f3dae2b7ee0fe68f6d591e7186844b87 100644 (file)
@@ -183,8 +183,6 @@ static struct colinfo infos[] = {
                N_("PID of the process targeted by the pidfd") },
        [COL_POS]     = { "POS",      5, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
                N_("file position") },
-       [COL_PROTONAME]={ "PROTONAME",0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
-               N_("protocol name") },
        [COL_RDEV]    = { "RDEV",     0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
                N_("device ID (if special file)") },
        [COL_SIZE]    = { "SIZE",     4, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
@@ -193,6 +191,8 @@ static struct colinfo infos[] = {
                N_("listening socket") },
        [COL_SOCK_NETNS]={"SOCK.NETNS", 0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
                N_("inode identifying network namespace where the socket belongs to") },
+       [COL_SOCK_PROTONAME]={"SOCK.PROTONAME",0,SCOLS_FL_RIGHT,SCOLS_JSON_STRING,
+               N_("protocol name") },
        [COL_SOCK_STATE]={"SOCK.STATE", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
                N_("State of socket") },
        [COL_SOCK_TYPE] ={"SOCK.TYPE",  0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
index 83dea34c76238872f29929b00de1b88712fcfdc0..3c15cbf99cac7ab59bedb36a7b252e3a3f154cdc 100644 (file)
@@ -66,11 +66,11 @@ enum {
        COL_PIDFD_NSPID,
        COL_PIDFD_PID,
        COL_POS,
-       COL_PROTONAME,
        COL_RDEV,
        COL_SIZE,
        COL_SOCK_LISTENING,
        COL_SOCK_NETNS,
+       COL_SOCK_PROTONAME,
        COL_SOCK_STATE,
        COL_SOCK_TYPE,
        COL_SOURCE,
index 43c99015ce9b13d8dc844501e38b62e2381545dd..59bc863b95e17e722280b1b0e225f983e1b6e40f 100644 (file)
@@ -1,2 +1,2 @@
-   PACKET
-PROTONAME: 0
+        PACKET
+SOCK.PROTONAME: 0
index 48b4ca24e01fe0e673a25f254bd6003319307835..a015353996a7e7661afa9cbc0d7a450174e1d298 100644 (file)
@@ -1,3 +1,3 @@
-    3  rw-   SOCK sockfs      UNIX
-    4  rw-   SOCK sockfs      UNIX
-ASSOC,MODE,STTYPE,SOURCE,PROTONAME: 0
+    3  rw-   SOCK sockfs           UNIX
+    4  rw-   SOCK sockfs           UNIX
+ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME: 0
index bad564ea59e63f4ed6456b05ced33b3645fdac99..1efa75492a0f71b77db4e10a1323c5e800b59c93 100755 (executable)
@@ -38,8 +38,8 @@ INTERFACE=lo
     coproc MKFDS { "$TS_HELPER_MKFDS" mapped-packet-socket $FD interface=${INTERFACE}; }
     if read -u ${MKFDS[0]} PID; then
        EXPR='(ASSOC == "shm") and (STTYPE == "SOCK") and (MODE == "-w-")'
-       ${TS_CMD_LSFD} -p "$PID" -n -o PROTONAME -Q "${EXPR}"
-       echo 'PROTONAME': $?
+       ${TS_CMD_LSFD} -p "$PID" -n -o SOCK.PROTONAME -Q "${EXPR}"
+       echo 'SOCK.PROTONAME': $?
     fi
 
     kill -CONT ${PID}
index d20800d0a9b3c2d6c889a67592cd1da59312436a..17d2f3aaacc1cb8a194354600dbb4a4b512064f4 100755 (executable)
@@ -37,8 +37,8 @@ EXPR=
     coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=DGRAM; }
     if read -u ${MKFDS[0]} PID; then
        EXPR='(PID == '"${PID}"') and ((FD == '"$FD0"') or (FD == '"$FD1"'))'
-       ${TS_CMD_LSFD} -n -o ASSOC,MODE,STTYPE,SOURCE,PROTONAME -Q "${EXPR}" | sed -e 's/UNIX-DGRAM/UNIX/'
-       echo 'ASSOC,MODE,STTYPE,SOURCE,PROTONAME': $?
+       ${TS_CMD_LSFD} -n -o ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME -Q "${EXPR}" | sed -e 's/UNIX-DGRAM/UNIX/'
+       echo 'ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME': $?
 
        kill -CONT ${PID}
        wait ${MKFDS_PID}