This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: ttyname() and linux+devfs
- To: glibc-linux@ricardo.ecn.wfu.edu
- Subject: Re: ttyname() and linux+devfs
- From: Clifford Wolf <clifford@clifford.at>
- Date: Thu, 29 Oct 1998 22:54:04 +0100 (MET)
- cc: libc-alpha@cygnus.com
- Reply-To: Clifford Wolf <clifford@clifford.at>
On Thu, 29 Oct 1998, Martin von Loewis wrote:
> > /dev/vc/*, my cua devices are /dev/cua/* and so on. It would be great if
> > the ttyname function could make a recursive scan thru the compleate /dev
> > directory structure instead of lokking only in /dev/ and /dev/pts/.
>
> Why not use /proc/self/fd/0 instead?
That's a good question. Why don't making just a readlink() on
/proc/self/fd/%d (where %d is the fd number)? Would be much faster
than scanning /dev and works with all /dev structures ...
It would solve the symlink/real-device problem too: afaik the symlinks
in /proc/self/fd/ point to the filenames which are passed to open() - and
this are the filenames we would like to know.
- clifford
-- -- -- -- -- -- -- -- -- -- -- -- --
Clifford Wolf (CEO and CTO)
The ROCK Projects Workgoup IRC: IRCnet / clifford
http://www.rock-projects.com/ http://www.clifford.at/
e-mail: c.wolf@rock-projects.com email: god@clifford.at