On Sat, Mar 20, 2010 at 09:43:21AM -0700, Matt Thomas wrote: > > On Mar 20, 2010, at 9:06 AM, Masao Uebayashi wrote: > > > On Sun, Mar 21, 2010 at 1:01 AM, Matt Thomas <m...@3am-software.com> wrote: > >> I'm talking about <maj, min> to device. How, as a user, do I know what > >> actual tty does /dev/ttyXX open? > > > > If we make tty(4) a device, we can lookup its parent by drvctl(8) > > (extend it to return dv_parent). > > That is user unfriendly. The name in /dev should tell me enough to > know what it is. I should not have to invoke another command to > figure that out.
When you say "what it is," it's not clear whether you mean "what kind" or "what instance". I have a machine with eleven "dial-out" /dev/ nodes: crw-rw---- 1 uucp dialer 8, 524288 Mar 20 13:35 /dev/dty00 crw-rw---- 1 uucp dialer 8, 524289 Mar 20 13:35 /dev/dty01 crw-rw---- 1 uucp dialer 8, 524290 Nov 9 2003 /dev/dty02 crw-rw---- 1 uucp dialer 8, 524291 Mar 10 18:48 /dev/dty03 crw-rw---- 1 uucp dialer 8, 524292 Mar 10 18:48 /dev/dty04 crw-rw---- 1 uucp dialer 8, 524293 Mar 10 18:48 /dev/dty05 crw-rw---- 1 uucp dialer 8, 524294 Mar 18 19:57 /dev/dty06 crw-rw---- 1 uucp dialer 8, 524295 Mar 10 18:47 /dev/dty07 crw-rw---- 1 uucp dialer 8, 524296 Mar 20 13:34 /dev/dty08 crw-rw---- 1 uucp dialer 8, 524297 Mar 10 18:46 /dev/dty09 crw-rw---- 1 uucp dialer 8, 524298 Mar 19 23:58 /dev/dty10 It's handy that I can type 'man dty' to see what kind they are, but beyond that, the listing is not user-friendly: apart from the stand-out modification time, nothing distinguishes /dev/dty02, the only node that has no hardware backing, from the rest. Nothing distinguishes dty00 - dty01, which are built into the motherboard, from dty03 - dty10, which reside on a puc(4). Luckily, dty03 - dty10 correspond directly to tentacles 1 - 8 of the puc(8). I think that your concern may be that a /dev/ node's name, major, and minor will change if we have, say, ttyP at comQ at pucR. It needn't be so---and, I say, it shouldn't. Let the (hypothetical) tty_attach_args convey either the "type" of ("com", "pty") and/or a minor/major (hmm...). I have to say that I really like the idea of splitting com from tty, with com providing a "raw" interface for changing (e.g.) RS-232 parameters, for reading, and for writing, and with tty providing the traditional TTY interface. Dave -- David Young OJC Technologies dyo...@ojctech.com Urbana, IL * (217) 278-3933