Date: Tue, 16 May 2017 11:28:59 -0700 From: John Baldwin <jhb@freebsd.org> To: Michael Tuexen <tuexen@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317732 - head/usr.bin/truss Message-ID: <1678847.Pdl09MfElI@ralph.baldwin.cx> In-Reply-To: <201705030923.v439NEWv072629@repo.freebsd.org> References: <201705030923.v439NEWv072629@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, May 03, 2017 09:23:14 AM Michael Tuexen wrote: > Author: tuexen > Date: Wed May 3 09:23:13 2017 > New Revision: 317732 > URL: https://svnweb.freebsd.org/changeset/base/317732 > > Log: > Decode the third argument of socket(). This is not quite right for sockets that aren't PF_INET. Probably this warrants a const char *sysdecode_socket_protocol(int domain, int protocol) that honors the domain in deciding what protocol value to output. For now this could just handle PF_INET: const char * sysdecode_socket_protocol(int domain, int protocol) { switch (domain) { case PF_INET: return (lookup_value(sockipproto, protocol)); default: return (NULL)); } Then use this in truss. The socket option stuff currently hardcodes IP protocols and levels only because we don't have a good way of obtaining the domain of an existing socket in a target process. For socket()'s protocol argument though we readily have the domain available. At some point in the future we might address the socket option issue by caching the domain argument when sockets are created in a table, and for truss when attaching to an existing process using the kinfo_file interface to learn about existing sockets, but that's not entirely trivial. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1678847.Pdl09MfElI>