Remove proc0 creation

This commit is contained in:
Sebastian Huber
2012-04-26 15:05:52 +02:00
parent 9ee768907e
commit 4c0c5fdb5f
9 changed files with 225 additions and 75 deletions

View File

@@ -310,5 +310,4 @@ void
mutex_init(void)
{
mtx_init(&Giant, "Giant", NULL, MTX_DEF | MTX_RECURSE);
mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
}

View File

@@ -176,19 +176,16 @@ int
_sleep(void *ident, struct lock_object *lock, int priority, const char *wmesg, int timo)
{
struct thread *td;
struct proc *p;
struct lock_class *class;
int catch, flags, lock_state, pri, rval;
td = curthread;
p = td->td_proc;
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
ktrcsw(1, 0);
#endif
KASSERT(timo != 0 || mtx_owned(&Giant) || lock != NULL,
("sleeping without a lock"));
KASSERT(p != NULL, ("msleep1"));
KASSERT(ident != NULL && TD_IS_RUNNING(td), ("msleep"));
if (priority & PDROP)
KASSERT(lock != NULL && lock != &Giant.lock_object,
@@ -214,9 +211,6 @@ _sleep(void *ident, struct lock_object *lock, int priority, const char *wmesg, i
catch = priority & PCATCH;
pri = priority & PRIMASK;
CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)",
td->td_tid, p->p_pid, td->td_name, wmesg, ident);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
DROP_GIANT();

View File

@@ -31,10 +31,12 @@
RTEMS_CHAIN_DEFINE_EMPTY(rtems_bsd_thread_chain);
/* FIXME: What to do with the credentials? */
static struct ucred FIXME_ucred;
static int
rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg, int flags, int pages, const char *fmt, va_list ap)
{
struct proc *p = &proc0;;
struct thread *td = malloc(sizeof(struct thread), M_TEMP, M_WAITOK | M_ZERO);
if (td != NULL) {
@@ -86,9 +88,7 @@ rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg,
td->td_id = id;
vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap);
bzero(&td->td_ru, sizeof(td->td_ru));
td->td_ucred = crhold(p->p_ucred);
td->td_proc = p;
td->td_ucred = &FIXME_ucred;
rtems_chain_append(&rtems_bsd_thread_chain, &td->td_node);