murthy@svax.cs.cornell.edu (Chet Murthy) (01/13/88)
Hi. I have a version of tcsh created by applying the recently-posted 4.3 conversion kit to the 4.2 modifications, and then applying them to the 4.3 source to csh. I couldn't use the 4.2 kit directly because 1) I have 4.3 vaxen, and 2) the only 4.2 machine that I have source to is a IBM PC/RT, which has the annoying feature that IBM hacked at the sources a bit. Anyway, I can run tcsh just fine on the RT - the 4.3 source+mods compiles effortlessly for the most part. I can also run it just fine on the uVaxen. However, have been unable to get it to run on the SUN, running 3.4 UNIX. The problem is that when I type control-C to the tcsh prompt, it dies. This means that if I type control-C one too many times when killing a program, then tcsh can sometimes get the extra kill signal, and die right there. Does anybody else out there experience this? And if so, have you a fix? Thanks in advance, --chet-- -- --chet-- In Real Life: Chet Murthy ARPA: murthy@svax.cs.cornell.edu SnailMail: Chet Murthy Gaslight Village Apts 21-B Uptown Road Ithaca, NY 14850 Office: 4162 Upson (607) 255-2219 MaBellNet: (607)-257-5709
skip@skipnyc.UUCP (Skip Gilbrech) (01/18/88)
In article <1925@svax.cs.cornell.edu> murthy@arvak.cs.cornell.edu (Chet Murthy) writes: >However, have been unable to get it [tcsh] to run on the SUN, running >3.4 UNIX. The problem is that when I type control-C to the tcsh prompt, >it dies. >Does anybody else out there experience this? And if so, have you a fix? >--chet-- I found the fix for this a couple of months ago & sent the patch to the author (Paul Placeway) but after reading Chet's message I decided there must be others who could use it immediately. The problem exists in the original 4.3 (and most likely 4.2) sources, & wasn't introduced by tcsh. The patch below was made from the 4.3 sh.sem.c, but it should be easy to modify for 4.2. The comment below from the source pretty much explains the problem. Since the author knew about it, I can't help but wonder why he didn't put in some conditional code to handle it (probably 10 minutes work..). > /* > * Prepare for the vfork by saving everything > * that the child corrupts before it exec's. > * Note that in some signal implementations > * which keep the signal info in user space > * (e.g. Sun's) it will also be necessary to > * save and restore the current sigvec's for > * the signals the child touches before it > * exec's. > */ ------------------------------------------------------------------- Patch follows: *** sh.sem.c.old Sun Nov 29 20:18:08 1987 --- sh.sem.c Sun Nov 29 20:18:08 1987 *************** *** 133,138 **** --- 133,148 ---- * the signals the child touches before it * exec's. */ + + /* Sooooo true... If this is a Sun, save + * the sigvec's. (Skip Gilbrech - 11/22/87) + */ + #ifdef sun + typedef struct sigvec * SVSP; + struct sigvec oSIGINT, oSIGQUIT, oSIGTSTP, oSIGTTIN, + oSIGTTOU, oSIGTERM, oSIGHUP; + int Sun_omask; + #endif /* sun */ omask = sigblock(sigmask(SIGCHLD)); ochild = child; osetintr = setintr; ohaderr = haderr; odidfds = didfds; *************** *** 139,144 **** --- 149,174 ---- oSHIN = SHIN; oSHOUT = SHOUT; oSHDIAG = SHDIAG; oOLDSTD = OLDSTD; otpgrp = tpgrp; Vsav = Vdp = 0; Vav = 0; + #ifdef sun + (void) sigvec( SIGINT, (SVSP)0, &oSIGINT ); + (void) sigvec( SIGQUIT, (SVSP)0, &oSIGQUIT ); + (void) sigvec( SIGTSTP, (SVSP)0, &oSIGTSTP ); + (void) sigvec( SIGTTIN, (SVSP)0, &oSIGTTIN ); + (void) sigvec( SIGTTOU, (SVSP)0, &oSIGTTOU ); + (void) sigvec( SIGTERM, (SVSP)0, &oSIGTERM ); + (void) sigvec( SIGHUP, (SVSP)0, &oSIGHUP ); + + /* + * Can't handle any of these signals until sigvec's + * are restored (sg) + */ + + Sun_omask = + sigblock( sigmask(SIGINT) | sigmask(SIGQUIT) | + sigmask(SIGTSTP) | sigmask(SIGTTIN) | + sigmask(SIGTTOU) | sigmask(SIGTERM) | + sigmask(SIGHUP) ); + #endif /* sun */ pid = vfork(); if (pid < 0) { (void) sigsetmask(omask); *************** *** 146,151 **** --- 176,191 ---- } forked++; if (pid) { /* parent */ + #ifdef sun + (void) sigvec( SIGINT, &oSIGINT, (SVSP)0 ); + (void) sigvec( SIGQUIT, &oSIGQUIT, (SVSP)0 ); + (void) sigvec( SIGTSTP, &oSIGTSTP, (SVSP)0 ); + (void) sigvec( SIGTTIN, &oSIGTTIN, (SVSP)0 ); + (void) sigvec( SIGTTOU, &oSIGTTOU, (SVSP)0 ); + (void) sigvec( SIGTERM, &oSIGTERM, (SVSP)0 ); + (void) sigvec( SIGHUP, &oSIGHUP, (SVSP)0 ); + (void) sigsetmask(Sun_omask); + #endif /* sun */ child = ochild; setintr = osetintr; haderr = ohaderr; didfds = odidfds; SHIN = oSHIN; -- Skip Gilbrech UUCP: uunet!pwcmrd!skip PaineWebber, NYC attmail!skipnyc!skip