This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Opinions solicted for changes to tty names in 1.7.10


On Sun, Jul 03, 2011 at 11:32:56AM +0200, Corinna Vinschen wrote:
>On Jul  2 19:43, Christopher Faylor wrote:
>> On Sat, Jul 02, 2011 at 06:42:04AM +0100, Andy Koppe wrote:
>> >Hmm, the two-character ut_id would actually be a problem with Unix98
>> >ptys, because according to Linux's 'man utmp' it's supposed to be 'p'
>> >followed by the pts number there. This would only allow for 10 ptys.
>> >
>> >How about going with the BSD scheme as previously used on Linux?
>> >Should be much less work than Unix98 ptys as well.
>> >
>> >consoles: ttyN
>> >pty masters: /dev/pty[p-za-e][0-9a-f]
>> >pty slaves: /dev/tty[p-za-e][0-9a-f]
>> >
>> >The [p-za-e][0-9a-f] encoding allows for up to 256 pseudo terminal
>> >pairs and fits into ut_id.
>> 
>> If it boils down to making the tty number look more like linux
>> (/dev/pts/10) or just puting a "10" in ut_id, I'd opt for just putting
>> the "10" there.  The "p" really wouldn't make any sense for Cygwin since
>> we no longer have ttys.
>
>But how do you differ between console 10 and tty 10?  The BSD/old-Linux
>naming scheme seems a good way to accomplish that.

AFAIK, in Cygwin, console programs have never used these fields, unless
you go went of your way to call login(1) from a console.  And, in that
case, old Cygwin filled out the field essentially with garbage.  The old
CYGWIN=tty code used to update /var/run/utmp and /var/run/wtmp but that
should be gone now.

Given that the ut_id field can contain arbitrary data and since its
length means that we can't fully emulate linux anyway, I'm comfortable
with just putting two digits there.  There is really no ambiguity since
the ut_line field makes it clear which device is being used.

One reason that I like /dev/pts is that it makes it easy to write a
"driver" which allows you to do "ls /dev/pts" to see which ptys are in
use.  You can't really do that for /dev/[pt]ty* without implementing a
full devfs.  You could, of course, detect "[pt]tty*" as a special case,
but that would be wrong.

cgf


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