HelenOS sources
#ifndef KERN_TASK_H_
#define KERN_TASK_H_
#include <abi/proc/task.h>
#include <abi/sysinfo.h>
#include <adt/list.h>
#include <adt/odict.h>
#include <arch/context.h>
#include <arch/cpu.h>
#include <arch/fpu_context.h>
#include <arch/proc/task.h>
#include <arch/proc/thread.h>
#include <arch.h>
#include <cap/cap.h>
#include <cpu.h>
#include <debug/sections.h>
#include <ipc/event.h>
#include <ipc/ipc.h>
#include <ipc/kbox.h>
#include <mm/as.h>
#include <mm/tlb.h>
#include <proc/scheduler.h>
#include <security/perm.h>
#include <synch/mutex.h>
#include <synch/spinlock.h>
#include <udebug/udebug.h>
#define TASK CURRENT->task
struct thread;
struct cap;
typedef struct task {
odlink_t ltasks;
IRQ_SPINLOCK_DECLARE(lock);
char name[TASK_NAME_BUFLEN];
list_t threads;
as_t *as;
task_id_t taskid;
container_id_t container;
atomic_refcount_t refcount;
atomic_size_t lifecount;
perm_t perms;
cap_info_t *cap_info;
answerbox_t answerbox;
SPINLOCK_DECLARE(active_calls_lock);
list_t active_calls;
event_t events[EVENT_TASK_END - EVENT_END];
stats_ipc_t ipc_info;
#ifdef CONFIG_UDEBUG
udebug_task_t udebug;
kbox_t kb;
#endif
task_arch_t arch;
uint64_t ucycles;
uint64_t kcycles;
debug_sections_t *debug_sections;
} task_t;
IRQ_SPINLOCK_EXTERN(tasks_lock);
extern odict_t tasks;
extern void task_init(void);
extern void task_done(void);
extern task_t *task_create(as_t *, const char *);
extern void task_hold(task_t *);
extern void task_release(task_t *);
extern task_t *task_find_by_id(task_id_t);
extern size_t task_count(void);
extern task_t *task_first(void);
extern task_t *task_next(task_t *);
extern errno_t task_kill(task_id_t);
extern void task_kill_self(bool) __attribute__((noreturn));
extern void task_get_accounting(task_t *, uint64_t *, uint64_t *);
extern void task_print_list(bool);
extern void perm_set(task_t *, perm_t);
extern perm_t perm_get(task_t *);
#ifndef task_create_arch
extern void task_create_arch(task_t *);
#endif
#ifndef task_destroy_arch
extern void task_destroy_arch(task_t *);
#endif
#ifdef __32_BITS__
extern sys_errno_t sys_task_get_id(uspace_ptr_sysarg64_t);
#endif
#ifdef __64_BITS__
extern sysarg_t sys_task_get_id(void);
#endif
extern sys_errno_t sys_task_set_name(uspace_ptr_const_char, size_t);
extern sys_errno_t sys_task_kill(uspace_ptr_task_id_t);
extern sys_errno_t sys_task_exit(sysarg_t);
#endif
HelenOS homepage, sources at GitHub