Exemplo n.º 1
0
static void start_lock()
{
    struct dsc$descriptor_s name_s;
    int status;
    char *name = "PINGLOCK";

    cur_mode = LCK$K_EXMODE;

    *lvb_int = us-1;

/* Make a descriptor of the name */
    memset(&name_s, 0, sizeof(struct dsc$descriptor_s));
    name_s.dsc$w_length = strlen(name);
    name_s.dsc$a_pointer = name;

    /* Lock it */
    status = sys$enqw(0,
		      cur_mode,
		      &our_lksb,
		      0, /* flags */
		      &name_s,
		      0, /* parent */
		      compast_routine,
		      0, /* astp */
		      blockast_routine,
		      PSL$C_USER,
		      RSDM$K_PROCESS_RSDM_ID,
		      0);

    if (status != SS$_NORMAL)
    {
        printf("lock enq failed : %s\n", strerror(EVMSERR, status));
	sys$exit(status);
    }

    printf("Lock ID is %x\n", our_lksb.sb_lkid);
    return;
}
Exemplo n.º 2
0
asmlinkage int exe$enqw_wrap(struct struct_args * s) {
  return exe$enqw(s->s1,s->s2,s->s3,s->s4,s->s5,s->s6,s->s7,s->s8,s->s9,s->s10,s->s11);
}
Exemplo n.º 3
0
main(){
  struct _lksb lksb;
  unsigned int status, lkmode, flags;

  lkmode = LCK$K_NLMODE;

  flags = 0;//LCK$M_SYSTEM;

  status = sys$enqw(0,
		    lkmode,
		    &lksb,
		    flags,
		    &resource,
		    0, ast, 42, blkast, 0, 0);

  printf("main %x %x %x %x\n",getpid(),status,lksb.lksb$w_status,lksb.lksb$l_lkid);

  sleep (10);

  lkmode = LCK$K_PWMODE;
  flags = LCK$M_CONVERT;

  printf("a %x\n",getpid());

  status = sys$enqw(0,
		    lkmode,
		    &lksb,
		    flags,
		    0, 0, ast, 43, blkast, 0, 0);

  printf("a %x %x %x %x\n",getpid(),status,lksb.lksb$w_status,lksb.lksb$l_lkid)\
    ;

  sleep (10);

  lkmode = LCK$K_PRMODE;

  lkmode = LCK$K_PRMODE;
  flags = LCK$M_CONVERT;

  printf("b %x\n",getpid());

  status = sys$enqw(0,
		    lkmode,
		    &lksb,
		    flags,
		    0, 0, ast, 44, blkast, 0, 0);

  printf("b %x %x %x %x\n",getpid(),status,lksb.lksb$w_status,lksb.lksb$l_lkid)\
    ;

  sleep (10);

  status = sys$deq(lksb.lksb$l_lkid,0,0,0);

  printf("c %x %x %x %x\n",getpid(),status,lksb.lksb$w_status,lksb.lksb$l_lkid)\
    ;

  sleep(20);

}