summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/init_main.c1
-rw-r--r--sys/kern/kern_thread.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index ed76ff8..41b85e2 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -421,6 +421,7 @@ proc0_init(void *dummy __unused)
knlist_init(&p->p_klist, &p->p_mtx, NULL, NULL, NULL);
STAILQ_INIT(&p->p_ktr);
p->p_nice = NZERO;
+ td->td_tid = PID_MAX + 1;
td->td_state = TDS_RUNNING;
td->td_pri_class = PRI_TIMESHARE;
td->td_user_pri = PUSER;
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 3338005..6f23b63 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -251,7 +251,8 @@ threadinit(void)
{
mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF);
- tid_unrhdr = new_unrhdr(PID_MAX + 1, INT_MAX, &tid_lock);
+ /* leave one number for thread0 */
+ tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock);
thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
thread_ctor, thread_dtor, thread_init, thread_fini,
OpenPOWER on IntegriCloud