I'm growing tired of having to add #include lines for header files that
[dragonfly.git] / sys / sys / usched.h
1 /*
2  * SYS/USCHED.H
3  *
4  *      Userland scheduler API
5  * 
6  * $DragonFly: src/sys/sys/usched.h,v 1.9 2006/05/20 02:42:13 dillon Exp $
7  */
8
9 #ifndef _SYS_USCHED_H_
10 #define _SYS_USCHED_H_
11
12 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
13
14 #ifndef _SYS_TYPES_H_
15 #include <sys/types.h>
16 #endif
17 #ifndef _SYS_QUEUE_H_
18 #include <sys/queue.h>
19 #endif
20 #ifndef _SYS_SYSTIMER_H_
21 #include <sys/systimer.h>
22 #endif
23
24 #define NAME_LENGTH 32
25
26 struct lwp;
27 struct proc;
28 struct globaldata;
29
30 struct usched {
31     TAILQ_ENTRY(usched) entry;
32     const char *name;
33     const char *desc;
34     void (*usched_register)(void);
35     void (*usched_unregister)(void);
36     void (*acquire_curproc)(struct lwp *);
37     void (*release_curproc)(struct lwp *);
38     void (*select_curproc)(struct globaldata *);
39     void (*setrunqueue)(struct lwp *);
40     void (*remrunqueue)(struct lwp *);
41     void (*schedulerclock)(struct lwp *, sysclock_t, sysclock_t);
42     void (*recalculate)(struct lwp *);
43     void (*resetpriority)(struct lwp *);
44     void (*heuristic_forking)(struct lwp *, struct lwp *);
45     void (*heuristic_exiting)(struct lwp *, struct lwp *);
46     void (*setcpumask)(struct usched *, cpumask_t);
47 };
48
49 union usched_data {
50     /*
51      * BSD4 scheduler. 
52      */
53     struct {
54         short   priority;       /* lower is better */
55         char    interactive;    /* (currently not used) */
56         char    rqindex;
57         int     origcpu;
58         int     estcpu;         /* dynamic priority modification */
59     } bsd4;
60
61     int         pad[4];         /* PAD for future expansion */
62 };
63
64 /*
65  * Flags for usched_ctl()
66  */
67 #define        USCH_ADD        0x00000001
68 #define        USCH_REM        0x00000010
69
70 #endif  /* _KERNEL || _KERNEL_STRUCTURES */
71
72 /*
73  * Kernel variables and procedures, or user system calls.
74  */
75 #ifdef _KERNEL
76
77 extern struct usched    usched_bsd4;
78
79 int usched_ctl(struct usched *, int);
80 struct usched *usched_init(void);
81
82 #else
83
84 int usched_set(const char *, int);
85
86 #endif
87
88 #endif
89