From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 7 16:24:33 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E03CA1065674 for ; Fri, 7 Sep 2012 16:24:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B533B8FC15 for ; Fri, 7 Sep 2012 16:24:33 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1636EB97C; Fri, 7 Sep 2012 12:24:33 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Fri, 7 Sep 2012 12:23:54 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201209071033.52864.jhb@freebsd.org> <20120907155936.GY33100@deviant.kiev.zoral.com.ua> In-Reply-To: <20120907155936.GY33100@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201209071223.54931.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 07 Sep 2012 12:24:33 -0400 (EDT) Cc: Sam Varshavchik , freebsd-hackers@freebsd.org Subject: Re: What happened to my /proc/curproc/file? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2012 16:24:34 -0000 On Friday, September 07, 2012 11:59:36 am Konstantin Belousov wrote: > On Fri, Sep 07, 2012 at 10:33:52AM -0400, John Baldwin wrote: > > On Tuesday, September 04, 2012 7:46:23 pm Sam Varshavchik wrote: > > > Is the dev+ino of what was exec()ed known, for another process? I might be > > > able to get the client voluntarily submit its argv[0], then independently > > > have the server validate it by stat()ing that, and comparing the result > > > against what the kernel says the process's inode is. > > > > It's known in the kernel certainly. I don't think we currently have any way > > of exporting that info to userland however. > > It is, as KF_FD_TYPE_TEXT by sysctl kern.proc.filedesc. That doesn't include stat info though IIRC. You can get a pathname that is the same you would get from /proc/curproc/file (so it may fail and be empty), but you don't get st_dev or st_ino. I have thought that it might be useful for kinfo_file to include a full 'struct stat' and use the fo_stat() method of each file to fill it in, but that is not present currently. -- John Baldwin