PATCH: proc_do_stop and rpctrace
Marcus Brinkmann <[email protected]> Thu, 31 Jul 2003 23:29:09 +0200
| Newsgroups | gmane.os.hurd.devel.readers |
|---|---|
| Message-ID | <[email protected]> |
Hi, the below patch by ogi fixes a problem with rpctrace and CTRL-C. I want to apply the patch, please let me know if you have objections. When the traced task calls proc_do_stop with the contthread port, then rpctrace creates an intermediate port and substitutes the contthread send right. Because of this, proc fails in comparing (numerically) the contthread with the send rights Mach supplies to proc when listing all threads in the task. The port by Mach is not the one rpctrace gives to proc. Thus, all threads in the task are suspended. The patch fixes this by suspending all tasks and then resuming contthread. This works because then contthread is suspended once directly by proc, and then resumed indirectly by rpctrace. Thanks, Marcus 2003-06-16 Ognyan Kulev <[email protected]> * mgt.c (S_proc_dostop): Instead of suspending all threads except CONTTHREAD, first suspend all threads, and then resume CONTTHREAD. --- /home/ogi/cvs/hurd/proc/mgt.c 2002-05-08 12:24:52.000000000 +0300 +++ hurd/proc/mgt.c 2003-06-16 18:40:34.000000000 +0300 @@ -1,5 +1,5 @@ /* Process management - Copyright (C) 1992,93,94,95,96,99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1992,93,94,95,96,99,2000,01,02,03 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -350,12 +350,12 @@ S_proc_dostop (struct proc *p, } for (i = 0; i < nthreads; i++) { - if (threads[i] != contthread) - thread_suspend (threads[i]); + thread_suspend (threads[i]); mach_port_deallocate (mach_task_self (), threads[i]); } if (threads != threadbuf) munmap (threads, nthreads * sizeof (thread_t)); + thread_resume (contthread); err = task_resume (p->p_task); if (err) return err; -- `Rhubarb is no Egyptian god.' GNU http://www.gnu.org [email protected] Marcus Brinkmann The Hurd http://www.gnu.org/software/hurd/ [email protected] http://www.marcus-brinkmann.de/