132
|
1 /**
|
|
2 * D header file for POSIX.
|
|
3 *
|
|
4 * Copyright: Public Domain
|
|
5 * License: Public Domain
|
|
6 * Authors: Sean Kelly
|
|
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
|
|
8 */
|
|
9 module tango.stdc.posix.sched;
|
|
10
|
|
11 public import tango.stdc.posix.time;
|
|
12 public import tango.stdc.posix.sys.types;
|
|
13
|
|
14 extern (C):
|
|
15
|
|
16 //
|
|
17 // Required
|
|
18 //
|
|
19 /*
|
|
20 struct sched_param
|
|
21 {
|
|
22 int sched_priority (THR)
|
|
23 int sched_ss_low_priority (SS|TSP)
|
|
24 struct timespec sched_ss_repl_period (SS|TSP)
|
|
25 struct timespec sched_ss_init_budget (SS|TSP)
|
|
26 int sched_ss_max_repl (SS|TSP)
|
|
27 }
|
|
28
|
|
29 SCHED_FIFO
|
|
30 SCHED_RR
|
|
31 SCHED_SPORADIC (SS|TSP)
|
|
32 SCHED_OTHER
|
|
33
|
|
34 int sched_getparam(pid_t, sched_param*);
|
|
35 int sched_getscheduler(pid_t);
|
|
36 int sched_setparam(pid_t, sched_param*);
|
|
37 int sched_setscheduler(pid_t, int, sched_param*);
|
|
38 */
|
|
39
|
|
40 version( linux )
|
|
41 {
|
|
42 struct sched_param
|
|
43 {
|
|
44 int sched_priority;
|
|
45 }
|
|
46
|
|
47 const SCHED_OTHER = 0;
|
|
48 const SCHED_FIFO = 1;
|
|
49 const SCHED_RR = 2;
|
|
50 //SCHED_SPORADIC (SS|TSP)
|
|
51 }
|
|
52 else version( darwin )
|
|
53 {
|
|
54 const SCHED_OTHER = 1;
|
|
55 const SCHED_FIFO = 4;
|
|
56 const SCHED_RR = 2;
|
|
57 // SCHED_SPORADIC seems to be unavailable
|
|
58
|
|
59 private const __SCHED_PARAM_SIZE__ = 4;
|
|
60
|
|
61 struct sched_param
|
|
62 {
|
|
63 int sched_priority;
|
|
64 byte[__SCHED_PARAM_SIZE__] opaque;
|
|
65 }
|
|
66 }
|
|
67
|
|
68 int sched_getparam(pid_t, sched_param*);
|
|
69 int sched_getscheduler(pid_t);
|
|
70 int sched_setparam(pid_t, sched_param*);
|
|
71 int sched_setscheduler(pid_t, int, sched_param*);
|
|
72
|
|
73 //
|
|
74 // Thread (THR)
|
|
75 //
|
|
76 /*
|
|
77 int sched_yield();
|
|
78 */
|
|
79
|
|
80 version( linux )
|
|
81 {
|
|
82 int sched_yield();
|
|
83 }
|
|
84 else version( darwin )
|
|
85 {
|
|
86 int sched_yield();
|
|
87 }
|
|
88
|
|
89 //
|
|
90 // Scheduling (TPS)
|
|
91 //
|
|
92 /*
|
|
93 int sched_get_priority_max(int);
|
|
94 int sched_get_priority_min(int);
|
|
95 int sched_rr_get_interval(pid_t, timespec*);
|
|
96 */
|
|
97
|
|
98 version( linux )
|
|
99 {
|
|
100 int sched_get_priority_max(int);
|
|
101 int sched_get_priority_min(int);
|
|
102 int sched_rr_get_interval(pid_t, timespec*);
|
|
103 }
|
|
104 else version( darwin )
|
|
105 {
|
|
106 int sched_get_priority_min(int);
|
|
107 int sched_get_priority_max(int);
|
|
108 //int sched_rr_get_interval(pid_t, timespec*); // FIXME: unavailable?
|
|
109 }
|