示例#1
0
文件: dispatch.c 项目: rroart/freevms
int f11b_io_done(struct _irp * i)
{
    void (*func)(unsigned long);
    // move user_status into irp$l_media
    if (i->irp$l_iosb==0)   // not set, or something vipes the irp
    {
        i->irp$l_iost1=SS$_NORMAL;  // temporary value, must be set
    }
    else
    {
        i->irp$l_iost1=((struct _iosb *)i->irp$l_iosb)->iosb$w_status;
    }
    // decr vcb transaction count
    // clear namestring
    // copy local fib back intro the complex buffer packet
    // set irp$l_bcnt to abd$c_attrib

    // call check-dismount

    setipl(IPL$_ASTDEL);
    ioc$bufpost(i);

    sch$postef(i->irp$l_pid,0,i->irp$b_efn);

    func=i->irp$l_wind; //really acb$l_kast
    func(i);

    setipl(0);
}
示例#2
0
int lck$grant_lock(struct _lkb * lck,struct _rsb * res, signed int curmode, signed int nextmode, int flags, int efn, signed int ggmode) {
  int retsts=SS$_NORMAL;
  int blocking = 0;

  if (ggmode==-1 || nextmode>curmode) {
    res->rsb$b_ggmode=nextmode;
    res->rsb$b_fgmode=nextmode;
    res->rsb$b_cgmode=nextmode;
  }

  lck->lkb$b_grmode=nextmode;
  lck->lkb$l_lkst1=SS$_NORMAL;

  // check timeout queue

  if (lck->lkb$l_blkastadr) {
    struct _lkb * head = &res->rsb$l_cvtqfl;
    int diff=((char*)&head->lkb$l_sqfl)-((char*)head);
    struct _lkb * next = res->rsb$l_cvtqfl - diff;
    head=((unsigned long)head)-diff;

    res->rsb$w_blkastcnt++;

    while (head!=next) {
      // two like whiles. remember to copy
      if (0==test_bit(nextmode,&lck$ar_compat_tbl[next->lkb$b_rqmode])) {
	blocking = 1;
	goto endblockchk;
      }
      next=next->lkb$l_sqfl-diff;
    }

    head = &res->rsb$l_wtqfl;
    next = res->rsb$l_wtqfl - diff;
    head=((unsigned long)head)-diff;

    while (head!=next) {
      // two like whiles. remember to copy
      if (0==test_bit(nextmode,&lck$ar_compat_tbl[next->lkb$b_rqmode])) {
	blocking = 1;
	goto endblockchk;
      }
      next=next->lkb$l_sqfl-diff;
    }
  }
 endblockchk:

  insque(&lck->lkb$l_sqfl,res->rsb$l_grqfl);
  lck->lkb$b_state=LKB$K_GRANTED;

  retsts=SS$_SYNCH;

  lck->lkb$b_rmod|=ACB$M_NODELETE;
  lck->lkb$b_rmod&=~(LKB$M_KAST|LKB$M_PKAST);

  if (blocking || lck->lkb$l_cplastadr || (lck->lkb$l_status&LKB$M_ASYNC)) {

    if (blocking && lck->lkb$l_cplastadr) {
      lck->lkb$l_status|=LKB$M_DCPLAST;
      lck->lkb$l_oldastprm=lck->lkb$l_astprm;
      lck->lkb$b_rmod|=LKB$M_PKAST;
    }

    if (blocking) {
      lck->lkb$l_ast=lck->lkb$l_blkastadr;
    } else {
      lck->lkb$l_ast=lck->lkb$l_cplastadr;
    }

    if (lck->lkb$l_status&LKB$M_ASYNC || (lck->lkb$b_rmod&LKB$M_PKAST)) {
      if (0==(lck->lkb$b_rmod&LKB$M_PKAST)) {
	lck->lkb$b_rmod|=LKB$M_KAST;
      }
      lck->lkb$l_kast=lock_iosb_kast;
      lck->lkb$l_astprm=lck;
    }

#if 0
    if (lck->lkb$l_cplastadr && (lck->lkb$l_flags&LCK$M_SYNCSTS)==0) {
      lck->lkb$l_ast=lck->lkb$l_cplastadr;
    }
#endif

    sch$qast(lck->lkb$l_pid,PRI$_RESAVL,lck);
  }

  //if (current->pcb$w_state!=SCH$C_CUR)

  sch$postef(lck->lkb$l_pid,PRI$_RESAVL,lck->lkb$b_efn);

  return retsts;
}
示例#3
0
asmlinkage int exe$setef(unsigned int efn) {
  struct _pcb * p=current;
  return sch$postef(p->pcb$l_pid,PRI$_IOCOM,efn);
}
示例#4
0
asmlinkage int exe$getjpi(unsigned int efn, unsigned int *pidadr, void * prcnam, void *itmlst, struct _iosb *iosb, void (*astadr)(), unsigned long long astprm)
{
    struct _pcb * p;
    int sts;
    struct item_list_3 * it=itmlst;
    /** test list item entries */
    /** use pidadr - MISSING */
    /** clear event flag */
    exe$clref(efn);
    /** find next pcb */
    sts=exe$pscan_next_id(&p);
    if (sts==0)
        return SS$_NOMOREPROC;
    /** invoke nampid - MISSING */
    /** if other node, cwps - MISSING */
    /** iosb writecheck - MISSING */
    /** if ast, check ast quota and charge - MISSING */
    /** writetest for buffer descriptors - MISSING */
    /** gather some usual informastion - TODO still more remains */
    while (it->item_code)
    {
        switch (it->item_code)
        {
        case JPI$_PRCNAM:
            memcpy(it->bufaddr,&p->pcb$t_lname,15);
            break;

        case JPI$_PID:
            memcpy(it->bufaddr,&p->pcb$l_epid,4);
            break;

        case JPI$_MASTER_PID:
            memcpy(it->bufaddr,&p->pcb$l_pid,4);
            break;

        case JPI$_STATE:
            *(unsigned long *)it->bufaddr=p->pcb$w_state;
            break;

        case JPI$_PRI:
            *(unsigned long *)it->bufaddr=p->pcb$b_pri;
            break;

        case JPI$_PAGEFLTS:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_pageflts;
            break;

        case JPI$_PPGCNT:
            *(unsigned long *)it->bufaddr=p->pcb$l_ppgcnt;
            break;

        case JPI$_GPGCNT:
            *(unsigned long *)it->bufaddr=p->pcb$l_gpgcnt;
            break;

        case JPI$_WSAUTH:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_wsauth;
            break;

        case JPI$_WSQUOTA:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_wsquota;
            break;

        case JPI$_WSSIZE:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_wssize;
            break;

        case JPI$_WSAUTHEXT:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_wsauthext;
            break;

        case JPI$_WSEXTENT:
            *(unsigned long *)it->bufaddr=p->pcb$l_phd->phd$l_wsextent;
            break;

        case JPI$_BIOCNT:
            *(unsigned short *)it->bufaddr=p->pcb$w_biocnt;
            break;

        case JPI$_BIOLM:
            *(unsigned short *)it->bufaddr=p->pcb$w_biolm;
            break;

        case JPI$_DIOCNT:
            *(unsigned short *)it->bufaddr=p->pcb$w_diocnt;
            break;

        case JPI$_DIOLM:
            *(unsigned short *)it->bufaddr=p->pcb$w_diolm;
            break;

        case JPI$_CPUTIM:
            *(long long *)it->bufaddr=p->pcb$l_phd->phd$l_cputim;
            break;

        case JPI$_DIRIO:
            *(unsigned int *)it->bufaddr=p->pcb$l_phd->phd$l_diocnt;
            break;

        case JPI$_BUFIO:
            *(unsigned int *)it->bufaddr=p->pcb$l_phd->phd$l_biocnt;
            break;

        }
        it++;
    }

    /** post event flag */
    struct _pcb * pcb = ctl$gl_pcb;
    sch$postef(pcb->pcb$l_pid, PRI$_NULL, efn);

    /** eventual ast queue - MISSING */

    /** eventual iosb write */
    if (iosb)
        iosb->iosb$w_status=SS$_NORMAL;

    return SS$_NORMAL;

    /** handle target process, kast etc - MISSING */
    /** handle target process, status, state - MISSING */

}