lund@ucla-cs.UUCP (08/08/84)
While hacking vnews to use the UCLA version of send I ran in to some signal handling problems with SIGINT. It seems that vnews exec()s the program in prun() and then waits for it to finish. Our send runs in CBREAK and uses SIGINT (^C) to abort. While vnews is waiting it ignores SIGQUIT and catches SIGINT with it's catcher, onint(). Onint() then renalbles the catching and does a ioctl(0,TIOCSTI,"\0") which stuffs a null onto the input queue which gets read by send. Our send did not appreciate this. Now the question is why did vnews do this awful thing? I fixed it by ignoring SIGINT while waiting for the child to finish. .....Laurence Lundblade UCLA CS Dept. UUCP: {cepu,sdcrdcf,ucbvax,ihnp4}!ucla-cs!lund ARPA: lund@ucla-cs.ARPA
wls@astrovax.UUCP (William L. Sebok) (08/10/84)
> While hacking vnews to use the UCLA version of send I ran in to some > signal handling problems with SIGINT. It seems that vnews > exec()s the program in prun() and then waits for it to finish. > Our send runs in CBREAK and uses SIGINT (^C) to abort. While > vnews is waiting it ignores SIGQUIT and catches SIGINT with it's > catcher, onint(). Onint() then renalbles the catching and does a > ioctl(0,TIOCSTI,"\0") which stuffs a null onto the input queue > which gets read by send. Our send did not appreciate this. > Now the question is why did vnews do this awful thing? I > fixed it by ignoring SIGINT while waiting for the child to finish. > .....Laurence Lundblade > UCLA CS Dept. As the originator of that horrible hack I should give my reasons. You did not state what version of Unix you are running. I installed this when I was trying to fix vnews to run properly on 4.1 BSD. Due to the fact that it wanted to catch ^Z signals to redraw the screen it had to be running the new terminal driver. However the new terminal driver does not allow signals to interrupt an read() system call. Thus SIGINT would not work as an abort character for the input loop. I used the TIOCSTI call to pass a null as an "out-of-band" command from the signal handler to input loop. There are other ways to accomplish this but none are very elegant either. The 4.2 BSD version of vnews substituted select(), an interruptable system call as the routine that waits for input. This makes the TIOCSTI hack not neccessary any more. By the way, a similar problem in the SIGHUP signal handler caused 4.1 BSD vnews to go into an infinite loop when it received a SIGHUP signal. This problem has gone away in the 4.2 BSD vnews. -- Bill Sebok Princeton University, Astrophysics {allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!wls