ttyname() and linux+devfs

Clifford Wolf clifford@clifford.at
Thu Oct 29 13:49:00 GMT 1998


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




More information about the Libc-alpha mailing list