Bring in fixes for a bug which occurs when the filesystem become fulls.
[dragonfly.git] / sys / sys / usched.h
blob6e1e543c717788651a7396588aedb906ab79dee3
1 /*
2 * SYS/USCHED.H
4 * Userland scheduler API
5 *
6 * $DragonFly: src/sys/sys/usched.h,v 1.15 2008/04/21 15:24:47 dillon Exp $
7 */
9 #ifndef _SYS_USCHED_H_
10 #define _SYS_USCHED_H_
12 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
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
24 #define NAME_LENGTH 32
26 struct lwp;
27 struct proc;
28 struct globaldata;
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 (*setrunqueue)(struct lwp *);
39 void (*schedulerclock)(struct lwp *, sysclock_t, sysclock_t);
40 void (*recalculate)(struct lwp *);
41 void (*resetpriority)(struct lwp *);
42 void (*heuristic_forking)(struct lwp *, struct lwp *);
43 void (*heuristic_exiting)(struct lwp *, struct lwp *);
44 void (*setcpumask)(struct usched *, cpumask_t);
45 void (*yield)(struct lwp *);
48 union usched_data {
50 * BSD4 scheduler.
52 struct {
53 short priority; /* lower is better */
54 char unused01; /* (currently not used) */
55 char rqindex;
56 int origcpu;
57 int estcpu; /* dynamic priority modification */
58 u_short rqtype; /* protected copy of rtprio type */
59 u_short unused02;
60 } bsd4;
62 int pad[4]; /* PAD for future expansion */
66 * Flags for usched_ctl()
68 #define USCH_ADD 0x00000001
69 #define USCH_REM 0x00000010
71 #endif /* _KERNEL || _KERNEL_STRUCTURES */
73 #define USCHED_SET_SCHEDULER 0
74 #define USCHED_SET_CPU 1
75 #define USCHED_ADD_CPU 2
76 #define USCHED_DEL_CPU 3
79 * Kernel variables and procedures, or user system calls.
81 #ifdef _KERNEL
83 extern struct usched usched_bsd4;
84 extern struct usched usched_dummy;
85 extern cpumask_t usched_mastermask;
87 int usched_ctl(struct usched *, int);
88 struct usched *usched_init(void);
90 #endif
92 #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
94 int usched_set(pid_t, int, void *, int);
96 #endif
98 #endif