Print this page
6583 remove whole-process swapping
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/systm.h
+++ new/usr/src/uts/common/sys/systm.h
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 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 22 /* All Rights Reserved */
23 23
24 24
25 25 /*
26 26 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 30 #ifndef _SYS_SYSTM_H
31 31 #define _SYS_SYSTM_H
32 32
33 33 #include <sys/types.h>
34 34 #include <sys/t_lock.h>
35 35 #include <sys/proc.h>
36 36 #include <sys/dditypes.h>
37 37
38 38 #ifdef __cplusplus
39 39 extern "C" {
40 40 #endif
41 41
42 42 /*
43 43 * The pc_t is the type of the kernel's program counter. In general, a
44 44 * pc_t is a uintptr_t -- except for a sparcv9 kernel, in which case all
45 45 * instruction text is below 4G, and a pc_t is thus a uint32_t.
46 46 */
47 47 #ifdef __sparcv9
48 48 typedef uint32_t pc_t;
49 49 #else
50 50 typedef uintptr_t pc_t;
51 51 #endif
52 52
53 53 /*
54 54 * Random set of variables used by more than one routine.
55 55 */
56 56
↓ open down ↓ |
56 lines elided |
↑ open up ↑ |
57 57 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
58 58 #include <sys/types32.h>
59 59 #include <sys/varargs.h>
60 60 #include <sys/uadmin.h>
61 61
62 62 extern int hz; /* system clock rate */
63 63 extern struct vnode *rootdir; /* pointer to vnode of root directory */
64 64 extern struct vnode *devicesdir; /* pointer to /devices vnode */
65 65 extern int interrupts_unleashed; /* set after the spl0() in main() */
66 66
67 -extern char runin; /* scheduling flag */
68 -extern char runout; /* scheduling flag */
69 -extern char wake_sched; /* causes clock to wake swapper on next tick */
70 -extern char wake_sched_sec; /* causes clock to wake swapper after a sec */
71 -
72 67 extern pgcnt_t maxmem; /* max available memory (pages) */
73 68 extern pgcnt_t physmem; /* physical memory (pages) on this CPU */
74 69 extern pfn_t physmax; /* highest numbered physical page present */
75 70 extern pgcnt_t physinstalled; /* physical pages including PROM/boot use */
76 71
77 72 extern caddr_t s_text; /* start of kernel text segment */
78 73 extern caddr_t e_text; /* end of kernel text segment */
79 74 extern caddr_t s_data; /* start of kernel text segment */
80 75 extern caddr_t e_data; /* end of kernel text segment */
81 76
82 77 extern pgcnt_t availrmem; /* Available resident (not swapable) */
83 78 /* memory in pages. */
84 79 extern pgcnt_t availrmem_initial; /* initial value of availrmem */
85 80 extern pgcnt_t segspt_minfree; /* low water mark for availrmem in seg_spt */
86 81 extern pgcnt_t freemem; /* Current free memory. */
87 82
88 83 extern dev_t rootdev; /* device of the root */
89 84 extern struct vnode *rootvp; /* vnode of root device */
90 85 extern boolean_t root_is_svm; /* root is a mirrored device flag */
91 86 extern boolean_t root_is_ramdisk; /* root is boot_archive ramdisk */
92 87 extern uint32_t ramdisk_size; /* (KB) set only for sparc netboots */
93 88 extern char *volatile panicstr; /* panic string pointer */
94 89 extern va_list panicargs; /* panic arguments */
95 90 extern volatile int quiesce_active; /* quiesce(9E) is in progress */
96 91
97 92 extern int rstchown; /* 1 ==> restrictive chown(2) semantics */
98 93 extern int klustsize;
99 94
100 95 extern int abort_enable; /* Platform input-device abort policy */
101 96
102 97 extern int audit_active; /* Solaris Auditing module state */
103 98
104 99 extern int avenrun[]; /* array of load averages */
105 100
106 101 extern char *isa_list; /* For sysinfo's isalist option */
107 102
108 103 extern int noexec_user_stack; /* patchable via /etc/system */
109 104 extern int noexec_user_stack_log; /* patchable via /etc/system */
110 105
111 106 /*
112 107 * Use NFS client operations in the global zone only. Under contract with
113 108 * admin/install; do not change without coordinating with that consolidation.
114 109 */
115 110 extern int nfs_global_client_only;
116 111
117 112 extern void report_stack_exec(proc_t *, caddr_t);
118 113
119 114 extern void startup(void);
120 115 extern void clkstart(void);
121 116 extern void post_startup(void);
122 117 extern void kern_setup1(void);
123 118 extern void ka_init(void);
124 119 extern void nodename_set(void);
125 120
126 121 /*
127 122 * for tod fault detection
128 123 */
129 124 enum tod_fault_type {
130 125 TOD_REVERSED = 0,
131 126 TOD_STALLED,
132 127 TOD_JUMPED,
133 128 TOD_RATECHANGED,
134 129 TOD_RDONLY,
135 130 TOD_NOFAULT
136 131 };
137 132
138 133 #define TOD_GET_FAILED 0x1 /* TOD could not be read */
139 134 #define TOD_SET_DONE 0x2 /* TOD has been modified */
140 135 #define TOD_CPR_RESUME_DONE 0x4 /* CPR resume has occurred */
141 136 #define TOD_DR_RESUME_DONE 0x8 /* DR resume has occurred */
142 137
143 138 extern time_t tod_validate(time_t);
144 139 extern void tod_status_set(int);
145 140 extern void tod_status_clear(int);
146 141 extern void plat_tod_fault(enum tod_fault_type);
147 142
148 143 #ifndef _LP64
149 144 #ifndef min
150 145 int min(int, int);
151 146 #endif
152 147
153 148 #ifndef max
154 149 int max(int, int);
155 150 #endif
156 151
157 152 uint_t umin(uint_t, uint_t);
158 153 uint_t umax(uint_t, uint_t);
159 154 #endif /* !_LP64 */
160 155 int grow(caddr_t);
161 156 int grow_internal(caddr_t, uint_t);
162 157 int brk_internal(caddr_t, uint_t);
163 158 typedef uint64_t callout_id_t;
164 159 timeout_id_t timeout(void (*)(void *), void *, clock_t);
165 160 timeout_id_t realtime_timeout(void (*)(void *), void *, clock_t);
166 161 clock_t untimeout(timeout_id_t);
167 162 /*
168 163 * The last argument to timeout_generic() is flags. See callo.h for the
169 164 * flags definitions.
170 165 */
171 166 callout_id_t timeout_generic(int, void (*)(void *), void *, hrtime_t, hrtime_t,
172 167 int);
173 168 callout_id_t timeout_default(void (*)(void *), void *, clock_t);
174 169 callout_id_t realtime_timeout_default(void (*)(void *), void *, clock_t);
175 170 /*
176 171 * The last argument to untimeout_generic() is flags. See callout.c for the
177 172 * use.
178 173 */
179 174 hrtime_t untimeout_generic(callout_id_t, int);
180 175 clock_t untimeout_default(callout_id_t, int);
181 176 void delay(clock_t);
182 177 int delay_sig(clock_t);
183 178 void delay_random(clock_t);
184 179 int nodev();
185 180 int nulldev();
186 181 major_t getudev(void);
187 182 int cmpldev(dev32_t *, dev_t);
188 183 dev_t expldev(dev32_t);
189 184 int bcmp(const void *, const void *, size_t) __PURE;
190 185 int stoi(char **);
191 186 void numtos(ulong_t, char *);
192 187 char *kmem_asprintf(const char *fmt, ...);
193 188 int strident_valid(const char *);
194 189 void strident_canon(char *, size_t);
195 190 int getsubopt(char **optionsp, char * const *tokens, char **valuep);
196 191 char *append_subopt(const char *, size_t, char *, const char *);
197 192 #ifndef _FAKE_KERNEL
198 193 /* conflicts with libc definition */
199 194 int ffs(uintmax_t);
200 195 #endif
201 196 int copyin(const void *, void *, size_t);
202 197 void copyin_noerr(const void *, void *, size_t);
203 198 int xcopyin(const void *, void *, size_t);
204 199 int xcopyin_nta(const void *, void *, size_t, int);
205 200 int copyout(const void *, void *, size_t);
206 201 void copyout_noerr(const void *, void *, size_t);
207 202 int xcopyout(const void *, void *, size_t);
208 203 int xcopyout_nta(const void *, void *, size_t, int);
209 204 int copyinstr(const char *, char *, size_t, size_t *);
210 205 int copyinstr_noerr(const char *, char *, size_t, size_t *);
211 206 int copyoutstr(const char *, char *, size_t, size_t *);
212 207 int copyoutstr_noerr(const char *, char *, size_t, size_t *);
213 208 int copystr(const char *, char *, size_t, size_t *);
214 209 void ucopy(const void *, void *, size_t);
215 210 void ucopystr(const char *, char *, size_t, size_t *);
216 211 void pgcopy(const void *, void *, size_t);
217 212 void ovbcopy(const void *, void *, size_t);
218 213 void uzero(void *, size_t);
219 214 int kcopy(const void *, void *, size_t);
220 215 int kcopy_nta(const void *, void *, size_t, int);
221 216 int kzero(void *, size_t);
222 217
223 218 int fuword8(const void *, uint8_t *);
224 219 int fuword16(const void *, uint16_t *);
225 220 int fuword32(const void *, uint32_t *);
226 221 int fulword(const void *, ulong_t *);
227 222 void fuword8_noerr(const void *, uint8_t *);
228 223 void fuword16_noerr(const void *, uint16_t *);
229 224 void fuword32_noerr(const void *, uint32_t *);
230 225 void fulword_noerr(const void *, ulong_t *);
231 226
232 227 #ifdef _LP64
233 228 int fuword64(const void *, uint64_t *);
234 229 void fuword64_noerr(const void *, uint64_t *);
235 230 #endif
236 231
237 232 int subyte(void *, uint8_t);
238 233 int suword8(void *, uint8_t);
239 234 int suword16(void *, uint16_t);
240 235 int suword32(void *, uint32_t);
241 236 int sulword(void *, ulong_t);
242 237 void subyte_noerr(void *, uint8_t);
243 238 void suword8_noerr(void *, uint8_t);
244 239 void suword16_noerr(void *, uint16_t);
245 240 void suword32_noerr(void *, uint32_t);
246 241 void sulword_noerr(void *, ulong_t);
247 242
248 243 #ifdef _LP64
249 244 int suword64(void *, uint64_t);
250 245 void suword64_noerr(void *, uint64_t);
251 246 #endif
252 247
253 248 #if !defined(_BOOT) && !defined(_FAKE_KERNEL)
254 249 /* conflicts with libc definition */
255 250 int setjmp(label_t *) __RETURNS_TWICE;
256 251 extern void longjmp(label_t *)
257 252 __NORETURN;
258 253 #pragma unknown_control_flow(setjmp)
259 254 #endif
260 255
261 256 void prefetch_read_once(void *);
262 257 void prefetch_write_once(void *);
263 258 void prefetch_read_many(void *);
264 259 void prefetch_write_many(void *);
265 260 caddr_t caller(void);
266 261 caddr_t callee(void);
267 262 int getpcstack(pc_t *, int);
268 263 int on_fault(label_t *) __RETURNS_TWICE;
269 264 void no_fault(void);
270 265 void halt(char *);
271 266 int scanc(size_t, uchar_t *, uchar_t *, uchar_t);
272 267 int movtuc(size_t, uchar_t *, uchar_t *, uchar_t *);
273 268 int splr(int);
274 269 int splhigh(void);
275 270 int splhi(void);
276 271 int splzs(void);
277 272 int spl0(void);
278 273 int spl6(void);
279 274 int spl7(void);
280 275 int spl8(void);
281 276 void splx(int);
282 277 void set_base_spl(void);
283 278 int __ipltospl(int);
284 279 int spl_xcall(void);
285 280
286 281 void softcall_init(void);
287 282 void softcall(void (*)(void *), void *);
288 283 void softint(void);
289 284
290 285 extern void sync_icache(caddr_t, uint_t);
291 286 extern void sync_data_memory(caddr_t, size_t);
292 287 extern void hot_patch_kernel_text(caddr_t, uint32_t, uint_t);
293 288
294 289 void _insque(caddr_t, caddr_t);
295 290 void _remque(caddr_t);
296 291
297 292 /* casts to keep lint happy */
298 293 #define insque(q, p) _insque((caddr_t)q, (caddr_t)p)
299 294 #define remque(q) _remque((caddr_t)q)
300 295
301 296 #pragma unknown_control_flow(on_fault)
302 297
303 298 struct timeval;
304 299 extern void uniqtime(struct timeval *);
305 300 struct timeval32;
306 301 extern void uniqtime32(struct timeval32 *);
307 302
308 303 uint_t page_num_pagesizes(void);
309 304 size_t page_get_pagesize(uint_t n);
310 305
311 306 extern int maxusers;
312 307 extern int pidmax;
313 308
314 309 extern void param_preset(void);
315 310 extern void param_calc(int);
316 311 extern void param_init(void);
317 312 extern void param_check(void);
318 313
319 314 #endif /* _KERNEL */
320 315
321 316 /*
322 317 * Structure of the system-entry table.
323 318 *
324 319 * Changes to struct sysent should maintain binary compatibility with
325 320 * loadable system calls, although the interface is currently private.
326 321 *
327 322 * This means it should only be expanded on the end, and flag values
328 323 * should not be reused.
329 324 *
330 325 * It is desirable to keep the size of this struct a power of 2 for quick
331 326 * indexing.
332 327 */
333 328 struct sysent {
334 329 char sy_narg; /* total number of arguments */
335 330 #ifdef _LP64
336 331 unsigned short sy_flags; /* various flags as defined below */
337 332 #else
338 333 unsigned char sy_flags; /* various flags as defined below */
339 334 #endif
340 335 int (*sy_call)(); /* argp, rvalp-style handler */
341 336 krwlock_t *sy_lock; /* lock for loadable system calls */
342 337 int64_t (*sy_callc)(); /* C-style call hander or wrapper */
343 338 };
344 339
345 340 extern struct sysent sysent[];
346 341 #ifdef _SYSCALL32_IMPL
347 342 extern struct sysent sysent32[];
348 343 #endif
349 344
350 345 extern struct sysent nosys_ent; /* entry for invalid system call */
351 346
352 347 #define NSYSCALL 256 /* number of system calls */
353 348
354 349 #define LOADABLE_SYSCALL(s) (s->sy_flags & SE_LOADABLE)
355 350 #define LOADED_SYSCALL(s) (s->sy_flags & SE_LOADED)
356 351
357 352 /*
358 353 * sy_flags values
359 354 * Values 1, 2, and 4 were used previously for SETJUMP, ASYNC, and IOSYS.
360 355 */
361 356 #define SE_32RVAL1 0x0 /* handler returns int32_t in rval1 */
362 357 #define SE_32RVAL2 0x1 /* handler returns int32_t in rval2 */
363 358 #define SE_64RVAL 0x2 /* handler returns int64_t in rvals */
364 359 #define SE_RVAL_MASK 0x3 /* mask of rval_t bits */
365 360
366 361 #define SE_LOADABLE 0x08 /* syscall is loadable */
367 362 #define SE_LOADED 0x10 /* syscall is completely loaded */
368 363 #define SE_NOUNLOAD 0x20 /* syscall never needs unload */
369 364 #define SE_ARGC 0x40 /* syscall takes C-style args */
370 365
371 366 /*
372 367 * Structure of the return-value parameter passed by reference to
373 368 * system entries.
374 369 */
375 370 union rval {
376 371 struct {
377 372 int r_v1;
378 373 int r_v2;
379 374 } r_v;
380 375 off_t r_off;
381 376 offset_t r_offset;
382 377 time_t r_time;
383 378 int64_t r_vals;
384 379 };
385 380 #define r_val1 r_v.r_v1
386 381 #define r_val2 r_v.r_v2
387 382
388 383 typedef union rval rval_t;
389 384
390 385 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
391 386
392 387 extern void reset_syscall_args(void);
393 388 extern int save_syscall_args(void);
394 389 extern uint_t get_syscall_args(klwp_t *lwp, long *argp, int *nargsp);
395 390 #ifdef _SYSCALL32_IMPL
396 391 extern uint_t get_syscall32_args(klwp_t *lwp, int *argp, int *nargp);
397 392 #endif
398 393
399 394 extern uint_t set_errno(uint_t error);
400 395 #pragma rarely_called(set_errno)
401 396
402 397 extern int64_t syscall_ap(void);
403 398 extern int64_t loadable_syscall(long, long, long, long, long, long, long, long);
404 399 extern int64_t nosys(void);
405 400
406 401 extern void swtch(void);
407 402
408 403 extern uint_t kcpc_key; /* TSD key for performance counter context */
409 404
410 405 /*
411 406 * initname holds the path to init and is used as a point of rendezvous
412 407 * between krtld (which processes the boot arguments) and the kernel.
413 408 */
414 409 #define INITNAME_SZ 32
415 410 extern char initname[INITNAME_SZ];
416 411
417 412 /*
418 413 * initargs holds the arguments to init (such as -v, -s, -r, -m verbose) and
419 414 * is a point of rendezvous between krtld (which processes the boot arguments)
420 415 * and the kernel.
421 416 */
422 417 extern char initargs[BOOTARGS_MAX];
423 418
424 419 extern int exec_init(const char *, const char *);
425 420 extern int start_init_common(void);
426 421
427 422 #endif /* _KERNEL */
428 423
429 424 #if defined(_KERNEL) || defined(_FAKE_KERNEL) || defined(_BOOT)
430 425
431 426 size_t strlcat(char *, const char *, size_t);
432 427 size_t strlen(const char *) __PURE;
433 428 char *strcat(char *, const char *);
434 429 char *strncat(char *, const char *, size_t);
435 430 char *strcpy(char *, const char *);
436 431 char *strncpy(char *, const char *, size_t);
437 432
438 433 extern size_t strlcpy(char *, const char *, size_t);
439 434 extern size_t strspn(const char *, const char *);
440 435 extern size_t strcspn(const char *, const char *);
441 436 extern char *strdup(const char *);
442 437 extern void strfree(char *);
443 438
444 439 /* Need to be consistent with <string.h> C++ definitions */
445 440 #if __cplusplus >= 199711L
446 441 extern const char *strchr(const char *, int);
447 442 #ifndef _STRCHR_INLINE
448 443 #define _STRCHR_INLINE
449 444 extern "C++" {
450 445 inline char *strchr(char *__s, int __c) {
451 446 return (char *)strchr((const char *)__s, __c);
452 447 }
453 448 }
454 449 #endif /* _STRCHR_INLINE */
455 450 extern const char *strrchr(const char *, int);
456 451 #ifndef _STRRCHR_INLINE
457 452 #define _STRRCHR_INLINE
458 453 extern "C++" {
459 454 inline char *strrchr(char *__s, int __c) {
460 455 return (char *)strrchr((const char *)__s, __c);
461 456 }
462 457 }
463 458 #endif /* _STRRCHR_INLINE */
464 459 extern const char *strstr(const char *, const char *);
465 460 #ifndef _STRSTR_INLINE
466 461 #define _STRSTR_INLINE
467 462 extern "C++" {
468 463 inline char *strstr(char *__s1, const char *__s2) {
469 464 return (char *)strstr((const char *)__s1, __s2);
470 465 }
471 466 }
472 467 #endif /* _STRSTR_INLINE */
473 468 #else /* __cplusplus >= 199711L */
474 469 char *strchr(const char *, int);
475 470 char *strrchr(const char *, int);
476 471 char *strstr(const char *, const char *);
477 472 #endif /* __cplusplus >= 199711L */
478 473 char *strnrchr(const char *, int, size_t);
479 474 int strcmp(const char *, const char *) __PURE;
480 475 int strncmp(const char *, const char *, size_t) __PURE;
481 476 int strcasecmp(const char *, const char *) __PURE;
482 477 int strncasecmp(const char *, const char *, size_t) __PURE;
483 478 /* Need to be consistent with <string.h> C++ definitions */
484 479 #if __cplusplus >= 199711L
485 480 extern const char *strpbrk(const char *, const char *);
486 481 #ifndef _STRPBRK_INLINE
487 482 #define _STRPBRK_INLINE
488 483 extern "C++" {
489 484 inline char *strpbrk(char *__s1, const char *__s2) {
490 485 return (char *)strpbrk((const char *)__s1, __s2);
491 486 }
492 487 }
493 488 #endif /* _STRPBRK_INLINE */
494 489 #else /* __cplusplus >= 199711L */
495 490 char *strpbrk(const char *, const char *);
496 491 #endif /* __cplusplus >= 199711L */
497 492 void bcopy(const void *, void *, size_t);
498 493 void bzero(void *, size_t);
499 494
500 495 extern void *memset(void *, int, size_t);
501 496 extern void *memcpy(void *, const void *, size_t);
502 497 extern void *memmove(void *, const void *, size_t);
503 498 extern int memcmp(const void *, const void *, size_t);
504 499
505 500 #ifdef __lint
506 501 extern int __lintzero; /* for spoofing lint */
507 502 #else /* __lint */
508 503 #define __lintzero 0
509 504 #endif /* __lint */
510 505 #endif /* _KERNEL || _BOOT */
511 506
512 507 #ifdef __cplusplus
513 508 }
514 509 #endif
515 510
516 511 #endif /* _SYS_SYSTM_H */
↓ open down ↓ |
435 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX