[klibc] [PATCH] isatty(): use TCGETS instead of TIOCGPGRP, like dietlibc does

Thorsten Glaser tg at mirbsd.de
Thu Jun 12 01:48:53 PDT 2014

Maciej Żenczykowski dixit:

>I guess what I wanted to say is that it might be desirable to have the
>klibc shell do some dancing (perhaps controlled by some flags, but on

There is no klibc shell.

>child should
>open("/dev/ttyS0", O_RDONLY)
>open("/dev/ttyS0", O_WRONLY|O_NOCTTY)
>open("/dev/ttyS0", O_WRONLY|O_NOCTTY)

Yes. You boot with init=/bin/mksh (for example), then type

	mksh -lT!/dev/ttyS0

and it does that. This functionality is built into the shell.

Busybox has some magic to divine the real console device used,
but this is too fragile. In the rescue case, it’s better to do
that from hand (you have either tty1 or ttyS0/ttyACM0/… or hvc0
normally – plus, if it fails you get a message and can retry).

My point here, asking for this change, is: normally you do *not*
need full job control right from the start. But you *do* want to
have PS1 and working command line editing (e.g. tab completion).
For this, /dev/console must be isatty().

FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh

More information about the klibc mailing list