《linux下的sched头文件.doc》由会员分享,可在线阅读,更多相关《linux下的sched头文件.doc(24页珍藏版)》请在金锄头文库上搜索。
1、/* * include/linux/schedh * */#ifndef _LINUX_SCHED_H#define _LINUX_SCHED_H#include /* for HZ */extern unsigned long event;#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #includ
2、e struct exec_domain;/* * cloning flags: */#define CSIGNAL0x000000ff/* signal mask to be sent at exit */#define CLONE_VM0x00000100/* set if VM shared between processes */#define CLONE_FS0x00000200/* set if fs info shared between processes */#define CLONE_FILES0x00000400/* set if open files shared be
3、tween processes */#define CLONE_SIGHAND0x00000800/* set if signal handlers and blocked signals shared */#define CLONE_PID0x00001000/* set if pid shared */#define CLONE_PTRACE0x00002000/* set if we want to let tracing continue on the child too */#define CLONE_VFORK0x00004000/* set if the parent wants
4、 the child to wake it up on mm_release */#define CLONE_PARENT0x00008000/* set if we want to have the same parent as the cloner */#define CLONE_THREAD0x00010000/* Same thread group? */#define CLONE_NEWNS0x00020000/* New namespace group? */#define CLONE_SIGNAL(CLONE_SIGHAND | CLONE_THREAD)/* * These a
5、re the constant used to fake the fixed-point load-average * counting. Some notes: * - 11 bit fractions expand to 22 bits by the multiplies: this gives * a load-average precision of 10 bits integer + 11 bits fractional * - if you want to count load-averages more often, you need more * precision, or r
6、ounding will get you. With 2-second counting freq, * the EXP_n values would be 1981, 2034 and 2043 if still using only * 11 bit fractions. */extern unsigned long avenrun;/* Load averages */#define FSHIFT11/* nr of bits of precision */#define FIXED_1(1= FSHIFT;#define CT_TO_SECS(x)(x) / HZ)#define CT
7、_TO_USECS(x)(x) % HZ) * 1000000/HZ)extern int nr_threads;extern int last_pid;extern unsigned long nr_running(void);extern unsigned long nr_uninterruptible(void);#include #include #include #include #include #include /进程状态#define TASK_RUNNING0#define TASK_INTERRUPTIBLE1#define TASK_UNINTERRUPTIBLE2#de
8、fine TASK_ZOMBIE4#define TASK_STOPPED8#define _set_task_state(tsk, state_value)do (tsk)-state = (state_value); while (0)#ifdef CONFIG_SMP#define set_task_state(tsk, state_value)set_mb(tsk)-state, (state_value)#else#define set_task_state(tsk, state_value)_set_task_state(tsk), (state_value)#endif#defi
9、ne _set_current_state(state_value)do current-state = (state_value); while (0)#ifdef CONFIG_SMP#define set_current_state(state_value)set_mb(current-state, (state_value)#else#define set_current_state(state_value)_set_current_state(state_value)#endif/* * Scheduling policies */#define SCHED_OTHER0#defin
10、e SCHED_FIFO1#define SCHED_RR2struct sched_param int sched_priority;struct completion;#ifdef _KERNEL_#include /* * This serializes schedule() and also protects * the run-queue from deletions/modifications (but * _adding_ to the beginning of the run-queue has * a separate lock). */extern rwlock_t tas
11、klist_lock;extern spinlock_t mmlist_lock;typedef struct task_struct task_t; /将task_t定义为task_sturct的结构类型extern void sched_init(void);extern void init_idle(task_t *idle, int cpu);extern void show_state(void);extern void show_stack(unsigned long * esp);extern void cpu_init (void);extern void trap_init(
12、void);extern void update_process_times(int user);extern void update_one_process(task_t *p, unsigned long user, unsigned long system, int cpu);extern void scheduler_tick(int user_tick, int system);extern void migration_init(void);extern unsigned long cache_decay_ticks;extern int set_user(uid_t new_ruid, int dumpclear);#defineMAX_SCHEDULE_TIMEOUTLONG_MAXextern signed long FASTCALL(schedule_timeout(signed long timeout);asmlinkage void schedule(void);extern int schedule_task(struct tq_str