Commit e0ca35c4 authored by Jim Harris's avatar Jim Harris
Browse files

spdk_top: allow connecting with TCP port



JSON-RPC server (spdk_rpc_listen) only listens on
a UNIX domain socket.  If users wish to issue
JSON-RPC calls over a TCP socket for debugging
purposes, they can forward calls using socat, i.e.

socat TCP4-LISTEN:8989,reuseaddr,fork,bind=127.0.0.1 \
      UNIX-CLIENT:/var/tmp/spdk.sock

This could allow running spdk_top to debug or
monitor an SPDK application remotely.  But currently
spdk_top -r option assumes AF_UNIX.  Look at the
first character in the -r option (if provided) - if
it's '/' use AF_UNIX, otherwise AF_INET.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ie9c33bb0fb66dff895359f6f6608862df42b542c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11567


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 5a308ec5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3134,7 +3134,7 @@ int main(int argc, char **argv)
		}
	}

	g_rpc_client = spdk_jsonrpc_client_connect(socket, AF_UNIX);
	g_rpc_client = spdk_jsonrpc_client_connect(socket, socket[0] == '/' ? AF_UNIX : AF_INET);
	if (!g_rpc_client) {
		fprintf(stderr, "spdk_jsonrpc_client_connect() failed: %d\n", errno);
		return 1;