Example #1
0
/* given a list of tasks, sample all the threads in 'em */
static void
pet_sample_task_list( int taskc, task_array_t taskv  )
{
	int i;

	for( i = 0; i < taskc; i++ )
	{
		kern_return_t kr;
		task_t task = taskv[i];

		/* FIXME: necessary? old code did this, our hacky
		 * filtering code does, too
		 */
		if(!task) {
			continue;
		}

		/* try and stop any task other than the kernel task */
		if( task != kernel_task )
		{
			kr = task_suspend_internal( task );

			/* try the next task */
			if( kr != KERN_SUCCESS )
				continue;
		}

		/* sample it */
		pet_sample_task( task );

		/* if it wasn't the kernel, resume it */
		if( task != kernel_task )
			(void) task_resume_internal(task);
	}
}
Example #2
0
/* Not called from probe context */
void
sprunlock(proc_t *p)
{
	if (p != PROC_NULL) {
		proc_unlock(p);

		dtrace_sprunlock(p);

		task_resume_internal(p->task);

		proc_rele(p);
	}
}