Пример #1
0
static void wait_handler(struct spawn_binding *b, domainid_t domainid,
                         bool nohang)
{
    errval_t err;
    struct ps_entry *ps = ps_get(domainid);

    if(ps == NULL) {
        err = b->tx_vtbl.wait_response(b, NOP_CONT, 0, SPAWN_ERR_DOMAIN_NOTFOUND);
        if(err_is_fail(err)) {
            DEBUG_ERR(err, "wait_response");
        }
    }

    if(!nohang || ps->status == PS_STATUS_ZOMBIE) {
        // Enqueue the waiter
        struct ps_waiter *waiter = malloc(sizeof(struct ps_waiter));
        assert(waiter != NULL);
        waiter->next = ps->waiters;
        waiter->binding = b;
        ps->waiters = waiter;
    } else {
        // nohang and no zombie, return error
        err = b->tx_vtbl.wait_response(b, NOP_CONT, 0, SPAWN_ERR_DOMAIN_RUNNING);
        if(err_is_fail(err)) {
            DEBUG_ERR(err, "wait_response");
        }
    }

    // Cleanup if zombie (will send the reply)
    if(ps->status == PS_STATUS_ZOMBIE) {
        cleanup_domain(domainid);
    }
}
Пример #2
0
void encode_domain_in_integers( void )

{

  int i,j;

  collect_all_strings();

  if ( gcmd_line.display_info == 102 ) {
    printf("\nconstant table:");
    for ( i = 0; i < gnum_constants; i++ ) {
      printf("\n%d --> %s", i, gconstants[i]);
    }

    printf("\n\ntypes table:");
    for ( i = 0; i < gnum_types; i++ ) {
      printf("\n%d --> %s: ", i, gtype_names[i]);
      for ( j = 0; j < gtype_size[i]; j++ ) {
	printf("%d ", gtype_consts[i][j]);
      }
    }

    printf("\n\npredicates table:");
    for ( i = 0; i < gnum_predicates; i++ ) {
      printf("\n%3d --> %s: ", i, gpredicates[i]);
      for ( j = 0; j < garity[i]; j++ ) {
	printf("%s ", gtype_names[gpredicates_args_type[i][j]]);
      }
    }
    printf("\n\n");
  }


  create_integer_representation();

  cleanup_domain();

  if ( gcmd_line.display_info == 103 ) {
    printf("\n\ncoded initial state is:");
    for ( i = 0; i < gnum_full_initial; i++ ) {
      printf("\n");
      print_Fact( &(gfull_initial[i]) );
    }

    printf("\n\ncoded goal state is:");
    for ( i = 0; i < gnum_goal; i++ ) {
      printf("\n");
      print_Fact( &(ggoal[i]) );
    }

    printf("\n\ncoded operators are:");
    for ( i = 0; i < gnum_operators; i++ ) {
      print_Operator( goperators[i] );
    }
    printf("\n\n");
  }

}
Пример #3
0
static errval_t kill_domain(domainid_t domainid, uint8_t exitcode)
{
    struct ps_entry *ps = ps_get(domainid);

    if(ps == NULL) {
        return SPAWN_ERR_DOMAIN_NOTFOUND;
    }

    ps->status = PS_STATUS_ZOMBIE;
    ps->exitcode = exitcode;

    // Garbage collect victim's capabilities
    cleanup_cap(ps->dcb);       // Deschedule dispatcher (do this first!)
    cleanup_cap(ps->rootcn_cap);

    if(ps->waiters != NULL) {
        // Cleanup local data structures and inform waiters
        cleanup_domain(domainid);
    }

    return SYS_ERR_OK;
}