I recently tried to write a screen saver for a terminal which would be
run by init and would exec getty when a user presses return.
Originally, getty would run fine, but login wouldn't, immediatedly
respawning the screensaver. Another version put its output on the
wrong tty. We checked the source for getty_ps and figured out how to
open std[in|out|err] on the right tty. This got us a shell, but there
was no job control due to "tty: invalid argument (null)." Yet running
as a shell a little program that logged the ttyname() of 0, 1, and 2
showed the correct tty. PIDs shouldn't be a problem since everthing is
exec'ed.
I've now put the screensaver code into getty, and got the same missing
tty error the first time I ran it on each tty. Since then there's
been no problems.
Why didn't it work as a standalone program, what does getty do besides
open stdin, and why didn't it only work the first time I ran it as a
part of getty?
Many thanks,
+Jonas Klein