Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!cord!hudson!bentley!hoxna!houxm!mhuxt!mhuxr!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.emacs Subject: Re: requests Message-ID: <1404@umcp-cs.UUCP> Date: Tue, 27-Aug-85 06:23:30 EDT Article-I.D.: umcp-cs.1404 Posted: Tue Aug 27 06:23:30 1985 Date-Received: Wed, 28-Aug-85 10:19:54 EDT References: <291@CS-Mordred> <1403@umcp-cs.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 203 Oops, forgot to include the actual text of my version of the fix. Your code may differ. RCS file: RCS/pchan.c,v retrieving revision 2.10 retrieving revision 2.11 diff -c2 -r2.10 -r2.11 *** /tmp/,RCSt1003600 Tue Aug 27 06:16:54 1985 --- /tmp/,RCSt2003600 Tue Aug 27 06:17:03 1985 *************** *** 235,238 (void) ioctl (0, TIOCSETD, &ld); UseUsersShell = len; sh = shell (); execlp (sh, sh, --- 235,242 ----- (void) ioctl (0, TIOCSETD, &ld); UseUsersShell = len; + /* BEGIN BOGUS KERNEL-BUG-WORKAROUND */ + (void) ioctl (0, TIOCSPGRP, &pgrp); + setpgrp (0, pgrp); + /* END BOGUS KERNEL-BUG-WORKAROUND */ sh = shell (); execlp (sh, sh, *************** *** 239,243 UseUsersShell && UseCshOptionF ? "-cf" : "-c", command, (char *) 0); ! (void) write (1, "Couldn't exec the shell\n", 24); _exit (1); /* NOTREACHED */ --- 243,249 ----- UseUsersShell && UseCshOptionF ? "-cf" : "-c", command, (char *) 0); ! (void) write (1, "Couldn't exec shell\"", 21); ! (void) write (1, sh, strlen (sh)); ! (void) write (1, "\"\n", 2); _exit (1); /* NOTREACHED */ *************** *** 313,317 readloop: - ichans = sel_ichans; ochans = sel_ochans; --- 319,322 ----- readloop: ichans = sel_ichans; ochans = sel_ochans; *************** *** 468,471 } /* Kill off all active processes: done only to exit when user really --- 473,483 ----- } + /* The following is to work around an obscure bug (which *seems* to be in the + kernel but who can tell for sure??) */ + #define DoKill(pid,sig) \ + do { \ + if (killpg (pid, sig)) \ + kill (pid, sig); \ + } while (0) /* Kill off all active processes: done only to exit when user really *************** *** 471,475 /* Kill off all active processes: done only to exit when user really insists. */ - kill_processes () { register struct process_blk *p; --- 483,486 ----- /* Kill off all active processes: done only to exit when user really insists. */ kill_processes () { register struct process_blk *p; *************** *** 479,485 ioctl (p -> p_chan.ch_index, TIOCGPGRP, &p -> p_gid); if (p -> p_gid != -1) ! killpg (p -> p_gid, SIGKILL); ! if (p -> p_pid != -1) ! killpg (p -> p_pid, SIGKILL); } } --- 490,496 ----- ioctl (p -> p_chan.ch_index, TIOCGPGRP, &p -> p_gid); if (p -> p_gid != -1) ! DoKill (p -> p_gid, SIGKILL); ! if (p -> p_pid != -1 && p -> p_pid != p -> p_gid) ! DoKill (p -> p_pid, SIGKILL); } } *************** *** 557,561 #ifndef TTYconnect if (leader != -1) ! killpg (leader, signal); #else not TTYconnect if (leader != -1) --- 568,572 ----- #ifndef TTYconnect if (leader != -1) ! DoKill (leader, signal); #else not TTYconnect if (leader != -1) *************** *** 560,564 #else not TTYconnect if (leader != -1) ! killpg (leader, signal); else if (process -> p_pid == -1 && signal == SIGKILL) { register int bit = 1 << process -> p_chan.ch_index; --- 571,575 ----- #else not TTYconnect if (leader != -1) ! DoKill (leader, signal); else if (process -> p_pid == -1 && signal == SIGKILL) { register int bit = 1 << process -> p_chan.ch_index; *************** *** 563,566 else if (process -> p_pid == -1 && signal == SIGKILL) { register int bit = 1 << process -> p_chan.ch_index; sel_ichans &= ~bit; sel_ochans &= ~bit; --- 574,578 ----- else if (process -> p_pid == -1 && signal == SIGKILL) { register int bit = 1 << process -> p_chan.ch_index; + sel_ichans &= ~bit; sel_ochans &= ~bit; *************** *** 565,569 sel_ichans &= ~bit; sel_ochans &= ~bit; ! close (process -> p_chan.ch_index); sighold (SIGCHLD); process -> p_flag = SIGNALED | CHANGED; --- 577,581 ----- sel_ichans &= ~bit; sel_ochans &= ~bit; ! (void) close (process -> p_chan.ch_index); sighold (SIGCHLD); process -> p_flag = SIGNALED | CHANGED; *************** *** 576,579 } /* Send an EOT to a process. */ --- 588,592 ----- } + #undef DoKill *************** *** 577,580 /* Send an EOT to a process. */ EOTProcess () { --- 590,594 ----- #undef DoKill + /* Send an EOT to a process. */ EOTProcess () { *************** *** 584,588 if ((process = GetBufProc ()) == NULL) { error ("Not a process"); ! return (0); } --- 598,602 ----- if ((process = GetBufProc ()) == NULL) { error ("Not a process"); ! return 0; } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland