/[rtmk]/rtmk/task.c
ViewVC logotype

Diff of /rtmk/task.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by jrydberg, Fri Feb 22 22:41:48 2002 UTC revision 1.10 by jrydberg, Sun Feb 24 23:09:48 2002 UTC
# Line 270  task_special_port_get (struct task *task Line 270  task_special_port_get (struct task *task
270    return KERN_SUCCESS;    return KERN_SUCCESS;
271  }  }
272    
273    /* Return send rights to threads that belong to TASK.  Send rights
274       are returned in THREADSP.  Number of ports returned in *COUNTP.  */
275    kern_return_t
276    task_threads (struct task *task, rtmk_port_t **threadsp, int *countp)
277    {
278      struct ipc_port **ports;
279      struct thread *thread;
280      int count = 0, i = 0;
281      SPL_T spl;
282    
283      assert (task);
284    
285      spl = SPLOFF ();
286      task_lock (task);
287    
288      /* First we count all threads in the task so that we get the
289         amount of memory we must allocate for the port array.  */
290      queue_iterate (&task->thread_list, thread, struct thread *, taskq)
291        count++;
292    
293      /* Allocate memory (not wired) for the array.  */
294      ports =
295        (struct ipc_port **) kmem_malloc (count * sizeof (struct ipc_port *));
296    
297      queue_iterate (&task->thread_list, thread, struct thread *, taskq)
298        ports [i++] = thread->thread_port;
299    
300      task_unlock (task);
301      SPLON (spl);
302    
303      *threadsp = (rtmk_port_t *) ports;
304      *countp   = count;
305      return KERN_SUCCESS;
306    }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26