Esempio n. 1
0
int main(int argc, char **argv) {
	struct task *task;

	printf("PID USER  PR COMMAND\n");

	task_foreach(task) {
		printf("%-3d %-4d % 3d %s\n", tid,
				task_resource_u_area(task)->reuid,
				task_get_priority(task), task_get_name(task));
	}

	return 0;
}
Esempio n. 2
0
void task_init(struct task *tsk, int id, struct task *parent,
		const char *name, struct thread *main_thread,
		task_priority_t priority) {
	assert(tsk == task_kernel_task());
	assert(id == task_get_id(tsk));
	assert(0 == strcmp(name, task_get_name(tsk)));
	assert(main_thread == task_get_main(tsk));
	assert(TASK_PRIORITY_DEFAULT == task_get_priority(tsk));

	if (main_thread != NULL) { /* check for thread.NoThreads module */
		main_thread->task = tsk;
	}

	task_resource_init(tsk);
}
static void __attribute__((noinline)) _task_dump_trace_dispatch(int sig)
{
	int need_dispatch = 1;
	task_id_t running = task_get_running();

	if (!pthread_equal(pthread_self(), main_thread)) {
		need_dispatch = 0;
	} else if (!task_start_called()) {
		fprintf(stderr, "Stack trace of main thread:\n");
		need_dispatch = 0;
	} else if (in_interrupt_context()) {
		fprintf(stderr, "Stack trace of ISR:\n");
	} else {
		fprintf(stderr, "Stack trace of task %d (%s):\n",
				running, task_get_name(running));
	}

	if (need_dispatch) {
		pthread_kill(task_get_thread(running), SIGNAL_TRACE_DUMP);
	} else {
		_task_dump_trace_impl(SIGNAL_TRACE_OFFSET);
		exit(1);
	}
}