sched.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 1,036 行 · 第 1/3 页
H
1,036 行
#ifndef _LINUX_SCHED_H#define _LINUX_SCHED_H#include <asm/param.h> /* for HZ */#include <linux/config.h>#include <linux/capability.h>#include <linux/threads.h>#include <linux/kernel.h>#include <linux/types.h>#include <linux/timex.h>#include <linux/jiffies.h>#include <linux/rbtree.h>#include <linux/thread_info.h>#include <linux/cpumask.h>#include <asm/system.h>#include <asm/semaphore.h>#include <asm/page.h>#include <asm/ptrace.h>#include <asm/mmu.h>#include <linux/smp.h>#include <linux/sem.h>#include <linux/signal.h>#include <linux/securebits.h>#include <linux/fs_struct.h>#include <linux/compiler.h>#include <linux/completion.h>#include <linux/pid.h>#include <linux/percpu.h>struct exec_domain;/* * cloning flags: */#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */#define CLONE_VM 0x00000100 /* set if VM shared between processes */#define CLONE_FS 0x00000200 /* set if fs info shared between processes */#define CLONE_FILES 0x00000400 /* set if open files shared between processes */#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */#define CLONE_THREAD 0x00010000 /* Same thread group? */#define CLONE_NEWNS 0x00020000 /* New namespace group? */#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */#define CLONE_DETACHED 0x00400000 /* Unused, ignored */#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */#define CLONE_STOPPED 0x02000000 /* Start in stopped state *//* * List of flags we want to share for kernel threads, * if only because they are not used by them anyway. */#define CLONE_KERNEL (CLONE_FS | CLONE_FILES | CLONE_SIGHAND)/* * These are 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 rounding 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 FSHIFT 11 /* nr of bits of precision */#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */#define LOAD_FREQ (5*HZ) /* 5 sec intervals */#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */#define EXP_5 2014 /* 1/exp(5sec/5min) */#define EXP_15 2037 /* 1/exp(5sec/15min) */#define CALC_LOAD(load,exp,n) \ load *= exp; \ load += n*(FIXED_1-exp); \ load >>= FSHIFT;#define CT_TO_SECS(x) ((x) / HZ)#define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ)extern int nr_threads;extern int last_pid;DECLARE_PER_CPU(unsigned long, process_counts);extern int nr_processes(void);extern unsigned long nr_running(void);extern unsigned long nr_uninterruptible(void);extern unsigned long nr_iowait(void);#include <linux/time.h>#include <linux/param.h>#include <linux/resource.h>#include <linux/timer.h>#include <asm/processor.h>#define TASK_RUNNING 0#define TASK_INTERRUPTIBLE 1#define TASK_UNINTERRUPTIBLE 2#define TASK_STOPPED 4#define TASK_TRACED 8#define TASK_ZOMBIE 16#define TASK_DEAD 32#define __set_task_state(tsk, state_value) \ do { (tsk)->state = (state_value); } while (0)#define set_task_state(tsk, state_value) \ set_mb((tsk)->state, (state_value))#define __set_current_state(state_value) \ do { current->state = (state_value); } while (0)#define set_current_state(state_value) \ set_mb(current->state, (state_value))/* * Scheduling policies */#define SCHED_NORMAL 0#define SCHED_FIFO 1#define SCHED_RR 2struct sched_param { int sched_priority;};#ifdef __KERNEL__#include <linux/spinlock.h>/* * 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 tasklist_lock;extern spinlock_t mmlist_lock;typedef struct task_struct task_t;extern void sched_init(void);extern void sched_init_smp(void);extern void init_idle(task_t *idle, int cpu);extern cpumask_t nohz_cpu_mask;extern void show_state(void);extern void show_regs(struct pt_regs *);/* * TASK is a pointer to the task whose backtrace we want to see (or NULL for current * task), SP is the stack pointer of the first frame that should be shown in the back * trace (or NULL if the entire call-chain of the task should be shown). */extern void show_stack(struct task_struct *task, unsigned long *sp);void io_schedule(void);long io_schedule_timeout(long timeout);extern void cpu_init (void);extern void trap_init(void);extern void update_process_times(int user);extern void scheduler_tick(int user_tick, int system);extern unsigned long cache_decay_ticks;/* Attach to any functions which should be ignored in wchan output. */#define __sched __attribute__((__section__(".sched.text")))/* Is this address in the __sched functions? */extern int in_sched_functions(unsigned long addr);#define MAX_SCHEDULE_TIMEOUT LONG_MAXextern signed long FASTCALL(schedule_timeout(signed long timeout));asmlinkage void schedule(void);struct namespace;/* Maximum number of active map areas.. This is a random (large) number */#define DEFAULT_MAX_MAP_COUNT 65536extern int sysctl_max_map_count;#include <linux/aio.h>extern unsigned longarch_get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);extern unsigned longarch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags);extern void arch_unmap_area(struct vm_area_struct *area);extern void arch_unmap_area_topdown(struct vm_area_struct *area);struct mm_struct { struct vm_area_struct * mmap; /* list of VMAs */ struct rb_root mm_rb; struct vm_area_struct * mmap_cache; /* last find_vma result */ unsigned long (*get_unmapped_area) (struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); void (*unmap_area) (struct vm_area_struct *area); unsigned long mmap_base; /* base of mmap area */ unsigned long free_area_cache; /* first hole */ pgd_t * pgd; atomic_t mm_users; /* How many users with user space? */ atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ int map_count; /* number of VMAs */ struct rw_semaphore mmap_sem; spinlock_t page_table_lock; /* Protects task page tables and mm->rss */ struct list_head mmlist; /* List of all active mm's. These are globally strung * together off init_mm.mmlist, and are protected * by mmlist_lock */ unsigned long start_code, end_code, start_data, end_data; unsigned long start_brk, brk, start_stack; unsigned long arg_start, arg_end, env_start, env_end; unsigned long rss, total_vm, locked_vm, shared_vm; unsigned long exec_vm, stack_vm, reserved_vm, def_flags; unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ unsigned dumpable:1; cpumask_t cpu_vm_mask; /* Architecture-specific MM context */ mm_context_t context; /* Token based thrashing protection. */ unsigned long swap_token_time; char recent_pagein; /* coredumping support */ int core_waiters; struct completion *core_startup_done, core_done; /* aio bits */ rwlock_t ioctx_list_lock; struct kioctx *ioctx_list; struct kioctx default_kioctx;};extern int mmlist_nr;struct sighand_struct { atomic_t count; struct k_sigaction action[_NSIG]; spinlock_t siglock;};/* * NOTE! "signal_struct" does not have it's own * locking, because a shared signal_struct always * implies a shared sighand_struct, so locking * sighand_struct is always a proper superset of * the locking of signal_struct. */struct signal_struct { atomic_t count; /* current thread group signal load-balancing target: */ task_t *curr_target; /* shared signal handling: */ struct sigpending shared_pending; /* thread group exit support */ int group_exit; int group_exit_code; /* overloaded: * - notify group_exit_task when ->count is equal to notify_count * - everyone except group_exit_task is stopped during signal delivery * of fatal signals, group_exit_task processes the signal. */ struct task_struct *group_exit_task; int notify_count; /* thread group stop support, overloads group_exit_code too */ int group_stop_count; /* 1 if group stopped since last SIGCONT, -1 if SIGCONT since report */ int stop_state; /* POSIX.1b Interval Timers */ struct list_head posix_timers; /* job control IDs */ pid_t pgrp; pid_t tty_old_pgrp; pid_t session; /* boolean value for session group leader */ int leader; struct tty_struct *tty; /* NULL if no tty */ /* * Cumulative resource counters for dead threads in the group, * and for reaped dead child processes forked by this group. * Live threads maintain their own counters and add to these * in __exit_signal, except for the group leader. */ unsigned long utime, stime, cutime, cstime; unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;};/* * Priority of a process goes from 0..MAX_PRIO-1, valid RT * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values * are inverted: lower p->prio value means higher priority. * * The MAX_USER_RT_PRIO value allows the actual maximum * RT priority to be separate from the value exported to * user-space. This allows kernel threads to set their * priority to a value higher than any user task. Note: * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO. */#define MAX_USER_RT_PRIO 100#define MAX_RT_PRIO MAX_USER_RT_PRIO#define MAX_PRIO (MAX_RT_PRIO + 40)#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO))/* * Some day this will be a full-fledged user tracking system.. */struct user_struct { atomic_t __count; /* reference count */ atomic_t processes; /* How many processes does this user have? */ atomic_t files; /* How many open files does this user have? */ atomic_t sigpending; /* How many pending signals does this user have? */ /* protected by mq_lock */ unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?