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