svn commit: r317732 - head/usr.bin/truss

Michael Tuexen tuexen at freebsd.org
Tue May 16 20:08:56 UTC 2017


> On 16. May 2017, at 20:28, John Baldwin <jhb at freebsd.org> wrote:
> 
> 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.
Yes, you are right. Will fix this tomorrow.

Best regards
Michael
> 
> 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



More information about the svn-src-all mailing list