Print this page
patch fix-compile
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/disp/sysclass.c
+++ new/usr/src/uts/common/disp/sysclass.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 28 /* All Rights Reserved */
29 29
30 30 #pragma ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 1.12 */
31 31
32 32 #include <sys/types.h>
33 33 #include <sys/param.h>
34 34 #include <sys/sysmacros.h>
35 35 #include <sys/signal.h>
36 36 #include <sys/pcb.h>
37 37 #include <sys/user.h>
38 38 #include <sys/systm.h>
39 39 #include <sys/sysinfo.h>
40 40 #include <sys/var.h>
41 41 #include <sys/errno.h>
42 42 #include <sys/cmn_err.h>
43 43 #include <sys/proc.h>
44 44 #include <sys/debug.h>
45 45 #include <sys/inline.h>
46 46 #include <sys/disp.h>
47 47 #include <sys/class.h>
48 48 #include <sys/kmem.h>
49 49 #include <sys/cpuvar.h>
50 50 #include <sys/priocntl.h>
51 51
52 52 /*
53 53 * Class specific code for the sys class. There are no
54 54 * class specific data structures associated with
55 55 * the sys class and the scheduling policy is trivially
56 56 * simple. There is no time slicing.
57 57 */
58 58
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
59 59 pri_t sys_init(id_t, int, classfuncs_t **);
60 60 static int sys_getclpri(pcpri_t *);
61 61 static int sys_fork(kthread_t *, kthread_t *, void *);
62 62 static int sys_enterclass(kthread_t *, id_t, void *, cred_t *, void *);
63 63 static int sys_canexit(kthread_t *, cred_t *);
64 64 static int sys_nosys();
65 65 static int sys_donice(kthread_t *, cred_t *, int, int *);
66 66 static int sys_doprio(kthread_t *, cred_t *, int, int *);
67 67 static void sys_forkret(kthread_t *, kthread_t *);
68 68 static void sys_nullsys();
69 -static pri_t sys_swappri(kthread_t *, int);
70 69 static int sys_alloc(void **, int);
71 70
72 71 struct classfuncs sys_classfuncs = {
73 72 /* messages to class manager */
74 73 {
75 74 sys_nosys, /* admin */
76 75 sys_nosys, /* getclinfo */
77 76 sys_nosys, /* parmsin */
78 77 sys_nosys, /* parmsout */
79 78 sys_nosys, /* vaparmsin */
80 79 sys_nosys, /* vaparmsout */
81 80 sys_getclpri, /* getclpri */
82 81 sys_alloc,
83 82 sys_nullsys, /* free */
84 83 },
85 84 /* operations on threads */
86 85 {
87 86 sys_enterclass, /* enterclass */
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
88 87 sys_nullsys, /* exitclass */
89 88 sys_canexit,
90 89 sys_fork,
91 90 sys_forkret, /* forkret */
92 91 sys_nullsys, /* parmsget */
93 92 sys_nosys, /* parmsset */
94 93 sys_nullsys, /* stop */
95 94 sys_nullsys, /* exit */
96 95 sys_nullsys, /* active */
97 96 sys_nullsys, /* inactive */
98 - sys_swappri, /* swapin */
99 - sys_swappri, /* swapout */
100 97 sys_nullsys, /* trapret */
101 98 setfrontdq, /* preempt */
102 99 setbackdq, /* setrun */
103 100 sys_nullsys, /* sleep */
104 101 sys_nullsys, /* tick */
105 102 setbackdq, /* wakeup */
106 103 sys_donice,
107 104 (pri_t (*)())sys_nosys, /* globpri */
108 105 sys_nullsys, /* set_process_group */
109 106 sys_nullsys, /* yield */
110 107 sys_doprio,
111 108 }
112 109
113 110 };
114 111
115 112
116 113 /* ARGSUSED */
117 114 pri_t
118 115 sys_init(cid, clparmsz, clfuncspp)
119 116 id_t cid;
120 117 int clparmsz;
121 118 classfuncs_t **clfuncspp;
122 119 {
123 120 *clfuncspp = &sys_classfuncs;
124 121 return ((pri_t)v.v_maxsyspri);
125 122 }
126 123
127 124 /*
128 125 * Get maximum and minimum priorities enjoyed by sysclass threads
129 126 */
130 127 static int
131 128 sys_getclpri(pcpri_t *pcprip)
132 129 {
133 130 pcprip->pc_clpmax = maxclsyspri;
134 131 pcprip->pc_clpmin = minclsyspri;
135 132 return (0);
136 133 }
137 134
138 135 /* ARGSUSED */
139 136 static int
140 137 sys_enterclass(t, cid, parmsp, reqpcredp, bufp)
141 138 kthread_t *t;
142 139 id_t cid;
143 140 void *parmsp;
144 141 cred_t *reqpcredp;
145 142 void *bufp;
146 143 {
147 144 return (0);
148 145 }
149 146
150 147 /* ARGSUSED */
151 148 static int
152 149 sys_canexit(kthread_t *t, cred_t *reqpcredp)
153 150 {
154 151 return (0);
155 152 }
156 153
157 154 /* ARGSUSED */
158 155 static int
159 156 sys_fork(t, ct, bufp)
160 157 kthread_t *t;
161 158 kthread_t *ct;
162 159 void *bufp;
163 160 {
164 161 /*
165 162 * No class specific data structure
166 163 */
167 164 return (0);
168 165 }
169 166
170 167
171 168 /* ARGSUSED */
172 169 static void
173 170 sys_forkret(t, ct)
174 171 kthread_t *t;
175 172 kthread_t *ct;
176 173 {
177 174 register proc_t *pp = ttoproc(t);
178 175 register proc_t *cp = ttoproc(ct);
179 176
180 177 ASSERT(t == curthread);
181 178 ASSERT(MUTEX_HELD(&pidlock));
182 179
183 180 /*
184 181 * Grab the child's p_lock before dropping pidlock to ensure
185 182 * the process does not disappear before we set it running.
186 183 */
↓ open down ↓ |
77 lines elided |
↑ open up ↑ |
187 184 mutex_enter(&cp->p_lock);
188 185 mutex_exit(&pidlock);
189 186 continuelwps(cp);
190 187 mutex_exit(&cp->p_lock);
191 188
192 189 mutex_enter(&pp->p_lock);
193 190 continuelwps(pp);
194 191 mutex_exit(&pp->p_lock);
195 192 }
196 193
197 -/* ARGSUSED */
198 -static pri_t
199 -sys_swappri(t, flags)
200 - kthread_t *t;
201 - int flags;
202 -{
203 - return (-1);
204 -}
205 -
206 194 static int
207 195 sys_nosys()
208 196 {
209 197 return (ENOSYS);
210 198 }
211 199
212 200
213 201 static void
214 202 sys_nullsys()
215 203 {
216 204 }
217 205
218 206 /* ARGSUSED */
219 207 static int
220 208 sys_donice(kthread_t *t, cred_t *cr, int incr, int *retvalp)
221 209 {
222 210 return (EINVAL);
223 211 }
224 212
225 213 /* ARGSUSED */
226 214 static int
227 215 sys_doprio(kthread_t *t, cred_t *cr, int incr, int *retvalp)
228 216 {
229 217 return (EINVAL);
230 218 }
231 219
232 220 /* ARGSUSED */
233 221 static int
234 222 sys_alloc(void **p, int flag)
235 223 {
236 224 *p = NULL;
237 225 return (0);
238 226 }
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX