getty attaches tty to future shell?

getty attaches tty to future shell?

Post by Jonas R Kle » Tue, 11 May 1993 17:28:02



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

 
 
 

getty attaches tty to future shell?

Post by Olaf Ti » Wed, 12 May 1993 02:50:35



Quote:> 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?

getty does a setsid(), which creates a new process group for the
shell. A controlling tty is defined for each process group - perhaps
this is your problem.

Olaf
--



what good is a photograph of you? everytime i look at it it makes me feel blue

 
 
 

1. opening tty devices with getty attached

I want to first thank Guy Harris for all of his help he has
given me concerning these tty devices.

I need just a little bit more info ( I hope) to figure all
of this out.

The manual states that open will block when opening a device
that is a communication device with no carrier. I confirmed
that this works. It also states that when O_NDELAY is set,
the open will not block.

I also confirmed this. QUESTION: Does the open suppose to succeed?
My open did with no carrier and O_NDELAY.

Now for the confusion. With login ( ie getty engaged) turned on`
in /etc/ttytab, the open will block with O_NDELAY set. Reading
through the man pages for the zs devices, I got the idea it was
suppose to, but I want some confirmation because the man pages
are not clear about this point. If it is suppose to hang, has
getty done something to make this happen?

Thanks

Sean Coleman

2. 2.4.15pre7aa1

3. How to attach file to EMAIL MESSAGE within shell script(Korn shell)

4. Anecdote: MS' grip loosening

5. getty respawning too rapidly on serial port attached to modem

6. NAMED differ between 2.2.2 & 3.1

7. attaching tty to process

8. unix question

9. how to attach tty to a std output of a background process

10. uugetty attached to specific tty?

11. Q: How to attach to a tty?

12. Attach login direct to ttyS?

13. ppp couldn't attach tty?