What happened to my /proc/curproc/file?

John Baldwin jhb at freebsd.org
Fri Sep 7 18:19:23 UTC 2012


On Friday, September 07, 2012 12:39:50 pm Konstantin Belousov wrote:
> On Fri, Sep 07, 2012 at 12:23:54PM -0400, John Baldwin wrote:
> > 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.
> 
> ino is in kf_file_fileid, and rdev in kf_file_rdev. Also there is
> fsid in kf_file_fsid.

Oh, foo.  I was looking at the 'o' variants.

-- 
John Baldwin


More information about the freebsd-hackers mailing list