Print this page
OS-2366 ddi_periodic_add(9F) is entirely rubbish
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/os/main.c
+++ new/usr/src/uts/common/os/main.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 *
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /* Copyright (c) 1988 AT&T */
27 27 /* All Rights Reserved */
28 28
29 +/*
30 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
31 + */
32 +
29 33 #include <sys/types.h>
30 34 #include <sys/param.h>
31 35 #include <sys/sysmacros.h>
32 36 #include <sys/pcb.h>
33 37 #include <sys/systm.h>
34 38 #include <sys/signal.h>
35 39 #include <sys/cred.h>
36 40 #include <sys/user.h>
37 41 #include <sys/vfs.h>
38 42 #include <sys/vnode.h>
39 43 #include <sys/proc.h>
40 44 #include <sys/time.h>
41 45 #include <sys/file.h>
42 46 #include <sys/priocntl.h>
43 47 #include <sys/procset.h>
44 48 #include <sys/disp.h>
45 49 #include <sys/callo.h>
46 50 #include <sys/callb.h>
47 51 #include <sys/debug.h>
48 52 #include <sys/conf.h>
49 53 #include <sys/bootconf.h>
50 54 #include <sys/utsname.h>
51 55 #include <sys/cmn_err.h>
52 56 #include <sys/vmparam.h>
53 57 #include <sys/modctl.h>
54 58 #include <sys/vm.h>
55 59 #include <sys/callb.h>
56 60 #include <sys/ddi_timer.h>
57 61 #include <sys/kmem.h>
58 62 #include <sys/vmem.h>
59 63 #include <sys/cpuvar.h>
60 64 #include <sys/cladm.h>
61 65 #include <sys/corectl.h>
62 66 #include <sys/exec.h>
63 67 #include <sys/syscall.h>
64 68 #include <sys/reboot.h>
65 69 #include <sys/task.h>
66 70 #include <sys/exacct.h>
67 71 #include <sys/autoconf.h>
68 72 #include <sys/errorq.h>
69 73 #include <sys/class.h>
70 74 #include <sys/stack.h>
71 75 #include <sys/brand.h>
72 76 #include <sys/mmapobj.h>
73 77
74 78 #include <vm/as.h>
75 79 #include <vm/seg_kmem.h>
76 80 #include <sys/dc_ki.h>
77 81
78 82 #include <c2/audit.h>
79 83 #include <sys/bootprops.h>
80 84
81 85 /* well known processes */
82 86 proc_t *proc_sched; /* memory scheduler */
83 87 proc_t *proc_init; /* init */
84 88 proc_t *proc_pageout; /* pageout daemon */
85 89 proc_t *proc_fsflush; /* fsflush daemon */
86 90
87 91 pgcnt_t maxmem; /* Maximum available memory in pages. */
88 92 pgcnt_t freemem; /* Current available memory in pages. */
89 93 int interrupts_unleashed; /* set when we do the first spl0() */
90 94
91 95 kmem_cache_t *process_cache; /* kmem cache for proc structures */
92 96
93 97 /*
94 98 * Indicates whether the auditing module (c2audit) is loaded. Possible
95 99 * values are:
96 100 * 0 - c2audit module is excluded in /etc/system and cannot be loaded
97 101 * 1 - c2audit module is not loaded but can be anytime
98 102 * 2 - c2audit module is loaded
99 103 */
100 104 int audit_active = C2AUDIT_DISABLED;
101 105
102 106 /*
103 107 * Process 0's lwp directory and lwpid hash table.
104 108 */
105 109 lwpdir_t p0_lwpdir[2];
106 110 tidhash_t p0_tidhash[2];
107 111 lwpent_t p0_lep;
108 112
109 113 /*
110 114 * Machine-independent initialization code
111 115 * Called from cold start routine as
112 116 * soon as a stack and segmentation
113 117 * have been established.
114 118 * Functions:
115 119 * clear and free user core
116 120 * turn on clock
117 121 * hand craft 0th process
118 122 * call all initialization routines
119 123 * fork - process 0 to schedule
120 124 * - process 1 execute bootstrap
121 125 * - process 2 to page out
122 126 * create system threads
123 127 */
124 128
125 129 int cluster_bootflags = 0;
126 130
127 131 void
128 132 cluster_wrapper(void)
129 133 {
130 134 cluster();
131 135 panic("cluster() returned");
132 136 }
133 137
134 138 char initname[INITNAME_SZ] = "/sbin/init"; /* also referenced by zone0 */
135 139 char initargs[BOOTARGS_MAX] = ""; /* also referenced by zone0 */
136 140
137 141 /*
138 142 * Construct a stack for init containing the arguments to it, then
139 143 * pass control to exec_common.
140 144 */
141 145 int
142 146 exec_init(const char *initpath, const char *args)
143 147 {
144 148 caddr32_t ucp;
145 149 caddr32_t *uap;
146 150 caddr32_t *argv;
147 151 caddr32_t exec_fnamep;
148 152 char *scratchargs;
149 153 int i, sarg;
150 154 size_t argvlen, alen;
151 155 boolean_t in_arg;
152 156 int argc = 0;
153 157 int error = 0, count = 0;
154 158 proc_t *p = ttoproc(curthread);
155 159 klwp_t *lwp = ttolwp(curthread);
156 160 int brand_action;
157 161
158 162 if (args == NULL)
159 163 args = "";
160 164
161 165 alen = strlen(initpath) + 1 + strlen(args) + 1;
162 166 scratchargs = kmem_alloc(alen, KM_SLEEP);
163 167 (void) snprintf(scratchargs, alen, "%s %s", initpath, args);
164 168
165 169 /*
166 170 * We do a quick two state parse of the string to sort out how big
167 171 * argc should be.
168 172 */
169 173 in_arg = B_FALSE;
170 174 for (i = 0; i < strlen(scratchargs); i++) {
171 175 if (scratchargs[i] == ' ' || scratchargs[i] == '\0') {
172 176 if (in_arg) {
173 177 in_arg = B_FALSE;
174 178 argc++;
175 179 }
176 180 } else {
177 181 in_arg = B_TRUE;
178 182 }
179 183 }
180 184 argvlen = sizeof (caddr32_t) * (argc + 1);
181 185 argv = kmem_zalloc(argvlen, KM_SLEEP);
182 186
183 187 /*
184 188 * We pull off a bit of a hack here. We work our way through the
185 189 * args string, putting nulls at the ends of space delimited tokens
186 190 * (boot args don't support quoting at this time). Then we just
187 191 * copy the whole mess to userland in one go. In other words, we
188 192 * transform this: "init -s -r\0" into this on the stack:
189 193 *
190 194 * -0x00 \0
191 195 * -0x01 r
192 196 * -0x02 - <--------.
193 197 * -0x03 \0 |
194 198 * -0x04 s |
195 199 * -0x05 - <------. |
196 200 * -0x06 \0 | |
197 201 * -0x07 t | |
198 202 * -0x08 i | |
199 203 * -0x09 n | |
200 204 * -0x0a i <---. | |
201 205 * -0x10 NULL | | | (argv[3])
202 206 * -0x14 -----|--|-' (argv[2])
203 207 * -0x18 ------|--' (argv[1])
204 208 * -0x1c -------' (argv[0])
205 209 *
206 210 * Since we know the value of ucp at the beginning of this process,
207 211 * we can trivially compute the argv[] array which we also need to
208 212 * place in userland: argv[i] = ucp - sarg(i), where ucp is the
209 213 * stack ptr, and sarg is the string index of the start of the
210 214 * argument.
211 215 */
212 216 ucp = (caddr32_t)(uintptr_t)p->p_usrstack;
213 217
214 218 argc = 0;
215 219 in_arg = B_FALSE;
216 220 sarg = 0;
217 221
218 222 for (i = 0; i < alen; i++) {
219 223 if (scratchargs[i] == ' ' || scratchargs[i] == '\0') {
220 224 if (in_arg == B_TRUE) {
221 225 in_arg = B_FALSE;
222 226 scratchargs[i] = '\0';
223 227 argv[argc++] = ucp - (alen - sarg);
224 228 }
225 229 } else if (in_arg == B_FALSE) {
226 230 in_arg = B_TRUE;
227 231 sarg = i;
228 232 }
229 233 }
230 234 ucp -= alen;
231 235 error |= copyout(scratchargs, (caddr_t)(uintptr_t)ucp, alen);
232 236
233 237 uap = (caddr32_t *)P2ALIGN((uintptr_t)ucp, sizeof (caddr32_t));
234 238 uap--; /* advance to be below the word we're in */
235 239 uap -= (argc + 1); /* advance argc words down, plus one for NULL */
236 240 error |= copyout(argv, uap, argvlen);
237 241
238 242 if (error != 0) {
239 243 zcmn_err(p->p_zone->zone_id, CE_WARN,
240 244 "Could not construct stack for init.\n");
241 245 kmem_free(argv, argvlen);
242 246 kmem_free(scratchargs, alen);
243 247 return (EFAULT);
244 248 }
245 249
246 250 exec_fnamep = argv[0];
247 251 kmem_free(argv, argvlen);
248 252 kmem_free(scratchargs, alen);
249 253
250 254 /*
251 255 * Point at the arguments.
252 256 */
253 257 lwp->lwp_ap = lwp->lwp_arg;
254 258 lwp->lwp_arg[0] = (uintptr_t)exec_fnamep;
255 259 lwp->lwp_arg[1] = (uintptr_t)uap;
256 260 lwp->lwp_arg[2] = NULL;
257 261 curthread->t_post_sys = 1;
258 262 curthread->t_sysnum = SYS_execve;
259 263
260 264 /*
261 265 * If we are executing init from zsched, we may have inherited its
262 266 * parent process's signal mask. Clear it now so that we behave in
263 267 * the same way as when started from the global zone.
264 268 */
265 269 sigemptyset(&curthread->t_hold);
266 270
267 271 brand_action = ZONE_IS_BRANDED(p->p_zone) ? EBA_BRAND : EBA_NONE;
268 272 again:
269 273 error = exec_common((const char *)(uintptr_t)exec_fnamep,
270 274 (const char **)(uintptr_t)uap, NULL, brand_action);
271 275
272 276 /*
273 277 * Normally we would just set lwp_argsaved and t_post_sys and
274 278 * let post_syscall reset lwp_ap for us. Unfortunately,
275 279 * exec_init isn't always called from a system call. Instead
276 280 * of making a mess of trap_cleanup, we just reset the args
277 281 * pointer here.
278 282 */
279 283 reset_syscall_args();
280 284
281 285 switch (error) {
282 286 case 0:
283 287 return (0);
284 288
285 289 case ENOENT:
286 290 zcmn_err(p->p_zone->zone_id, CE_WARN,
287 291 "exec(%s) failed (file not found).\n", initpath);
288 292 return (ENOENT);
289 293
290 294 case EAGAIN:
291 295 case EINTR:
292 296 ++count;
293 297 if (count < 5) {
294 298 zcmn_err(p->p_zone->zone_id, CE_WARN,
295 299 "exec(%s) failed with errno %d. Retrying...\n",
296 300 initpath, error);
297 301 goto again;
298 302 }
299 303 }
300 304
301 305 zcmn_err(p->p_zone->zone_id, CE_WARN,
302 306 "exec(%s) failed with errno %d.", initpath, error);
303 307 return (error);
304 308 }
305 309
306 310 /*
307 311 * This routine does all of the common setup for invoking init; global
308 312 * and non-global zones employ this routine for the functionality which is
309 313 * in common.
310 314 *
311 315 * This program (init, presumably) must be a 32-bit process.
312 316 */
313 317 int
314 318 start_init_common()
315 319 {
316 320 proc_t *p = curproc;
317 321 ASSERT_STACK_ALIGNED();
318 322 p->p_zone->zone_proc_initpid = p->p_pid;
319 323
320 324 p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0;
321 325 p->p_usrstack = (caddr_t)USRSTACK32;
322 326 p->p_model = DATAMODEL_ILP32;
323 327 p->p_stkprot = PROT_ZFOD & ~PROT_EXEC;
324 328 p->p_datprot = PROT_ZFOD & ~PROT_EXEC;
325 329 p->p_stk_ctl = INT32_MAX;
326 330
327 331 p->p_as = as_alloc();
328 332 p->p_as->a_proc = p;
329 333 p->p_as->a_userlimit = (caddr_t)USERLIMIT32;
330 334 (void) hat_setup(p->p_as->a_hat, HAT_INIT);
331 335
332 336 init_core();
333 337
334 338 init_mstate(curthread, LMS_SYSTEM);
335 339 return (exec_init(p->p_zone->zone_initname, p->p_zone->zone_bootargs));
336 340 }
337 341
338 342 /*
339 343 * Start the initial user process for the global zone; once running, if
340 344 * init should subsequently fail, it will be automatically be caught in the
341 345 * exit(2) path, and restarted by restart_init().
342 346 */
343 347 static void
344 348 start_init(void)
345 349 {
346 350 proc_init = curproc;
347 351
348 352 ASSERT(curproc->p_zone->zone_initname != NULL);
349 353
350 354 if (start_init_common() != 0)
351 355 halt("unix: Could not start init");
352 356 lwp_rtt();
353 357 }
354 358
355 359 void
356 360 main(void)
357 361 {
358 362 proc_t *p = ttoproc(curthread); /* &p0 */
359 363 int (**initptr)();
360 364 extern void sched();
361 365 extern void fsflush();
362 366 extern int (*init_tbl[])();
363 367 extern int (*mp_init_tbl[])();
364 368 extern id_t syscid, defaultcid;
365 369 extern int swaploaded;
366 370 extern int netboot;
367 371 extern ib_boot_prop_t *iscsiboot_prop;
368 372 extern void vm_init(void);
369 373 extern void cbe_init_pre(void);
370 374 extern void cbe_init(void);
371 375 extern void clock_tick_init_pre(void);
372 376 extern void clock_tick_init_post(void);
373 377 extern void clock_init(void);
374 378 extern void physio_bufs_init(void);
375 379 extern void pm_cfb_setup_intr(void);
376 380 extern int pm_adjust_timestamps(dev_info_t *, void *);
377 381 extern void start_other_cpus(int);
378 382 extern void sysevent_evc_thrinit();
379 383 extern kmutex_t ualock;
380 384 #if defined(__x86)
381 385 extern void fastboot_post_startup(void);
382 386 extern void progressbar_start(void);
383 387 #endif
384 388 /*
385 389 * In the horrible world of x86 in-lines, you can't get symbolic
386 390 * structure offsets a la genassym. This assertion is here so
387 391 * that the next poor slob who innocently changes the offset of
388 392 * cpu_thread doesn't waste as much time as I just did finding
389 393 * out that it's hard-coded in i86/ml/i86.il. Similarly for
390 394 * curcpup. You're welcome.
391 395 */
392 396 ASSERT(CPU == CPU->cpu_self);
393 397 ASSERT(curthread == CPU->cpu_thread);
394 398 ASSERT_STACK_ALIGNED();
395 399
396 400 /*
397 401 * We take the ualock until we have completed the startup
398 402 * to prevent kadmin() from disrupting this work. In particular,
399 403 * we don't want kadmin() to bring the system down while we are
400 404 * trying to start it up.
401 405 */
402 406 mutex_enter(&ualock);
403 407
404 408 /*
405 409 * Setup root lgroup and leaf lgroup for CPU 0
406 410 */
407 411 lgrp_init(LGRP_INIT_STAGE2);
↓ open down ↓ |
369 lines elided |
↑ open up ↑ |
408 412
409 413 /*
410 414 * Once 'startup()' completes, the thread_reaper() daemon would be
411 415 * created(in thread_init()). After that, it is safe to create threads
412 416 * that could exit. These exited threads will get reaped.
413 417 */
414 418 startup();
415 419 segkmem_gc();
416 420 callb_init();
417 421 cbe_init_pre(); /* x86 must initialize gethrtimef before timer_init */
418 - timer_init(); /* timer must be initialized before cyclic starts */
422 + ddi_periodic_init();
419 423 cbe_init();
420 424 callout_init(); /* callout table MUST be init'd after cyclics */
421 425 clock_tick_init_pre();
422 426 clock_init();
423 427
424 428 #if defined(__x86)
425 429 /*
426 430 * The progressbar thread uses cv_reltimedwait() and hence needs to be
427 431 * started after the callout mechanism has been initialized.
428 432 */
429 433 progressbar_start();
430 434 #endif
431 435 /*
432 436 * On some platforms, clkinitf() changes the timing source that
433 437 * gethrtime_unscaled() uses to generate timestamps. cbe_init() calls
434 438 * clkinitf(), so re-initialize the microstate counters after the
435 439 * timesource has been chosen.
436 440 */
437 441 init_mstate(&t0, LMS_SYSTEM);
438 442 init_cpu_mstate(CPU, CMS_SYSTEM);
439 443
440 444 /*
441 445 * May need to probe to determine latencies from CPU 0 after
442 446 * gethrtime() comes alive in cbe_init() and before enabling interrupts
443 447 * and copy and release any temporary memory allocated with BOP_ALLOC()
444 448 * before release_bootstrap() frees boot memory
445 449 */
446 450 lgrp_init(LGRP_INIT_STAGE3);
447 451
448 452 /*
449 453 * Call all system initialization functions.
450 454 */
451 455 for (initptr = &init_tbl[0]; *initptr; initptr++)
452 456 (**initptr)();
453 457 /*
454 458 * Load iSCSI boot properties
455 459 */
456 460 ld_ib_prop();
457 461 /*
458 462 * initialize vm related stuff.
459 463 */
460 464 vm_init();
461 465
462 466 /*
463 467 * initialize buffer pool for raw I/O requests
464 468 */
465 469 physio_bufs_init();
466 470
467 471 ttolwp(curthread)->lwp_error = 0; /* XXX kludge for SCSI driver */
468 472
469 473 /*
470 474 * Drop the interrupt level and allow interrupts. At this point
471 475 * the DDI guarantees that interrupts are enabled.
472 476 */
473 477 (void) spl0();
474 478 interrupts_unleashed = 1;
475 479
476 480 /*
477 481 * Create kmem cache for proc structures
478 482 */
479 483 process_cache = kmem_cache_create("process_cache", sizeof (proc_t),
480 484 0, NULL, NULL, NULL, NULL, NULL, 0);
481 485
482 486 vfs_mountroot(); /* Mount the root file system */
483 487 errorq_init(); /* after vfs_mountroot() so DDI root is ready */
484 488 cpu_kstat_init(CPU); /* after vfs_mountroot() so TOD is valid */
485 489 ddi_walk_devs(ddi_root_node(), pm_adjust_timestamps, NULL);
486 490 /* after vfs_mountroot() so hrestime is valid */
487 491
488 492 post_startup();
489 493 swaploaded = 1;
490 494
491 495 /*
492 496 * Initialize Solaris Audit Subsystem
493 497 */
494 498 audit_init();
495 499
496 500 /*
497 501 * Plumb the protocol modules and drivers only if we are not
498 502 * networked booted, in this case we already did it in rootconf().
499 503 */
500 504 if (netboot == 0 && iscsiboot_prop == NULL)
501 505 (void) strplumb();
502 506
503 507 gethrestime(&PTOU(curproc)->u_start);
504 508 curthread->t_start = PTOU(curproc)->u_start.tv_sec;
505 509 p->p_mstart = gethrtime();
506 510
507 511 /*
508 512 * Perform setup functions that can only be done after root
509 513 * and swap have been set up.
510 514 */
511 515 consconfig();
512 516 #ifndef __sparc
513 517 release_bootstrap();
514 518 #endif
515 519
516 520 /*
517 521 * attach drivers with ddi-forceattach prop
518 522 * It must be done early enough to load hotplug drivers (e.g.
519 523 * pcmcia nexus) so that devices enumerated via hotplug is
520 524 * available before I/O subsystem is fully initialized.
521 525 */
522 526 i_ddi_forceattach_drivers();
523 527
524 528 /*
525 529 * Set the scan rate and other parameters of the paging subsystem.
526 530 */
527 531 setupclock(0);
528 532
529 533 /*
530 534 * Initialize process 0's lwp directory and lwpid hash table.
531 535 */
532 536 p->p_lwpdir = p->p_lwpfree = p0_lwpdir;
533 537 p->p_lwpdir->ld_next = p->p_lwpdir + 1;
534 538 p->p_lwpdir_sz = 2;
535 539 p->p_tidhash = p0_tidhash;
536 540 p->p_tidhash_sz = 2;
537 541 p0_lep.le_thread = curthread;
538 542 p0_lep.le_lwpid = curthread->t_tid;
539 543 p0_lep.le_start = curthread->t_start;
540 544 lwp_hash_in(p, &p0_lep, p0_tidhash, 2, 0);
541 545
542 546 /*
543 547 * Initialize extended accounting.
544 548 */
545 549 exacct_init();
546 550
547 551 /*
548 552 * Initialize threads of sysevent event channels
549 553 */
550 554 sysevent_evc_thrinit();
551 555
552 556 /*
553 557 * This must be done after post_startup() but before
554 558 * start_other_cpus()
555 559 */
556 560 lgrp_init(LGRP_INIT_STAGE4);
557 561
558 562 /*
559 563 * Perform MP initialization, if any.
560 564 */
561 565 start_other_cpus(0);
562 566
563 567 #ifdef __sparc
564 568 /*
565 569 * Release bootstrap here since PROM interfaces are
566 570 * used to start other CPUs above.
567 571 */
568 572 release_bootstrap();
569 573 #endif
570 574
571 575 /*
572 576 * Finish lgrp initialization after all CPUS are brought online.
573 577 */
574 578 lgrp_init(LGRP_INIT_STAGE5);
575 579
576 580 /*
577 581 * After mp_init(), number of cpus are known (this is
578 582 * true for the time being, when there are actually
579 583 * hot pluggable cpus then this scheme would not do).
580 584 * Any per cpu initialization is done here.
581 585 */
582 586 kmem_mp_init();
583 587 vmem_update(NULL);
584 588
585 589 clock_tick_init_post();
586 590
587 591 for (initptr = &mp_init_tbl[0]; *initptr; initptr++)
588 592 (**initptr)();
589 593
590 594 /*
591 595 * These must be called after start_other_cpus
592 596 */
593 597 pm_cfb_setup_intr();
594 598 #if defined(__x86)
595 599 fastboot_post_startup();
596 600 #endif
597 601
598 602 /*
599 603 * Make init process; enter scheduling loop with system process.
600 604 *
601 605 * Note that we manually assign the pids for these processes, for
602 606 * historical reasons. If more pre-assigned pids are needed,
603 607 * FAMOUS_PIDS will have to be updated.
604 608 */
605 609
606 610 /* create init process */
607 611 if (newproc(start_init, NULL, defaultcid, 59, NULL,
608 612 FAMOUS_PID_INIT))
609 613 panic("main: unable to fork init.");
610 614
611 615 /* create pageout daemon */
612 616 if (newproc(pageout, NULL, syscid, maxclsyspri - 1, NULL,
613 617 FAMOUS_PID_PAGEOUT))
614 618 panic("main: unable to fork pageout()");
615 619
616 620 /* create fsflush daemon */
617 621 if (newproc(fsflush, NULL, syscid, minclsyspri, NULL,
618 622 FAMOUS_PID_FSFLUSH))
619 623 panic("main: unable to fork fsflush()");
620 624
621 625 /* create cluster process if we're a member of one */
622 626 if (cluster_bootflags & CLUSTER_BOOTED) {
623 627 if (newproc(cluster_wrapper, NULL, syscid, minclsyspri,
624 628 NULL, 0)) {
625 629 panic("main: unable to fork cluster()");
626 630 }
627 631 }
628 632
629 633 /*
630 634 * Create system threads (threads are associated with p0)
631 635 */
632 636
633 637 /* create module uninstall daemon */
634 638 /* BugID 1132273. If swapping over NFS need a bigger stack */
635 639 (void) thread_create(NULL, 0, (void (*)())mod_uninstall_daemon,
636 640 NULL, 0, &p0, TS_RUN, minclsyspri);
637 641
638 642 (void) thread_create(NULL, 0, seg_pasync_thread,
639 643 NULL, 0, &p0, TS_RUN, minclsyspri);
640 644
641 645 pid_setmin();
642 646
643 647 /* system is now ready */
644 648 mutex_exit(&ualock);
645 649
646 650 bcopy("sched", PTOU(curproc)->u_psargs, 6);
647 651 bcopy("sched", PTOU(curproc)->u_comm, 5);
648 652 sched();
649 653 /* NOTREACHED */
650 654 }
↓ open down ↓ |
222 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX