sched.h File Reference

#include <linux/tasks.h>
#include <asm/system.h>
#include <linux/head.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/signal.h>
#include <linux/time.h>
#include <linux/param.h>
#include <linux/resource.h>
#include <linux/vm86.h>
#include <linux/math_emu.h>

Go to the source code of this file.

Data Structures

struct  i387_hard_struct
struct  i387_soft_struct
union  i387_union
struct  tss_struct
struct  task_struct

Defines

#define NEW_SWAP
#define HZ   100
#define MCA_bus   0
#define TASK_SIZE   0xc0000000
#define IO_BITMAP_SIZE   32
#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)
#define CT_TO_SECS(x)   ((x) / HZ)
#define CT_TO_USECS(x)   (((x) % HZ) * 1000000/HZ)
#define FIRST_TASK   task[0]
#define LAST_TASK   task[NR_TASKS-1]
#define TASK_RUNNING   0
#define TASK_INTERRUPTIBLE   1
#define TASK_UNINTERRUPTIBLE   2
#define TASK_ZOMBIE   3
#define TASK_STOPPED   4
#define TASK_SWAPPING   5
#define PF_ALIGNWARN   0x00000001
#define PF_PTRACED   0x00000010
 Not implemented yet, only for 486 set if ptrace (0) has been called.
#define PF_TRACESYS   0x00000020
 tracing system calls
#define CSIGNAL   0x000000ff
 signal mask to be sent at exit
#define COPYVM   0x00000100
 set if VM copy desired (like normal fork())
#define COPYFD   0x00000200
 set if fd's should be copied, not shared (NI)
#define INIT_TASK
#define CURRENT_TIME   (xtime.tv_sec)
#define FIRST_TSS_ENTRY   8
#define FIRST_LDT_ENTRY   (FIRST_TSS_ENTRY+1)
#define _TSS(n)   ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
#define _LDT(n)   ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))
#define store_TR(n)
#define switch_to(tsk)
#define _set_base(addr, base)
#define _set_limit(addr, limit)
#define set_base(ldt, base)   _set_base( ((char *)&(ldt)) , base )
#define set_limit(ldt, limit)   _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )
#define get_base(ldt)   _get_base( ((char *)&(ldt)) )
#define REMOVE_LINKS(p)
#define SET_LINKS(p)
#define for_each_task(p)   for (p = &init_task ; (p = p->next_task) != &init_task ; )
#define loaddebug(register)
 This special macro can be used to load a debugging register.

Functions

void sleep_on (struct wait_queue **p)
void interruptible_sleep_on (struct wait_queue **p)
void wake_up (struct wait_queue **p)
void wake_up_interruptible (struct wait_queue **p)
void notify_parent (struct task_struct *tsk)
int send_sig (unsigned long sig, struct task_struct *p, int priv)
int in_group_p (gid_t grp)
int request_irq (unsigned int irq, void(*handler)(int))
void free_irq (unsigned int irq)
int irqaction (unsigned int irq, struct sigaction *sa)
 c (tsk)
void remove_wait_queue (struct wait_queue **p, struct wait_queue *wait)
void select_wait (struct wait_queue **wait_address, select_table *p)
void __down (struct semaphore *sem)
void down (struct semaphore *sem)
void up (struct semaphore *sem)
static unsigned long _get_base (char *addr)
static unsigned long get_limit (unsigned long segment)

Variables

int hard_math
int x86
int ignore_irq13
int wp_works_ok
int EISA_bus
unsigned long avenrun []
 Load averages.
task_structtask [NR_TASKS]
task_structlast_task_used_math
task_structcurrent
unsigned long volatile jiffies
unsigned long itimer_ticks
unsigned long itimer_next
timeval xtime
int need_resched
desc_struct default_ldt


Define Documentation

#define _LDT ( n   )     ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))

Definition at line 442 of file sched.h.

#define _set_base ( addr,
base   ) 

Value:

__asm__("movw %%dx,%0\n\t" \
        "rorl $16,%%edx\n\t" \
        "movb %%dl,%1\n\t" \
        "movb %%dh,%2" \

#define _set_limit ( addr,
limit   ) 

Value:

__asm__("movw %%dx,%0\n\t" \
        "rorl $16,%%edx\n\t" \
        "movb %1,%%dh\n\t" \
        "andb $0xf0,%%dh\n\t" \
        "orb %%dh,%%dl\n\t" \
        "movb %%dl,%1" \

Referenced by c().

#define _TSS ( n   )     ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))

Definition at line 441 of file sched.h.

#define CALC_LOAD ( load,
exp,
n   ) 

Value:

load *= exp; \
        load += n*(FIXED_1-exp); \
        load >>= FSHIFT;

Definition at line 88 of file sched.h.

#define COPYFD   0x00000200

set if fd's should be copied, not shared (NI)

Definition at line 295 of file sched.h.

#define COPYVM   0x00000100

set if VM copy desired (like normal fork())

Definition at line 294 of file sched.h.

#define CSIGNAL   0x000000ff

signal mask to be sent at exit

cloning flags:

Definition at line 293 of file sched.h.

#define CT_TO_SECS (  )     ((x) / HZ)

Definition at line 93 of file sched.h.

#define CT_TO_USECS (  )     (((x) % HZ) * 1000000/HZ)

Definition at line 94 of file sched.h.

#define CURRENT_TIME   (xtime.tv_sec)

Definition at line 407 of file sched.h.

#define EXP_1   1884

1/exp(5sec/1min) as fixed-point

Definition at line 84 of file sched.h.

#define EXP_15   2037

1/exp(5sec/15min)

Definition at line 86 of file sched.h.

#define EXP_5   2014

1/exp(5sec/5min)

Definition at line 85 of file sched.h.

#define FIRST_LDT_ENTRY   (FIRST_TSS_ENTRY+1)

Definition at line 440 of file sched.h.

#define FIRST_TASK   task[0]

Definition at line 96 of file sched.h.

#define FIRST_TSS_ENTRY   8

Entry into gdt where to find first TSS. GDT layout: 0 - nul 1 - kernel code segment 2 - kernel data segment 3 - user code segment 4 - user data segment ... 8 - TSS #0 9 - LDT #0 10 - TSS #1 11 - LDT #1

Definition at line 439 of file sched.h.

#define FIXED_1   (1<<FSHIFT)

1.0 as fixed-point

Definition at line 82 of file sched.h.

#define for_each_task (  )     for (p = &init_task ; (p = p->next_task) != &init_task ; )

Definition at line 668 of file sched.h.

#define FSHIFT   11

nr of bits of precision

Definition at line 81 of file sched.h.

#define get_base ( ldt   )     _get_base( ((char *)&(ldt)) )

Definition at line 632 of file sched.h.

#define HZ   100

define DEBUG if you want the wait-queues to have some extra debugging code. It's not normally used, but might catch some wait-queue coding errors.

define DEBUG

Definition at line 18 of file sched.h.

#define INIT_TASK

INIT_TASK is used to set up the first task table, touch at your own risk!. Base=0, limit=0x1fffff (=2MB)

Definition at line 305 of file sched.h.

#define IO_BITMAP_SIZE   32

Size of io_bitmap in longwords: 32 is ports 0-0x3ff.

Definition at line 63 of file sched.h.

#define LAST_TASK   task[NR_TASKS-1]

Definition at line 97 of file sched.h.

#define LOAD_FREQ   (5*HZ)

5 sec intervals

Definition at line 83 of file sched.h.

#define loaddebug ( register   ) 

Value:

__asm__("movl %0,%%edx\n\t" \
                        "movl %%edx,%%db" #register "\n\t" \
This special macro can be used to load a debugging register.

Definition at line 683 of file sched.h.

#define MCA_bus   0

Definition at line 41 of file sched.h.

#define NEW_SWAP

Definition at line 4 of file sched.h.

#define PF_ALIGNWARN   0x00000001

Per process flags Print alignment warning msgs

Definition at line 281 of file sched.h.

#define PF_PTRACED   0x00000010

Not implemented yet, only for 486 set if ptrace (0) has been called.

Definition at line 283 of file sched.h.

#define PF_TRACESYS   0x00000020

tracing system calls

Definition at line 284 of file sched.h.

#define REMOVE_LINKS (  ) 

Value:

do { unsigned long flags; \
        save_flags(flags) ; cli(); \
        (p)->next_task->prev_task = (p)->prev_task; \
        (p)->prev_task->next_task = (p)->next_task; \
        restore_flags(flags); \
        if ((p)->p_osptr) \
                (p)->p_osptr->p_ysptr = (p)->p_ysptr; \
        if ((p)->p_ysptr) \
                (p)->p_ysptr->p_osptr = (p)->p_osptr; \
        else \
                (p)->p_pptr->p_cptr = (p)->p_osptr; \
        } while (0)

Definition at line 642 of file sched.h.

#define set_base ( ldt,
base   )     _set_base( ((char *)&(ldt)) , base )

#define set_limit ( ldt,
limit   )     _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )

#define SET_LINKS (  ) 

Value:

do { unsigned long flags; \
        save_flags(flags); cli(); \
        (p)->next_task = &init_task; \
        (p)->prev_task = init_task.prev_task; \
        init_task.prev_task->next_task = (p); \
        init_task.prev_task = (p); \
        restore_flags(flags); \
        (p)->p_ysptr = NULL; \
        if (((p)->p_osptr = (p)->p_pptr->p_cptr) != NULL) \
                (p)->p_osptr->p_ysptr = p; \
        (p)->p_pptr->p_cptr = p; \
        } while (0)

Definition at line 655 of file sched.h.

#define store_TR ( n   ) 

Value:

__asm__("str %%ax\n\t" \
        "subl %2,%%eax\n\t" \
        "shrl $4,%%eax" \
        :"=a" (n) \
        :"0" (0),"i" (FIRST_TSS_ENTRY<<3))

#define switch_to ( tsk   ) 

Value:

__asm__("cmpl %%ecx,_current\n\t" \
        "je 1f\n\t" \
        "cli\n\t" \
        "xchgl %%ecx,_current\n\t" \
        "ljmp %0\n\t" \
        "sti\n\t" \
        "cmpl %%ecx,_last_task_used_math\n\t" \
        "jne 1f\n\t" \
        "clts\n" \
        "1:" \

#define TASK_INTERRUPTIBLE   1

Definition at line 110 of file sched.h.

#define TASK_RUNNING   0

Definition at line 109 of file sched.h.

#define TASK_SIZE   0xc0000000

User space process size: 3GB. This is hardcoded into a few places, so don't change it unless you know what you are doing.

Definition at line 54 of file sched.h.

Referenced by verify_area().

#define TASK_STOPPED   4

Definition at line 113 of file sched.h.

#define TASK_SWAPPING   5

Definition at line 114 of file sched.h.

#define TASK_UNINTERRUPTIBLE   2

Definition at line 111 of file sched.h.

#define TASK_ZOMBIE   3

Definition at line 112 of file sched.h.


Function Documentation

void __down ( struct semaphore sem  ) 

Referenced by down().

static unsigned long _get_base ( char *  addr  )  [inline, static]

Definition at line 618 of file sched.h.

c ( tsk   ) 

The wait-queues are circular lists, and you have to be *very* sure to keep them correct. Use only these two functions to add/remove entries in the queues.

Definition at line 480 of file sched.h.

References _set_limit, cli, wait_queue::next, restore_flags, and save_flags.

void down ( struct semaphore sem  )  [inline]

Definition at line 605 of file sched.h.

References __down(), and semaphore::count.

void free_irq ( unsigned int  irq  ) 

static unsigned long get_limit ( unsigned long  segment  )  [inline, static]

Definition at line 634 of file sched.h.

int in_group_p ( gid_t  grp  ) 

void interruptible_sleep_on ( struct wait_queue **  p  ) 

int irqaction ( unsigned int  irq,
struct sigaction sa 
)

void notify_parent ( struct task_struct tsk  ) 

void remove_wait_queue ( struct wait_queue **  p,
struct wait_queue wait 
) [inline]

Definition at line 548 of file sched.h.

References cli, wait_queue::next, NULL, restore_flags, and save_flags.

int request_irq ( unsigned int  irq,
void(*)(int)  handler 
)

void select_wait ( struct wait_queue **  wait_address,
select_table p 
) [inline]

Definition at line 587 of file sched.h.

References __MAX_SELECT_TABLE_ENTRIES, select_table_struct::entry, wait_queue::next, select_table_struct::nr, NULL, wait_queue::task, select_table_entry::wait, and select_table_entry::wait_address.

int send_sig ( unsigned long  sig,
struct task_struct p,
int  priv 
)

void sleep_on ( struct wait_queue **  p  ) 

void up ( struct semaphore sem  )  [inline]

Definition at line 612 of file sched.h.

References semaphore::count, semaphore::wait, and wake_up().

void wake_up ( struct wait_queue **  p  ) 

Referenced by coh_unlock_inode(), unlock_buffer(), unlock_super(), and up().

void wake_up_interruptible ( struct wait_queue **  p  ) 


Variable Documentation

unsigned long avenrun[]

Load averages.

These are the constant used to fake the fixed-point load-average counting. Some notes:

struct task_struct* current

struct desc_struct default_ldt

This is the ldt that every process will get unless we need something other than this.

int EISA_bus

Bus types (default is ISA, but people can check others with these..) MCA_bus hardcoded to 0 for now.

int hard_math

System setup flags..

int ignore_irq13

unsigned long itimer_next

unsigned long itimer_ticks

unsigned long volatile jiffies

struct task_struct* last_task_used_math

int need_resched

struct task_struct* task[NR_TASKS]

int wp_works_ok

Referenced by verify_area().

int x86

struct timeval xtime


Generated on Mon May 1 21:47:01 2006 for KernelAPI by  doxygen 1.4.6-5