Path: utzoo!mnetor!uunet!pwcmrd!skipnyc!skip From: skip@skipnyc.UUCP (Skip Gilbrech) Newsgroups: comp.sources.d Subject: Re: TCSH on SUNs Message-ID: <228@skipnyc.UUCP> Date: 18 Jan 88 05:11:09 GMT References: <1925@svax.cs.cornell.edu> Reply-To: skip@skipnyc.UUCP (Skip Gilbrech) Distribution: comp Organization: PaineWebber, New York City Lines: 109 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