It is currently Tue, 07 Dec 2021 03:15:58 GMT

Author Message
 Grabbing file from file descriptors
Hi all !
A question about file descriptors: supposing I don't have lsof installed,
how can I know what  file descriptors 5 , 6 and 7 correspond to ? I mean I'd
to know what file or socket they're actually pointing......
I admit I don't have too much Solaris culture but with Linux I'm accustomed
to find in /proc/ProcNum the file descriptors opened and as symbolic link,
to what file they're actually pointing.
I'd like to know how can I achieve it with Solaris.

P.s. Is it possible to compile Solaris kernel so that it shows more
information in the /proc file system ?

 Mon, 06 Mar 2006 22:51:47 GMT   
 Grabbing file from file descriptors

Easiest would be to use the 'lsof' program as you mentioned.  You can
also use 'pfiles' on the PID, but the local files will be given as a
device and inode.  You'll have to do more work to translate that into a

If you change 'compile' to 'modify', I suppose so, but both those tasks
would require source code, which most users don't have.

I've seen posts in the past mentioning differences in philosophy between
the Solaris /proc (designed to accomodate programs with direct binary
access) and Linux /proc (more suited to human and script access that
read text versions of underlying data).

Darren Dunham                                 
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

 Tue, 07 Mar 2006 00:44:32 GMT   
 Grabbing file from file descriptors

On solution to this problem, a solution which isn't always appropriate
but sometimes comes in handy, is to "truss" the program (this is like
strace in Linux) from the beginning and watch what files it opens
up by looking for the open() system calls.

   - Logan

 Tue, 07 Mar 2006 01:53:13 GMT   
 Grabbing file from file descriptors
In article <Qhlab.61$>,
        Darren Dunham <> writes:

Also that Solaris /proc only has process-related information, while Linux
/proc has also become a dumping grounds for making various sorts of
system-related information available.


 Tue, 07 Mar 2006 08:56:31 GMT   
   [ 4 post ] 

Similar Threads

1. ...dup2: Bad file descriptor [FAILED] .../dev/null: Read-only file system

2. to convert file descriptor to FILE *

3. open files/per-process file descriptor

4. kernel: Cannot read proc file system: 9 - Bad file descriptor

5. file descriptors in a core file

6. Core file/file descriptors.

7. how to find the file corresponding to the file descriptor in the /dev/fd

8. /dev/fd (file descriptor files)

9. File descriptor and file names

10. Getting file name from file descriptor

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software