Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Finding a stream's filename Message-ID: <2305@auspex.auspex.com> Date: 28 Jul 89 20:32:04 GMT References: <440@uop.uop.EDU> <1279@cbnewsl.ATT.COM> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 7 >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.