Finding a stream's filename

Guy Harris guy at auspex.auspex.com
Sat Jul 29 06:32:04 AEST 1989


>It can be done.  Do an fstat(2) on the file descriptor of interest.  That
>gives you the inode number.  Then open /dev/ and read the entries until
>you find the matching inode number.

Or, better yet, just use the "ttyname" routine (see TTYNAME(3) or
TTYNAME(3C)), if the descriptor is open to a terminal; this saves you
the trouble of reinventing said routine.



More information about the Comp.unix.questions mailing list