Beispiel #1
0
ER
ipsnd_pdq(ID pdqid, intptr_t data, PRI datapri)
{
    PDQCB	*p_pdqcb;
    bool_t	reqdsp;
    ER		ercd;

    LOG_IPSND_PDQ_ENTER(pdqid, data, datapri);
    CHECK_INTCTX_UNL();
    CHECK_PDQID(pdqid);
    p_pdqcb = get_pdqcb(pdqid);
    CHECK_PAR(TMIN_DPRI <= datapri && datapri <= p_pdqcb->p_pdqinib->maxdpri);

    i_lock_cpu();
    if (p_pdqcb->p_pdqinib->pdqatr == TA_NOEXS) {
        ercd = E_NOEXS;
    }
    else if (send_pridata(p_pdqcb, data, datapri, &reqdsp)) {
        if (reqdsp) {
            reqflg = true;
        }
        ercd = E_OK;
    }
    else {
        ercd = E_TMOUT;
    }
    i_unlock_cpu();

error_exit:
    LOG_IPSND_PDQ_LEAVE(ercd);
    return(ercd);
}
Beispiel #2
0
ER
ista_ovr(ID tskid, OVRTIM ovrtim)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_ISTA_OVR_ENTER(tskid, ovrtim);
	CHECK_INTCTX_UNL();
	CHECK_OBJ(ovrinib.ovrhdr != NULL);
	CHECK_TSKID(tskid);
	CHECK_PAR(0U < ovrtim && ovrtim <= TMAX_OVRTIM);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else {
		p_tcb->leftotm = ovrtim;
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_ISTA_OVR_LEAVE(ercd);
	return(ercd);
}
Beispiel #3
0
ER
ista_alm(ID almid, RELTIM almtim)
{
	ALMCB	*p_almcb;
	ER		ercd;

	LOG_ISTA_ALM_ENTER(almid, almtim);
	CHECK_INTCTX_UNL();
	CHECK_ALMID(almid);
	CHECK_PAR(almtim <= TMAX_RELTIM);
	p_almcb = get_almcb(almid);

	i_lock_cpu();
	if (p_almcb->p_alminib->almatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (p_almcb->almsta) {
		tmevtb_dequeue(&(p_almcb->tmevtb));
	}
	else {
		p_almcb->almsta = true;
	}
	tmevtb_enqueue(&(p_almcb->tmevtb), almtim,
								(CBACK) call_almhdr, (void *) p_almcb);
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_ISTA_ALM_LEAVE(ercd);
	return(ercd);
}
ER
iact_tsk(ID tskid)
{
	ER		ercd;
	uint_t	ipri;
	
	LOG_IACT_TSK_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	ipri = get_ipri(tskid);

	i_lock_cpu();
	if (test_dormant(ipri)) {
		if(make_active(ipri)) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IACT_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #5
0
ER
iena_wai(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_IENA_WAI_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (TSTAT_DORMANT(p_tcb->tstat) || !(p_tcb->waifbd)) {
		ercd = E_OBJ;
	}
	else {
		p_tcb->waifbd = false;
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IENA_WAI_LEAVE(ercd);
	return(ercd);
}
Beispiel #6
0
ER
irel_wai(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_IREL_WAI_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (!TSTAT_WAITING(p_tcb->tstat)) {
		ercd = E_OBJ;
	}
	else {
		if (wait_release(p_tcb)) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IREL_WAI_LEAVE(ercd);
	return(ercd);
}
Beispiel #7
0
ER
idis_wai(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_IDIS_WAI_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (TSTAT_DORMANT(p_tcb->tstat)) {
		ercd = E_OBJ;
	}
	else if (p_tcb->waifbd) {
		ercd = E_QOVR;
	}
	else if (i_sense_texmask(p_tcb)) {
		p_tcb->waifbd = true;
		ercd = E_OK;
	}
	else {
		ercd = E_OBJ;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IDIS_WAI_LEAVE(ercd);
	return(ercd);
}
Beispiel #8
0
ER
imrot_rdq(PRI tskpri, ID prcid)
{
	ER		ercd;
	PCB		*p_pcb;
	PCB		*my_p_pcb;

	LOG_IMROT_RDQ_ENTER(tskpri, prcid);
	CHECK_INTCTX_UNL();
	CHECK_TPRI(tskpri);
	CHECK_PRCID(prcid);

	i_lock_cpu();
	p_pcb = i_acquire_tsk_lock_prcid(prcid);
	if (rotate_ready_queue(INT_PRIORITY(tskpri), p_pcb)) {
		my_p_pcb = get_my_p_pcb();
		my_p_pcb->reqflg = dispatch_request(p_pcb) ? true : my_p_pcb->reqflg;
	}
	ercd = E_OK;
	release_tsk_lock(p_pcb);
	i_unlock_cpu();

  error_exit:
	LOG_IMROT_RDQ_LEAVE(ercd);
	return(ercd);
}
ER
iact_tsk(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_IACT_TSK_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (TSTAT_DORMANT(p_tcb->tstat)) {
		if (make_active(p_tcb)) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	else if (!(p_tcb->actque)) {
		p_tcb->actque = true;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IACT_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #10
0
SYSCALL ER
iset_flg(ID flgid, FLGPTN setptn)
{
    FLGCB	*flgcb;
    TCB	*tcb;
    WINFO_FLG *winfo;
    ER	ercd;

    LOG_ISET_FLG_ENTER(flgid, setptn);
    CHECK_INTCTX_UNL();
    CHECK_FLGID(flgid);
    flgcb = get_flgcb(flgid);

    i_lock_cpu();
    flgcb->flgptn |= setptn;
    if (!(queue_empty(&(flgcb->wait_queue)))) {
        tcb = (TCB *)(flgcb->wait_queue.next);
        winfo = (WINFO_FLG *)(tcb->winfo);
        if (eventflag_cond(flgcb, winfo->waiptn,
                           winfo->wfmode, &(winfo->flgptn))) {
            queue_delete(&(tcb->task_queue));
            if (wait_complete(tcb)) {
                reqflg = TRUE;
            }
        }
    }
    ercd = E_OK;
    i_unlock_cpu();

exit:
    LOG_ISET_FLG_LEAVE(ercd);
    return(ercd);
}
Beispiel #11
0
ER
istp_ovr(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_ISTP_OVR_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_OBJ(ovrinib.ovrhdr != NULL);
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else {
		p_tcb->leftotm = 0U;
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_ISTP_OVR_LEAVE(ercd);
	return(ercd);
}
Beispiel #12
0
SYSCALL ER
isig_sem(ID semid)
{
	SEMCB	*semcb;
	TCB	*tcb;
	ER	ercd;
    
	LOG_ISIG_SEM_ENTER(semid);
	CHECK_INTCTX_UNL();
	CHECK_SEMID(semid);
	semcb = get_semcb(semid);

	i_lock_cpu();
	if (!queue_empty(&(semcb->wait_queue))) {
		tcb = (TCB *) queue_delete_next(&(semcb->wait_queue));
		if (wait_complete(tcb)) {
			reqflg = TRUE;
		}
		ercd = E_OK;
	}
	else if (semcb->semcnt < semcb->seminib->maxsem) {
		semcb->semcnt += 1;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

    exit:
	LOG_ISIG_SEM_LEAVE(ercd);
	return(ercd);
}
Beispiel #13
0
SYSCALL ER
iwup_tsk(ID tskid)
{
	TCB	*tcb;
	UINT	tstat;
	ER	ercd;

	LOG_IWUP_TSK_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	tcb = get_tcb(tskid);

	i_lock_cpu();
	if (TSTAT_DORMANT(tstat = tcb->tstat)) {
		ercd = E_OBJ;
	}
	else if ((tstat & TS_WAIT_SLEEP) != 0) {
		if (wait_complete(tcb)) {
			reqflg = TRUE;
		}
		ercd = E_OK;
	}
	else if (!(tcb->wupcnt)) {
		tcb->wupcnt = TRUE;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

    exit:
	LOG_IWUP_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #14
0
ER
istp_alm(ID almid)
{
	ALMCB	*p_almcb;
	ER		ercd;

	LOG_ISTP_ALM_ENTER(almid);
	CHECK_INTCTX_UNL();
	CHECK_ALMID(almid);
	p_almcb = get_almcb(almid);

	i_lock_cpu();
	if (p_almcb->p_alminib->almatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (p_almcb->almsta) {
		p_almcb->almsta = false;
		tmevtb_dequeue(&(p_almcb->tmevtb));
	}
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_ISTP_ALM_LEAVE(ercd);
	return(ercd);
}
Beispiel #15
0
ER
iwup_tsk(ID tskid)
{
	TCB		*p_tcb;
	ER		ercd;

	LOG_IWUP_TSK_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	p_tcb = get_tcb(tskid);

	i_lock_cpu();
	if (TSTAT_DORMANT(p_tcb->tstat)) {
		ercd = E_OBJ;
	}
	else if (TSTAT_WAIT_SLP(p_tcb->tstat)) {
		if (wait_complete(p_tcb)) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	else if (!(p_tcb->wupque)) {
		p_tcb->wupque = true;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IWUP_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #16
0
ER
ipsnd_dtq(ID dtqid, intptr_t data)
{
	DTQCB	*p_dtqcb;
	bool_t	reqdsp;
	ER		ercd;

	LOG_IPSND_DTQ_ENTER(dtqid, data);
	CHECK_INTCTX_UNL();
	CHECK_DTQID(dtqid);
	p_dtqcb = get_dtqcb(dtqid);

	i_lock_cpu();
	if (send_data(p_dtqcb, data, &reqdsp)) {
		if (reqdsp) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	else {
		ercd = E_TMOUT;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IPSND_DTQ_LEAVE(ercd);
	return(ercd);
}
Beispiel #17
0
ER
irot_rdq(PRI tskpri)
{
	QUEUE	*p_queue;
	ER		ercd;

	LOG_IROT_RDQ_ENTER(tskpri);
	CHECK_INTCTX_UNL();
	CHECK_TPRI(tskpri);

	i_lock_cpu();
	p_queue = &(ready_queue[INT_PRIORITY(tskpri)]);
	if (queue_empty(p_queue)) {
		ercd = E_OK;
	}
	else if ((((TCB *)(p_queue->p_next))->p_tinib->tskatr & TA_RSTR) != 0U) {
		ercd = E_NOSPT;
	}
	else {
		if (rotate_ready_queue(p_queue)) {
			reqflg = true;
		}
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_IROT_RDQ_LEAVE(ercd);
	return(ercd);
}
JSP_L1_CODE
SYSCALL ER
iras_tex(ID tskid, TEXPTN rasptn)
{
	TCB	*tcb;
	ER	ercd;

	LOG_IRAS_TEX_ENTER(tskid, rasptn);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	CHECK_PAR(rasptn != 0);
	tcb = get_tcb(tskid);

	i_lock_cpu();
	if (TSTAT_DORMANT(tcb->tstat) || tcb->tinib->texrtn == NULL) {
		ercd = E_OBJ;
	}
	else {
		tcb->texptn |= rasptn;
		if (tcb == runtsk && runtsk->enatex) {
			reqflg = TRUE;
		}
		ercd = E_OK;
	}
	i_unlock_cpu();

    exit:
	LOG_IRAS_TEX_LEAVE(ercd);
	return(ercd);
}
Beispiel #19
0
SYSCALL ER
iact_tsk(ID tskid)
{
	TCB	*tcb;
	ER	ercd;

	LOG_IACT_TSK_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	tcb = get_tcb(tskid);

	i_lock_cpu();
	if (TSTAT_DORMANT(tcb->tstat)) {
		if (make_active(tcb)) {
			reqflg = TRUE;
		}
		ercd = E_OK;
	}
	else if (!(tcb->actcnt)) {
		tcb->actcnt = TRUE;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	i_unlock_cpu();

    exit:
	LOG_IACT_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #20
0
SYSCALL ER
irel_wai(ID tskid)
{
	TCB	*tcb;
	ER	ercd;

	LOG_IREL_WAI_ENTER(tskid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	tcb = get_tcb(tskid);

	i_lock_cpu();
	if (!(TSTAT_WAITING(tcb->tstat))) {
		ercd = E_OBJ;
	}
	else {
		if (wait_release(tcb)) {
			reqflg = TRUE;
		}
		ercd = E_OK;
	}
	i_unlock_cpu();

    exit:
	LOG_IREL_WAI_LEAVE(ercd);
	return(ercd);
}
Beispiel #21
0
ER
iget_pid(ID *p_prcid)
{
	ER		ercd;

	LOG_IGET_PID_ENTER(p_prcid);
	CHECK_INTCTX_UNL();

	*p_prcid = (get_my_p_pcb())->prcid;
	ercd = E_OK;

  error_exit:
	LOG_IGET_PID_LEAVE(ercd, *p_prcid);
	return(ercd);
}
Beispiel #22
0
ER
iset_flg(ID flgid, FLGPTN setptn)
{
	FLGCB	*p_flgcb;
	QUEUE	*p_queue;
	TCB		*p_tcb;
	WINFO_FLG *p_winfo_flg;
	ER		ercd;
	PCB		*p_pcb;

	LOG_ISET_FLG_ENTER(flgid, setptn);
	CHECK_INTCTX_UNL();
	CHECK_FLGID(flgid);
	p_flgcb = get_flgcb(flgid);

	i_lock_cpu();
	i_acquire_obj_lock(&GET_OBJLOCK(p_flgcb));
	p_flgcb->flgptn |= setptn;
	p_queue = p_flgcb->wait_queue.p_next;
	while (p_queue != &(p_flgcb->wait_queue)) {
		p_tcb = (TCB *) p_queue;
		/* フラグのセットを非破壊コードにできないため,リトライしない */
		p_pcb = acquire_nested_tsk_lock_without_preemption(p_tcb);
		p_queue = p_queue->p_next;
		p_winfo_flg = (WINFO_FLG *)(&(p_tcb->winfo_obj));
		if (check_flg_cond(p_flgcb, p_winfo_flg->waiptn,
							p_winfo_flg->wfmode, &(p_winfo_flg->flgptn))) {
			queue_delete(&(p_tcb->task_queue));
			if (wait_complete(p_tcb)) {
				if (dispatch_request(p_pcb)){
					(get_my_p_pcb())->reqflg = true;
				}
			}
			if ((p_flgcb->p_flginib->flgatr & TA_CLR) != 0U) {
				release_nested_tsk_lock(p_pcb);
				break;
			}
		}
		release_nested_tsk_lock(p_pcb);
	}
	ercd = E_OK;
	release_obj_lock(&GET_OBJLOCK(p_flgcb));
	i_unlock_cpu();

  error_exit:
	LOG_ISET_FLG_LEAVE(ercd);
	return(ercd);
}
Beispiel #23
0
ER
iget_tid(ID *p_tskid)
{
	ER		ercd;

	LOG_IGET_TID_ENTER(p_tskid);
	CHECK_INTCTX_UNL();

	i_lock_cpu();
	*p_tskid = (p_runtsk == NULL) ? TSK_NONE : TSKID(p_runtsk);
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_IGET_TID_LEAVE(ercd, *p_tskid);
	return(ercd);
}
ER
iset_flg(ID flgid, FLGPTN setptn)
{
	FLGCB	*p_flgcb;
	QUEUE	*p_queue;
	TCB		*p_tcb;
	WINFO_FLG *p_winfo_flg;
	ER		ercd;

	LOG_ISET_FLG_ENTER(flgid, setptn);
	CHECK_INTCTX_UNL();
	CHECK_FLGID(flgid);
	p_flgcb = get_flgcb(flgid);

	i_lock_cpu();
	if (p_flgcb->p_flginib->flgatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else {
		p_flgcb->flgptn |= setptn;
		p_queue = p_flgcb->wait_queue.p_next;
		while (p_queue != &(p_flgcb->wait_queue)) {
			p_tcb = (TCB *) p_queue;
			p_queue = p_queue->p_next;
			p_winfo_flg = (WINFO_FLG *)(p_tcb->p_winfo);
			if (check_flg_cond(p_flgcb, p_winfo_flg->waiptn,
							p_winfo_flg->wfmode, &(p_winfo_flg->flgptn))) {
				queue_delete(&(p_tcb->task_queue));
				if (wait_complete(p_tcb)) {
					reqflg = true;
				}
				if ((p_flgcb->p_flginib->flgatr & TA_CLR) != 0U) {
					break;
				}
			}
		}
		ercd = E_OK;
	}
	i_unlock_cpu();

  error_exit:
	LOG_ISET_FLG_LEAVE(ercd);
	return(ercd);
}
ER
imact_tsk(ID tskid, ID prcid)
{
	TCB		*p_tcb;
	ER		ercd;
	PCB		*t_p_pcb;
	PCB		*f_p_pcb;

	LOG_IMACT_TSK_ENTER(tskid, prcid);
	CHECK_INTCTX_UNL();
	CHECK_TSKID(tskid);
	CHECK_PRCID_INI(prcid);
	p_tcb = get_tcb(tskid);
	prcid = (prcid == TPRC_INI)? p_tcb->p_tinib->iaffinity : prcid;
	CHECK_MIG(p_tcb->p_tinib->affinity_mask, prcid);

	i_lock_cpu();
	/* 現在割り付けられているプロセッサと移動先のプロセッサのタスクロックを取得 */
	i_acquire_dual_tsk_lock(p_tcb, prcid, &f_p_pcb, &t_p_pcb);
	if (TSTAT_DORMANT(p_tcb->tstat)) {
		LOG_TSKMIG(p_tcb, f_p_pcb->prcid, prcid);
		p_tcb->p_pcb = t_p_pcb;
		if (make_active(p_tcb)) {
			if (dispatch_request(t_p_pcb)) {
				t_p_pcb->reqflg = true;
			}
		}
		ercd = E_OK;
	}
	else if (!(p_tcb->actque)) {
		p_tcb->actque = true;
		p_tcb->actprc = prcid;
		ercd = E_OK;
	}
	else {
		ercd = E_QOVR;
	}
	release_dual_tsk_lock(f_p_pcb, t_p_pcb);
	i_unlock_cpu();

  error_exit:
	LOG_IMACT_TSK_LEAVE(ercd);
	return(ercd);
}
Beispiel #26
0
ER
irot_rdq(PRI tskpri)
{
	ER		ercd;

	LOG_IROT_RDQ_ENTER(tskpri);
	CHECK_INTCTX_UNL();
	CHECK_TPRI(tskpri);

	i_lock_cpu();
	if (rotate_ready_queue(INT_PRIORITY(tskpri))) {
		reqflg = true;
	}
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_IROT_RDQ_LEAVE(ercd);
	return(ercd);
}
Beispiel #27
0
ER
irot_rdq(PRI tskpri)
{
	ER		ercd;
	PCB		*my_p_pcb;

	LOG_IROT_RDQ_ENTER(tskpri);
	CHECK_INTCTX_UNL();
	CHECK_TPRI(tskpri);

	i_lock_cpu();
	my_p_pcb = i_acquire_tsk_lock_self();
	if (rotate_ready_queue(INT_PRIORITY(tskpri), my_p_pcb)) {
		my_p_pcb->reqflg = true;
	}
	ercd = E_OK;
	release_tsk_lock(my_p_pcb);
	i_unlock_cpu();

  error_exit:
	LOG_IROT_RDQ_LEAVE(ercd);
	return(ercd);
}
Beispiel #28
0
ER
ifsnd_dtq(ID dtqid, intptr_t data)
{
	DTQCB	*p_dtqcb;
	ER		ercd;

	LOG_IFSND_DTQ_ENTER(dtqid, data);
	CHECK_INTCTX_UNL();
	CHECK_DTQID(dtqid);
	p_dtqcb = get_dtqcb(dtqid);
	CHECK_ILUSE(p_dtqcb->p_dtqinib->dtqcnt > 0U);

	i_lock_cpu();
	if (force_send_data(p_dtqcb, data)) {
		reqflg = true;
	}
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_IFSND_DTQ_LEAVE(ercd);
	return(ercd);
}
Beispiel #29
0
ER
isig_sem(ID semid)
{
    SEMCB	*p_semcb;
    TCB		*p_tcb;
    ER		ercd;

    LOG_ISIG_SEM_ENTER(semid);
    CHECK_INTCTX_UNL();
    CHECK_SEMID(semid);
    p_semcb = get_semcb(semid);

    i_lock_cpu();
    if (p_semcb->p_seminib->sematr == TA_NOEXS) {
        ercd = E_NOEXS;
    }
    else if (!queue_empty(&(p_semcb->wait_queue))) {
        p_tcb = (TCB *) queue_delete_next(&(p_semcb->wait_queue));
        if (wait_complete(p_tcb)) {
            reqflg = true;
        }
        ercd = E_OK;
    }
    else if (p_semcb->semcnt < p_semcb->p_seminib->maxsem) {
        p_semcb->semcnt += 1;
        ercd = E_OK;
    }
    else {
        ercd = E_QOVR;
    }
    i_unlock_cpu();

error_exit:
    LOG_ISIG_SEM_LEAVE(ercd);
    return(ercd);
}