当前位置: 首页>>代码示例>>C++>>正文


C++ err_is_fail函数代码示例

本文整理汇总了C++中err_is_fail函数的典型用法代码示例。如果您正苦于以下问题:C++ err_is_fail函数的具体用法?C++ err_is_fail怎么用?C++ err_is_fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了err_is_fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bind_lmp_reply

static void bind_lmp_reply(struct monitor_binding *b,
                           errval_t msgerr, uintptr_t mon_conn_id,
                           uintptr_t user_conn_id, struct capref ep)
{
    errval_t err;
    struct monitor_binding *client_binding = NULL;

    struct lmp_conn_state *conn = lmp_conn_lookup(mon_conn_id);
    if (conn == NULL) {
        DEBUG_ERR(0, "invalid connection ID");
        goto cleanup;
    }

    client_binding = conn->domain_binding;
    uintptr_t client_conn_id = conn->domain_id;

    err = lmp_conn_free(mon_conn_id);
    assert(err_is_ok(err));

    if (err_is_fail(msgerr)) {
        bind_lmp_reply_client_cont(client_binding, msgerr, 0, client_conn_id,
                                   ep, b);
    } else {
        bind_lmp_reply_client_cont(client_binding, SYS_ERR_OK, mon_conn_id,
                                   client_conn_id, ep, b);
    }
    return;

cleanup:
    /* Delete the ep cap */
    // XXX: Do not delete the cap if client or service is monitor
    if (client_binding != &monitor_self_binding && b != &monitor_self_binding) {
        err = cap_destroy(ep);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "cap_destroy failed");
        }
    }
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:38,代码来源:monitor_server.c

示例2: nameservice_lookup

/**
 * \brief Non-blocking name service lookup
 *
 * \param iface Name of interface for which to query name server
 * \param retiref Returns pointer to IREF on success
 */
errval_t nameservice_lookup(const char *iface, iref_t *retiref)
{
    errval_t err;

    struct octopus_rpc_client *r = get_octopus_rpc_client();
    if (r == NULL) {
        return LIB_ERR_NAMESERVICE_NOT_BOUND;
    }

    char* record = NULL;
    octopus_trigger_id_t tid;
    errval_t error_code;
    err = r->vtbl.get(r, iface, NOP_TRIGGER, &record, &tid, &error_code);
    if (err_is_fail(err)) {
        goto out;
    }
    err = error_code;
    if (err_is_fail(err)) {
        if (err_no(err) == OCT_ERR_NO_RECORD) {
            err = err_push(err, LIB_ERR_NAMESERVICE_UNKNOWN_NAME);
        }
        goto out;
    }

    uint64_t iref_number = 0;
    err = oct_read(record, "_ { iref: %d }", &iref_number);
    if (err_is_fail(err) || iref_number == 0) {
        err = err_push(err, LIB_ERR_NAMESERVICE_INVALID_NAME);
        goto out;
    }
    if (retiref != NULL) {
        *retiref = iref_number;
    }

out:
    free(record);
    return err;
}
开发者ID:Karamax,项目名称:arrakis,代码行数:44,代码来源:nameservice_client.c

示例3: arrakis_spawn_arrakis_domain__rpc

/*
 * RPC wrapper functions
 */
static  errval_t arrakis_spawn_arrakis_domain__rpc(struct arrakis_rpc_client *_rpc, const char *path, const char *argvbuf, size_t argvbytes, const char *envbuf, size_t envbytes, arrakis_errval_t *err, arrakis_domainid_t *domain_id)
{
    errval_t _err = SYS_ERR_OK;
    assert(!(_rpc->rpc_in_progress));
    assert((_rpc->async_error) == SYS_ERR_OK);
    _rpc->rpc_in_progress = true;
    _rpc->reply_present = false;
    
    // call send function
    _err = ((((_rpc->b)->tx_vtbl).spawn_arrakis_domain_call)(_rpc->b, NOP_CONT, path, argvbuf, argvbytes, envbuf, envbytes));
    if (err_is_fail(_err)) {
        goto out;
    }
    
    // wait for message to be sent and reply or error to be present
    while (((!(_rpc->reply_present)) || (!(((_rpc->b)->can_send)(_rpc->b)))) && ((_rpc->async_error) == SYS_ERR_OK)) {
        _err = event_dispatch(&(_rpc->rpc_waitset));
        if (err_is_fail(_err)) {
            _err = err_push(_err, LIB_ERR_EVENT_DISPATCH);
            goto out;
        }
    }
    
    if (err_is_fail(_rpc->async_error)) {
        _err = (_rpc->async_error);
        _rpc->async_error = SYS_ERR_OK;
        goto out;
    }
    
    // grab reply variables out of binding
    struct arrakis_binding *_binding = _rpc->b;
    *err = (((_binding->rx_union).spawn_arrakis_domain_response).err);
    *domain_id = (((_binding->rx_union).spawn_arrakis_domain_response).domain_id);
    
    out:
    _rpc->rpc_in_progress = false;
    return(_err);
}
开发者ID:XuNazgul,项目名称:cmpe295A,代码行数:41,代码来源:arrakis_flounder_extra_bindings.c

示例4: send_ints_ready

static void send_ints_ready(void *a)
{
    errval_t err;

    struct xmplmsg_binding *b = (struct xmplmsg_binding*)a;

    struct event_closure txcont = MKCONT(send_ints_cb, b);

    err = xmplmsg_msg_ints__tx(b, txcont, 0x1, 0x10);

    if (err_is_fail(err)) {
      DEBUG_ERR(err, "error sending msg_ints message\n");
    }
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:14,代码来源:msg.c

示例5: default_start_function

errval_t default_start_function(coreid_t where, struct module_info* mi,
                                char* record)
{
    assert(mi != NULL);
    errval_t err = SYS_ERR_OK;

    if (is_started(mi)) {
        return KALUGA_ERR_DRIVER_ALREADY_STARTED;
    }

    if (!is_auto_driver(mi)) {
        return KALUGA_ERR_DRIVER_NOT_AUTO;
    }

    // Construct additional command line arguments containing pci-id.
    // We need one extra entry for the new argument.
    uint64_t vendor_id, device_id;
    char **argv = mi->argv;
    bool cleanup = false;
    err = oct_read(record, "_ { vendor: %d, device_id: %d }",
                   &vendor_id, &device_id);
    if (err_is_ok(err)) {
        // We assume that we're starting a device if the query above succeeds
        // and therefore append the pci vendor and device id to the argument
        // list.
        argv = malloc((mi->argc+1) * sizeof(char *));
        memcpy(argv, mi->argv, mi->argc * sizeof(char *));
        char *pci_id  = malloc(10);
        // Make sure pci vendor and device id fit into our argument
        assert(vendor_id < 0x9999 && device_id < 0x9999);
        snprintf(pci_id, 10, "%04"PRIx64":%04"PRIx64, vendor_id, device_id);
        argv[mi->argc] = pci_id;
        mi->argc += 1;
        argv[mi->argc] = NULL;
        cleanup = true;
    }
    err = spawn_program(where, mi->path, argv,
                        environ, 0, &mi->did);

    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Spawning %s failed.", mi->path);
    }
    if (cleanup) {
        // alloc'd string is the last of our array
        free(argv[mi->argc-1]);
        free(argv);
    }

    return err;
}
开发者ID:huiweics,项目名称:arrakis,代码行数:50,代码来源:driver_startup.c

示例6: main

int main(int argc, char *argv[])
{
    vfs_init();
    vfs_mkdir("/fat");
    
    errval_t err = vfs_mount("/fat", "fat32://0+0");
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "vfs_fat_mount failed");
    }

    walk_dir("/fat");

    return 0;
}
开发者ID:Karamax,项目名称:arrakis,代码行数:14,代码来源:fat_test.c

示例7: debug_dump_region

errval_t debug_dump_region(struct debug_q* que, regionid_t rid) 
{
    errval_t err;
    // find region
    struct memory_list* region = NULL;

    err = find_region(que, &region, rid);
    if (err_is_fail(err)){
        return err;
    }

    dump_list(region);
    return SYS_ERR_OK;
}
开发者ID:BarrelfishOS,项目名称:barrelfish,代码行数:14,代码来源:devif_backend_debug.c

示例8: startup_alloc_init

/**
 * \brief Map init user-space memory.
 *
 * This function maps pages of the init user-space module. It expects
 * the virtual base address 'vbase' of a program segment of the init executable,
 * its size 'size' and its ELF64 access control flags. It maps pages
 * into physical memory that is allocated on the fly and puts
 * corresponding frame caps into init's segcn.
 *
 * \param vbase Virtual base address of program segment.
 * \param size  Size of program segment in bytes.
 * \param flags ELF64 access control flags of program segment.
 * \param ret   Used to return base region pointer
 */
errval_t startup_alloc_init(void *state, genvaddr_t gvbase, size_t size,
                            uint32_t flags, void **ret)
{

    errval_t err;

    struct spawn_state *spawn_state = state;

    lvaddr_t vbase = (lvaddr_t)gvbase; /* XXX */
    lvaddr_t offset = BASE_PAGE_OFFSET(vbase);

    /* Page align the parameters */
    paging_align(&vbase, NULL, &size, BASE_PAGE_SIZE);

    lpaddr_t pbase = 0, paddr = 0;
    for(lvaddr_t i = vbase; i < vbase + size; i += BASE_PAGE_SIZE) {
        if (apic_is_bsp()) {
            paddr = bsp_alloc_phys(BASE_PAGE_SIZE);
        } else {
            paddr = app_alloc_phys(BASE_PAGE_SIZE);
        }

        if(pbase == 0) {
            pbase = paddr;
        }

        err = startup_map_init(i, paddr, BASE_PAGE_SIZE, flags);
        assert(err_is_ok(err));
    }

    if (apic_is_bsp()) {
        // Create frame caps for segcn
        paddr += BASE_PAGE_SIZE;

        debug(SUBSYS_STARTUP,
              "Allocated physical memory [0x%"PRIxLPADDR", 0x%"PRIxLPADDR"]\n",
              pbase, paddr - pbase);

        err = create_caps_to_cnode(pbase, paddr - pbase,
                                   RegionType_RootTask, spawn_state, bootinfo);
        if (err_is_fail(err)) {
            return err;
        }
    }

    assert(ret != NULL);
    *ret = (void *)(vbase + offset);

    return SYS_ERR_OK;
}
开发者ID:achreto,项目名称:barrelfish,代码行数:64,代码来源:startup_x86.c

