Stefan Monnier wrote:
check ISDIR first
    

It's a good heursitic, but it's still just a heuristic.
You may have a /dev/tty directory and still use /dev/tty1.
Maybe it's better to get rid of the "/dev/" prefix to make it more clear
that it's not really a valid file name.


        Stefan


  
you mean /dev/tty1 and /dev/tty/1 will exist at the same time?
It won't as I know in linux

procfs_ttyname should return a full path of the ttyname, or at least one function can return the fullpath.