Results 1 to 4 of 4
Hi, Is it possible to get a file descriptor from the major and minor number. If so, how can this be done? I am trying to see if a port(eg ...
- 11-15-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 12
Get File Descriptor from major and minor number
Hi, Is it possible to get a file descriptor from the major and minor number. If so, how can this be done? I am trying to see if a port(eg ttyS2) is opened without using the fdopen or open or fopen functions.
Or maybe the question I should be asking is, is there a way to get the file descriptor of file or port that as already been opened, without using the functions I mentioned above. These functions reopens the port. I am trying to avoid that.
- 11-15-2010 #2
Try the lsof command.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 11-15-2010 #3Just Joined!
- Join Date
- Sep 2010
- Posts
- 12
the lsof command is terminal based. Is there a way to do this in C code
Last edited by ptb4866; 11-15-2010 at 06:39 PM.
- 11-16-2010 #4
Well, what about reading directory entries in /proc/PID/fdinfo? There's probably some function in libproc that does it more directly.
"I'm just a little old lady; don't try to dazzle me with jargon!"