示例9: usb_manager_rpc_client_error

/*
 * Error handler
 */
static  void usb_manager_rpc_client_error(struct usb_manager_binding *_binding, errval_t _err)
{
    // get RPC client state pointer
    struct usb_manager_rpc_client *_rpc = _binding->st;
    
    if (_rpc->rpc_in_progress) {
        assert(err_is_fail(_err));
        _rpc->async_error = _err;
        // kick waitset with dummy event
        flounder_support_register(&(_rpc->rpc_waitset), &(_rpc->dummy_chanstate), dummy_event_closure, true);
    } else {
        USER_PANIC_ERR(_err, "async error in RPC");
    }
}
开发者ID:XuNazgul,项目名称:cmpe295A,代码行数:17,代码来源:usb_manager_flounder_extra_bindings.c

示例10: udp_receiver

static void
udp_receiver(struct udp_pcb *upcb, struct ip_addr *listen_ip,
        uint16_t listen_port)
{
    printf("U: Going in UDP_RECEIVER mode\n");
    // Bind to specified port
    errval_t r = udp_bind(upcb, listen_ip, listen_port);
    if (err_is_fail(r)) {
        DEBUG_ERR(r, "udp_bind:");
    }

    lwip_benchmark_control(connection_type, BMS_START_REQUEST,
            iterations, rdtsc());
    udp_recv(upcb, udp_recv_handler, 0 /*client data, arg in callback*/);

    while (true) {
        r = event_dispatch(ws);
        if (err_is_fail(r)) {
            DEBUG_ERR(r, "in event_dispatch");
            break;
        }
    }
} // end function: udp_receiver
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:23,代码来源:udp_test.c

示例11: interdisp_msg_handler

/**
 * \brief Handler thread for inter-dispatcher messages
 * \param arg   Pointer to inter-dispatcher waitset
 * \return 0 on successful exit
 */
static int interdisp_msg_handler(void *arg)
{
    struct waitset *ws = arg;
    assert(ws != NULL);

    for(;;) {
        errval_t err = event_dispatch(ws);
        if(err_is_fail(err)) {
            USER_PANIC_ERR(err, "error on event dispatch");
        }
    }

    return 0;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:19,代码来源:domain.c

示例12: sys_monitor_clear_step

struct sysret sys_monitor_clear_step(capaddr_t ret_cn_addr,
                                     uint8_t ret_cn_bits,
                                     cslot_t ret_slot)
{
    errval_t err;

    struct cte *retslot;
    err = sys_retslot_lookup(ret_cn_addr, ret_cn_bits, ret_slot, &retslot);
    if (err_is_fail(err)) {
        return SYSRET(err);
    }

    return SYSRET(caps_clear_step(retslot));
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:14,代码来源:monitor.c

示例13: server_listening

/**
 * \brief Called when domain gets a interdisp service.
 * It will set it on the domain_state.
 */
static void server_listening(void *st, errval_t err, iref_t iref)
{
    if(err_is_fail(err)) {
        DEBUG_ERR(err, "interdisp service export");
        abort();
    }

    struct domain_state *domain_state = get_domain_state();
    domain_state->iref = iref;

    // Also set in the global array
    allirefs[disp_get_core_id()] = iref;
    domain_state->conditional = true;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:18,代码来源:domain.c

示例14: revoke_cap

static void revoke_cap(struct xcorecap_binding *b)
{
    errval_t err;
    printf("xcorecapserv do revoke cap\n");
    err = cap_revoke(sent_cap);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "xcorecapserv: revoke failed\n");    
    } 

    printf("xcorecapserv revoked cap\n");
    fflush(stdout);

    b->tx_vtbl.send_done(b, NOP_CONT);
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:14,代码来源:xcorecapserv.c

示例15: sys_monitor_revoke_mark_tgt

struct sysret sys_monitor_revoke_mark_tgt(capaddr_t root_addr, uint8_t root_bits,
                                          capaddr_t target_addr, uint8_t target_bits)
{
    errval_t err;

    struct cte *target;
    err = sys_double_lookup(root_addr, root_bits, target_addr, target_bits, &target);
    if (err_is_fail(err)) {
        printf("%s: error in double_lookup: %"PRIuERRV"\n", __FUNCTION__, err);
        return SYSRET(err);
    }

    return SYSRET(caps_mark_revoke(&target->cap, target));
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:14,代码来源:monitor.c


注:本文中的err_is_fail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。