Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2007 22:32:06 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Yuri <yuri@rawbw.com>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: How to get filename of an open file descriptor
Message-ID:  <20071112222557.N81124@fledge.watson.org>
In-Reply-To: <1194905125.4738ce25a968c@webmail.rawbw.com>
References:  <1194896018.4738aa922f776@webmail.rawbw.com> <20071112214243.Y81124@fledge.watson.org> <1194905125.4738ce25a968c@webmail.rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 12 Nov 2007, Yuri wrote:

> Thank you for your response.
>
> I attempted to compile procstat but procstat.h seems to be missing in tgz.

Yuri,

Indeed -- looks like I forgot to p4 add on my development box.  I've updated 
the tarball to now include procstat.h.  If there are any other problems, do 
let me know.

Robert N M Watson
Computer Laboratory
University of Cambridge

>
> Yuri
>
> Quoting Robert Watson <rwatson@FreeBSD.org>:
>
>> On Mon, 12 Nov 2007, Yuri wrote:
>>
>>> I am looking for functionality similar to Linux's /proc/<PID>/fd/<FD>. I
>>> need to know what is the file name of an open file descriptor.
>>>
>>> /proc/<PID>/fd is missing on FreeBSD.
>>>
>>> There's something called 'fdescfs'. In /dev/fd/ it shows the list of file
>>
>>> descriptors. But they don't seem to be symbolic links to open files. And
>>> also it only shows FDs of the current process.
>>>
>>> So why there's no /proc/<PID>/fd in FreeBSD? And how do I work around this?
>>
>>> Or should I just invest time and write a kernel patch implementing
>>> /proc/<PID>/fd/?
>>
>> You can give these patches a try:
>>
>>    http://www.watson.org/~robert/freebsd/20071112-procstat.tgz
>>
>> They reflect a work-in-progress procstat(1) tool, which inspects process
>> state
>> in various ways.  They are developed against 8-CURRENT, but likely still
>> apply
>> fairly easily to 7-STABLE.  They suffer various deficiencies, such as relying
>>
>> on the name cache in-kernel to generate file paths for mapped files and open
>>
>> file descriptors, so don't currently work with devfs nodes (for example).
>> However, they may do what you need.  Any feedback would be most welcome.
>>
>> Robert N M Watson
>> Computer Laboratory
>> University of Cambridge
>>
>
>
> -- 
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071112222557.N81124>