This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ttyname() and linux+devfs



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]