From owner-svn-src-head@freebsd.org Tue May 16 18:29:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2B2AD7064C; Tue, 16 May 2017 18:29:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EF361E48; Tue, 16 May 2017 18:29:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 02DDB10A7B9; Tue, 16 May 2017 14:29:06 -0400 (EDT) From: John Baldwin To: Michael Tuexen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317732 - head/usr.bin/truss Date: Tue, 16 May 2017 11:28:59 -0700 Message-ID: <1678847.Pdl09MfElI@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201705030923.v439NEWv072629@repo.freebsd.org> References: <201705030923.v439NEWv072629@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 16 May 2017 14:29:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 May 2017 18:29:16 -0000 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