summaryrefslogtreecommitdiff
path: root/proc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-06-30 14:57:45 +0000
committerRoland McGrath <roland@gnu.org>1994-06-30 14:57:45 +0000
commit540f904871a43b2616da4eebde114a68015a69c1 (patch)
treeb13445d4d53adaa242cdc50852ffed1ac3d7f68c /proc
parent2e3eb3ef0afa61b66797e80a4a0b21db34aa8a24 (diff)
Formerly mgt.c.~13~
Diffstat (limited to 'proc')
-rw-r--r--proc/mgt.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/proc/mgt.c b/proc/mgt.c
index eb70bdfe..250cfae0 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -290,23 +290,29 @@ S_proc_get_arg_locations (struct proc *p,
/* Implement proc_dostop as described in <hurd/proc.defs>. */
kern_return_t
S_proc_dostop (struct proc *p,
- thread_t contthread)
+ thread_t contthread)
{
- thread_t *threads;
- int i;
- u_int nthreads;
-
- task_suspend (p->p_task);
- task_threads (p->p_task, &threads, &nthreads);
+ thread_t threadbuf[2], *threads = threadbuf;
+ unsigned int nthreads = 2, i;
+ error_t err;
+
+ if (err = task_suspend (p->p_task))
+ return err;
+ if (err = task_threads (p->p_task, &threads, &nthreads))
+ return err;
for (i = 0; i < nthreads; i++)
- if (threads[i] != contthread)
- {
- thread_suspend (threads[i]);
- mach_port_deallocate (mach_task_self (), threads[i]);
- }
- vm_deallocate (mach_task_self (), (u_int) threads,
- nthreads * sizeof (thread_t));
- task_resume (p->p_task);
+ {
+ if (threads[i] != contthread)
+ err = thread_suspend (threads[i]);
+ mach_port_deallocate (mach_task_self (), threads[i]);
+ }
+ if (threads != threadbuf)
+ vm_deallocate (mach_task_self (), (vm_address_t) threads,
+ nthreads * sizeof (thread_t));
+ if (err = task_resume (p->p_task))
+ return err;
+
+ mach_port_deallocate (mach_task_self (), contthread);
return 0;
}