org_m_in = m_in;
org_fp = fp;
org_self = self;
- assert(mutex_lock(&filp->filp_lock) == 0);
+
+ if (mutex_lock(&filp->filp_lock) != 0)
+ panic("unable to obtain lock on filp");
+
m_in = org_m_in;
fp = org_fp;
self = org_self;
}
filp->filp_softlock = NULL;
- assert(mutex_unlock(&filp->filp_lock) == 0);
+ if (mutex_unlock(&filp->filp_lock) != 0)
+ panic("unable to release lock on filp");
}
/*===========================================================================*
filp1->filp_softlock = NULL;
filp2->filp_softlock = NULL;
- assert(mutex_unlock(&filp2->filp_lock) == 0);
- assert(mutex_unlock(&filp1->filp_lock) == 0);
+ if (mutex_unlock(&filp2->filp_lock) != 0)
+ panic("unable to release filp lock on filp2");
+ if (mutex_unlock(&filp1->filp_lock) != 0)
+ panic("unable to release filp lock on filp1");
}
/*===========================================================================*
/* Initialize event resources for boot procs and locks for all procs */
for (rfp = &fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) {
- assert(mutex_init(&rfp->fp_lock, NULL) == 0);
+ if (mutex_init(&rfp->fp_lock, NULL) != 0)
+ panic("unable to initialize fproc lock");
#if LOCK_DEBUG
rfp->fp_vp_rdlocks = 0;
rfp->fp_vmnt_rdlocks = 0;
org_m_in = m_in;
org_fp = fp;
org_self = self;
- assert(mutex_lock(&rfp->fp_lock) == 0);
+ if (mutex_lock(&rfp->fp_lock) != 0)
+ panic("unable to lock fproc lock");
m_in = org_m_in;
fp = org_fp;
self = org_self;
put_vnode(dir_vp);
dir_vp = dir_vp->v_vmnt->m_mounted_on;
dir_vmp = dir_vp->v_vmnt;
- assert(lock_vmnt(dir_vmp, VMNT_READ) == OK);
- assert(lock_vnode(dir_vp, VNODE_READ) == OK);
+ if (lock_vmnt(dir_vmp, VMNT_READ) != OK)
+ panic("failed to lock vmnt");
+ if (lock_vnode(dir_vp, VNODE_READ) != OK)
+ panic("failed to lock vnode");
dup_vnode(dir_vp);
}
org_m_in = m_in;
org_fp = fp;
org_self = self;
- assert(mutex_lock(&bsf_lock) == 0);
+
+ if (mutex_lock(&bsf_lock) != 0)
+ panic("unable to lock block special file lock");
+
m_in = org_m_in;
fp = org_fp;
self = org_self;
*===========================================================================*/
PUBLIC void unlock_bsf(void)
{
- assert(mutex_unlock(&bsf_lock) == 0);
+ if (mutex_unlock(&bsf_lock) != 0)
+ panic("failed to unlock block special file lock");
}
/*===========================================================================*
/* Initialize worker thread */
if (!init) {
threads_init();
- assert(mthread_attr_init(&tattr) == 0);
+ if (mthread_attr_init(&tattr) != 0)
+ panic("failed to initialize attribute");
if (mthread_attr_setstacksize(&tattr, TH_STACKSIZE) != 0)
panic("couldn't set default thread stack size");
if (mthread_attr_setdetachstate(&tattr, MTHREAD_CREATE_DETACHED) != 0)
wp->w_job.j_func = NULL; /* Mark not in use */
wp->w_next = NULL;
- assert(mutex_init(&wp->w_event_mutex, NULL) == 0);
- assert(cond_init(&wp->w_event, NULL) == 0);
- assert(mthread_create(&wp->w_tid, &tattr, worker_main, (void *) wp) == 0);
+ if (mutex_init(&wp->w_event_mutex, NULL) != 0)
+ panic("failed to initialize mutex");
+ if (cond_init(&wp->w_event, NULL) != 0)
+ panic("failed to initialize conditional variable");
+ if (mthread_create(&wp->w_tid, &tattr, worker_main, (void *) wp) != 0)
+ panic("unable to start thread");
yield();
}
{
ASSERTW(worker);
assert(self == worker);
- assert(mutex_lock(&worker->w_event_mutex) == 0);
- assert(cond_wait(&worker->w_event, &worker->w_event_mutex) == 0);
- assert(mutex_unlock(&worker->w_event_mutex) == 0);
+ if (mutex_lock(&worker->w_event_mutex) != 0)
+ panic("unable to lock event mutex");
+ if (cond_wait(&worker->w_event, &worker->w_event_mutex) != 0)
+ panic("could not wait on conditional variable");
+ if (mutex_unlock(&worker->w_event_mutex) != 0)
+ panic("unable to unlock event mutex");
self = worker;
}
{
/* Signal a worker to wake up */
ASSERTW(worker);
- assert(mutex_lock(&worker->w_event_mutex) == 0);
- assert(cond_signal(&worker->w_event) == 0);
- assert(mutex_unlock(&worker->w_event_mutex) == 0);
+ if (mutex_lock(&worker->w_event_mutex) != 0)
+ panic("unable to lock event mutex");
+ if (cond_signal(&worker->w_event) != 0)
+ panic("unable to signal conditional variable");
+ if (mutex_unlock(&worker->w_event_mutex) != 0)
+ panic("unable to unlock event mutex");
}
/*===========================================================================*