How to get filename of an open file descriptor

Skip Ford skip at menantico.com
Fri Nov 16 13:21:07 PST 2007


Robert Watson wrote:
> On Wed, 14 Nov 2007, Skip Ford wrote:
> 
>>>I agree regarding the duplication with ps(1) -- however, I'm generally of 
>>>the opinion that ps(1) is overburdened as tools go, and that the goals 
>>>are actually somehwat different--procstat(1) intentionally doesn't have 
>>>the ability to generate a list of processes, for example, taking pids 
>>>explicitly as the argument; likewise, historically ps(1) has not been 
>>>interested in printing more than one line per process (although I think 
>>>-h changed this). I'll do a bit more investigation as to how easily it 
>>>can be wedged in, and do recognize the concern here.
>>
>>I understand, and I sort of knew that from the beginning which is why I 
>>didn't provide feedback immediately.  I don't have a suggestion as to what 
>>I think should be done.
>>
>>While procstat(1) currently takes a list of pids, I wouldn't be surprised 
>>if somebody adds code to list all processes, unless you block it.  I think 
>>it would be useful, especially since some of it's options produce 
>>single-line per pid output, such as credentials.
>>
>>The two utilities do provide different information, it's just a little odd 
>>to have two utilities with basically the same name.  But I can't think of 
>>a more appropriate name for procstat(1).
> 
> FWIW, it looks like on Solaris, there are a series of psig(1), pstack(1), 
> ptree(1), etc, tools for similar sorts of per-process inspection purposes.  
> I think I prefer bundling it into a single tool, but it's certainly a 
> similar idea.  Maybe I should just rename procstat(1) to pinfo(1) and be 
> done with it?

How about renaming procstat(1) to proc(1), rolling up all of
the Solaris proc tools functionality into that (someday), then
creating hardlinks for all of the individual utilities?

I just found the Solaris manpage for their proc tools and I really
like how they've done it.  The first command listed on that page
is "proc" but then it isn't listed in the synopsis and no man page
is listed in the links.  So, that plus their single "proc tools"
manpage makes it look to me like that's what they actually do,
use a single utility with hardlinks.  I've never used Solaris or
seen the source so I could be wrong, but that's how it looks from
the manpage.

That's a great solution, IMO.  Plus, it would buy more time.  It
could go in immediately to all branches then be improved later
without breaking anything.

-- 
Skip


More information about the freebsd-hackers mailing list