diff -ur +minimal tcsh-6.03.old/config/config.linux tcsh-6.03/config/config.linux --- tcsh-6.03.old/config/config.linux Fri Nov 20 09:04:47 1992 +++ tcsh-6.03/config/config.linux Sat Jan 30 19:45:04 1993 @@ -36,7 +36,7 @@ * Note that some machines eg. rs6000 have a vfork, but not * with the berkeley semantics, so we cannot use it there either. */ -#define VFORK +#undef VFORK /* * BSDJOBS You have BSD-style job control (both process groups and @@ -116,7 +116,6 @@ #define DIRENT /****************** local defines *********************/ -/* Since people like shared libs so much, we'll make this a default. :-) */ #define _PATH_TCSHELL "/bin/tcsh" #define ECHO_STYLE BOTH_ECHO #ifdef BSDSIGS diff -ur +minimal tcsh-6.03.old/sh.proc.c tcsh-6.03/sh.proc.c --- tcsh-6.03.old/sh.proc.c Fri Nov 20 09:04:22 1992 +++ tcsh-6.03/sh.proc.c Sat Jan 30 19:52:07 1993 @@ -1823,9 +1823,21 @@ (void) sighold(SIGCHLD); #endif /* !BSDSIGS */ while ((pid = fork()) < 0) - if (setintr == 0) + if (setintr == 0) { + /* + * Unblock SIGCHLD, while waiting for a free process slot. + * This allows background processes to complete. + */ +#ifdef BSDSIGS + omask = sigsetmask(omask); (void) sleep(FORKSLEEP); - else { + omask = sigsetmask(omask); +#else + sigrelse(SIGCHLD); + (void) sleep(FORKSLEEP); + sighold(SIGCHLD); +#endif + } else { #ifdef BSDSIGS (void) sigsetmask(omask); #else /* !BSDSIGS */ @@ -1931,7 +1943,7 @@ * either have exited or not yet started to run. Two uglies become * one. */ - sigpause(omask & ~SYNCHMASK); + synch_pause(omask & ~sigmask(SIGCHLD)); if (mysigvec(SIGSYNCH, &osv, NULL)) stderror(ERR_SYSTEM, "pfork parent: sigvec restore", strerror(errno)); diff -ur +minimal tcsh-6.03.old/sh.sem.c tcsh-6.03/sh.sem.c --- tcsh-6.03.old/sh.sem.c Fri Nov 20 09:04:22 1992 +++ tcsh-6.03/sh.sem.c Sat Jan 30 19:57:25 1993 @@ -294,7 +294,12 @@ /* * We need to block SIGCHLD here, so that if the process does * not die before we can set the process group - */ + * + * Why? pfork() already does this! + * Besides, if we run out of processes, + * SIGCHLD remains blocked. + */ +#ifdef notdef if (_gv.wanttty >= 0 && !nosigchld) { #ifdef BSDSIGS csigmask = sigblock(sigmask(SIGCHLD)); @@ -304,8 +309,9 @@ nosigchld = 1; } - +#endif pid = pfork(t, _gv.wanttty); +#ifdef notdef if (pid == 0 && nosigchld) { #ifdef BSDSIGS (void) sigsetmask(csigmask); @@ -314,7 +320,9 @@ #endif /* BSDSIGS */ nosigchld = 0; } - else if (pid != 0 && (t->t_dflg & F_AMPERSAND)) + else +#endif + if (pid != 0 && (t->t_dflg & F_AMPERSAND)) backpid = pid; } diff -ur +minimal tcsh-6.03.old/tc.decls.h tcsh-6.03/tc.decls.h --- tcsh-6.03.old/tc.decls.h Fri Nov 20 09:04:32 1992 +++ tcsh-6.03/tc.decls.h Sat Jan 30 19:52:07 1993 @@ -249,6 +249,7 @@ #endif /* _SEQUENT_ */ #ifdef SIGSYNCH extern sigret_t synch_handler __P((int)); +extern void synch_pause __P((sigmask_t)); #endif /* SIGSYNCH */ diff -ur +minimal tcsh-6.03.old/tc.sig.c tcsh-6.03/tc.sig.c --- tcsh-6.03.old/tc.sig.c Fri Nov 20 09:04:34 1992 +++ tcsh-6.03/tc.sig.c Sat Jan 30 20:07:48 1993 @@ -399,7 +399,7 @@ #ifdef SIGSYNCH -static long Synch_Cnt = 0; +static int synch_received = 0; sigret_t synch_handler(sno) @@ -407,6 +407,13 @@ { if (sno != SIGSYNCH) abort(); - Synch_Cnt++; + synch_received = 1; +} + +void synch_pause(sigmask_t mask) +{ + while (!synch_received) + sigpause(mask & ~sigmask(SIGSYNCH)); + synch_received = 0; } #endif /* SIGSYNCH */ diff -ur +minimal tcsh-6.03.old/tc.sig.h tcsh-6.03/tc.sig.h --- tcsh-6.03.old/tc.sig.h Fri Nov 20 09:04:34 1992 +++ tcsh-6.03/tc.sig.h Sat Jan 30 19:54:12 1993 @@ -163,18 +163,9 @@ # endif /* SIGWINDOW */ #endif /* SIGWINCH */ -#ifdef convex -# ifdef notdef -/* Does not seem to work right... Christos */ -# define SIGSYNCH 0 -# endif -# ifdef SIGSYNCH -# define SYNCHMASK (sigmask(SIGCHLD)|sigmask(SIGSYNCH)) -# else -# define SYNCHMASK (sigmask(SIGCHLD)) -# endif -extern sigret_t synch_handler(); -#endif /* convex */ +#ifdef linux +# define SIGSYNCH SIGUSR1 +#endif #ifdef SAVESIGVEC # define NSIGSAVED 7