[PATCH 2/3] Support unix sockets in -yy option

Dmitry V. Levin ldv at altlinux.org
Mon Dec 8 18:27:51 UTC 2014


On Sun, Dec 07, 2014 at 06:56:14AM +0900, Masatake YAMATO wrote:
> This patch extends -yy option; the peer address of a unix socket can be
> printed like an inet socket.
> 
> About a listening socket, its socket path and socket inode are printed.
> About an accepted socket, its socket path, socket inode and peer inode
> are printed.
> About a client socket, its socket inode and peer inode are printed.
> 
> An example of server side with netcat:
> 
>    $ ./strace -yy -e network nc -l -U /tmp/example.sock
>    socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
>    setsockopt(3<UNIX:[12592606]>, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
>    bind(3<UNIX:[12592606]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
>    listen(3</tmp/example.sock,12592606>, 10) = 0
>    accept(3</tmp/example.sock,12592606>, {sa_family=AF_LOCAL, NULL}, [2]) = 4</tmp/example.sock,12593212->12591974>
>    recvfrom(4</tmp/example.sock,12593212->12591974>, "INPUT\n", 8192, 0, NULL, NULL) = 6

I see potential source of confusion in this output format: socket path
looks very similar to a regular file path.  Lets change it somehow to
avoid ambiguity.  For example, we could add "UNIX:" prefix:

	3<UNIX:/tmp/example.sock,12592606>

For the same reason, maybe the inode information is better to be added
before the path rather than after the path, e.g.

	4<UNIX:12593212->12591974:/tmp/example.sock>


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20141208/264926b7/attachment.bin>


More information about the Strace-devel mailing list