本文整理汇总了C++中err_push函数的典型用法代码示例。如果您正苦于以下问题:C++ err_push函数的具体用法?C++ err_push怎么用?C++ err_push使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了err_push函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: request_trace_caps
errval_t request_trace_caps(struct intermon_binding *st)
{
errval_t err = st->tx_vtbl.trace_caps_request(st, NOP_CONT);
if (err_is_fail(err)) {
return err_push(err, MON_ERR_SEND_REMOTE_MSG);
}
while(capref_is_null(trace_cap)) {
messages_wait_and_handle_next();
}
return SYS_ERR_OK;
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:12,代码来源:main.c
示例2: lmp_chan_alloc_recv_slot
/**
* \brief Allocate a new receive capability slot for an LMP channel
*
* This utility function allocates a new receive slot (using #slot_alloc)
* and sets it on the channel (using #lmp_chan_set_recv_slot).
*
* \param lc LMP channel
*/
errval_t lmp_chan_alloc_recv_slot(struct lmp_chan *lc)
{
struct capref slot;
errval_t err = slot_alloc(&slot);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_SLOT_ALLOC);
}
lmp_chan_set_recv_slot(lc, slot);
return SYS_ERR_OK;
}
开发者ID:BarrelfishOS,项目名称:barrelfish,代码行数:20,代码来源:lmp_chan.c
示例3: bif_parse_any_ast_literal_compound
static void bif_parse_any_ast_literal_compound(
struct Runtime *rt,
struct AstLiteralCompound *lit_cpd)
{
VAL_LOC_T size_loc = -1, data_begin, data_size;
struct AstNode *current = lit_cpd->exprs;
bool has_first_elem = false;
VAL_LOC_T first_elem_loc, elem_loc;
/* Header. */
switch (lit_cpd->type) {
case AST_LIT_CPD_ARRAY:
rt_val_push_array_init(&rt->stack, &size_loc);
break;
case AST_LIT_CPD_TUPLE:
rt_val_push_tuple_init(&rt->stack, &size_loc);
break;
}
/* Data. */
data_begin = rt->stack.top;
while (current) {
elem_loc = rt->stack.top;
bif_parse_any_ast(rt, current);
if (err_state()) {
err_push("BIF", "Failed parsing compound AST node");
return;
} else {
current = current->next;
}
if (lit_cpd->type != AST_LIT_CPD_ARRAY) {
continue;
}
/* Homogenity check */
if (!has_first_elem) {
has_first_elem = true;
first_elem_loc = elem_loc;
} else if (!rt_val_pair_homo(rt, first_elem_loc, elem_loc)) {
bif_text_error_parse_homo();
return;
}
}
/* Fix the header with the written size. */
data_size = rt->stack.top - data_begin;
rt_val_push_cpd_final(&rt->stack, size_loc, data_size);
}
开发者ID:k-stachowiak,项目名称:moon-lang,代码行数:52,代码来源:bif_text.c
示例4: spawn_setup_inherited_caps
/**
* Copies caps in inherited cnode into targets cspace.
*
* \param si Target spawninfo
* \param inheritcn_cap Cnode of caps to inherit
* \retval SYS_ERR_OK Caps have been copied.
*/
static errval_t spawn_setup_inherited_caps(struct spawninfo *si,
struct capref inheritcn_cap)
{
errval_t err;
struct cnoderef inheritcn;
if (capref_is_null(inheritcn_cap)) {
return SYS_ERR_OK;
}
err = cnode_build_cnoderef(&inheritcn, inheritcn_cap);
if (err_is_fail(err)) {
return err;
}
/* Copy the file descriptor frame cap over */
err = spawn_setup_inherited_cap(inheritcn, INHERITCN_SLOT_FDSPAGE,
si->taskcn, TASKCN_SLOT_FDSPAGE);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_SETUP_FDCAP);
}
/* Copy the session capability over */
err = spawn_setup_inherited_cap(inheritcn, INHERITCN_SLOT_SESSIONID,
si->taskcn, TASKCN_SLOT_SESSIONID);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_SETUP_SIDCAP);
}
/* Copy the kernel capability over, scary */
err = spawn_setup_inherited_cap(inheritcn, INHERITCN_SLOT_KERNELCAP,
si->taskcn, TASKCN_SLOT_KERNELCAP);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_SETUP_KERNEL_CAP);
}
return SYS_ERR_OK;
}
开发者ID:achreto,项目名称:barrelfish,代码行数:46,代码来源:spawn.c
示例5: vregion_destroy
/**
* \brief Destroy the given region
*
* \return SYS_ERR_OK on success, error code on failure
*
* \bug This only works if the memobj type is memobj_one_frame.
*/
errval_t vregion_destroy(struct vregion *vregion)
{
errval_t err;
struct vspace *vspace = vregion_get_vspace(vregion);
if (vspace != NULL) {
err = vspace_remove_vregion(vspace, vregion);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_REMOVE_REGION);
}
}
struct memobj *memobj = vregion_get_memobj(vregion);
if (memobj != NULL) {
err = memobj->f.unmap_region(memobj, vregion);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_MEMOBJ_UNMAP_REGION);
}
}
return SYS_ERR_OK;
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:29,代码来源:vregion.c
示例6: domain_lookup
/**
* \brief Non-blocking name service lookup
*
* \param iface Name of the domain
* \param retdomid returns the Xeon Phi Domain ID
*/
errval_t domain_lookup(const char *iface,
xphi_dom_id_t *retdomid)
{
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, XEON_PHI_ERR_CLIENT_DOMAIN_VOID);
}
goto out;
}
xphi_dom_id_t domid = 0;
err = oct_read(record, "_ { domid: %d }", &domid);
if (err_is_fail(err) || domid == 0) {
err = err_push(err, XEON_PHI_ERR_CLIENT_DOMAIN_VOID);
goto out;
}
if (retdomid != NULL) {
*retdomid = domid;
}
out: free(record);
return err;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:45,代码来源:domain.c
示例7: spawn_span_domain
/**
* \brief Span a domain with the given vroot and disp_frame
*
* Operation similar to spawning a domain but the vroot and disp_frame
* are already provided
*/
errval_t spawn_span_domain(struct spawninfo *si, struct capref vroot,
struct capref disp_frame)
{
errval_t err;
struct capref t1;
struct cnoderef cnode;
/* Spawn cspace */
err = spawn_setup_cspace(si);
if (err_is_fail(err)) {
return err;
}
/* Create pagecn */
t1.cnode = si->rootcn;
t1.slot = ROOTCN_SLOT_PAGECN;
err = cnode_create_raw(t1, &cnode, PAGE_CNODE_SLOTS, NULL);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_CREATE_PAGECN);
}
// Copy root of pagetable
si->vtree.cnode = cnode;
si->vtree.slot = 0;
err = cap_copy(si->vtree, vroot);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_COPY_VNODE);
}
/* Copy dispatcher frame (in taskcn) */
si->dispframe.cnode = si->taskcn;
si->dispframe.slot = TASKCN_SLOT_DISPFRAME;
err = cap_copy(si->dispframe, disp_frame);
if (err_is_fail(err)) {
return err_push(err, SPAWN_ERR_COPY_VNODE);
}
return SYS_ERR_OK;
}
开发者ID:achreto,项目名称:barrelfish,代码行数:45,代码来源:spawn.c
示例8: err_push
/*static*/ DATA_BIN_PTR db_make(char *title)
{
DATA_BIN_PTR dbin;
dbin = (DATA_BIN_PTR)memMalloc(sizeof(DATA_BIN), "dbin");
if (dbin == NULL)
{
err_push(ERR_MEM_LACK, "Data Bin");
return(NULL);
}
/* Initialize data_bin */
#ifdef FF_CHK_ADDR
dbin->check_address = (void*)dbin;
#endif
if (title)
{
dbin->title = (char *)memStrdup(title, "dbin->title"); /* (char *) for Think C -rf01 */
if (dbin->title == NULL)
{
err_push(ERR_MEM_LACK, "Data Bin Title");
memFree(dbin, "dbin");
return(NULL);
}
}
else
dbin->title = NULL;
dbin->table_list = NULL;
dbin->array_conduit_list = NULL;
dbin->eqn_info = NULL;
return(dbin);
}
开发者ID:OPENDAP,项目名称:freeform_handler,代码行数:39,代码来源:makedbin.c
示例9: 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
示例10: vspace_map_anon_nomalloc
/// Map with an alignment constraint
errval_t vspace_map_anon_nomalloc(void **retaddr, struct memobj_anon *memobj,
struct vregion *vregion, size_t size,
size_t *retsize, vregion_flags_t flags,
size_t alignment)
{
errval_t err1, err2;
size = ROUND_UP(size, BASE_PAGE_SIZE);
if (retsize) {
*retsize = size;
}
// Create a memobj and vregion
err1 = memobj_create_anon(memobj, size, 0);
if (err_is_fail(err1)) {
err1 = err_push(err1, LIB_ERR_MEMOBJ_CREATE_ANON);
goto error;
}
err1 = vregion_map_aligned(vregion, get_current_vspace(),
(struct memobj *)memobj, 0, size,
flags, alignment);
if (err_is_fail(err1)) {
err1 = err_push(err1, LIB_ERR_VREGION_MAP);
goto error;
}
*retaddr = (void*)vspace_genvaddr_to_lvaddr(vregion_get_base_addr(vregion));
return SYS_ERR_OK;
error:
if (err_no(err1) != LIB_ERR_MEMOBJ_CREATE_ANON) {
err2 = memobj_destroy_anon((struct memobj *)memobj);
if (err_is_fail(err2)) {
DEBUG_ERR(err2, "memobj_destroy_anon failed");
}
}
return err1;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:39,代码来源:utils.c
示例11: show_command_line
void show_command_line(int argc, char *argv[])
{
int i;
char cline[2 * MAX_PATH] = {""};
sprintf(cline, "==>%s%s", argv[0], argc > 1 ? " " : "");
for (i = 1; i < argc; i++)
sprintf(cline + strlen(cline), "%s%s", argv[i], i < argc - 1 ? " " : "");
sprintf(cline + strlen(cline), "<==");
err_push(ERR_GENERAL, cline);
}
开发者ID:OPENDAP,项目名称:freeform_handler,代码行数:14,代码来源:makedbin.c
示例12: vspace_unmap
errval_t vspace_unmap(const void *buf)
{
errval_t err;
struct vregion *vregion = vspace_get_region(get_current_vspace(), buf);
assert(vregion);
err = vregion_destroy(vregion);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VREGION_DESTROY);
}
return SYS_ERR_OK;
}
开发者ID:MichaelFQuigley,项目名称:barrelfish,代码行数:14,代码来源:utils.c
示例13: lmp_chan_bind
/**
* \brief Initialise a new LMP channel and initiate a binding
*
* \param lc Storage for channel state
* \param cont Continuation for bind completion/failure
* \param qnode Storage for an event queue node (used for queuing bind request)
* \param iref IREF to which to bind
* \param buflen_words Size of incoming buffer, in number of words
*/
errval_t lmp_chan_bind(struct lmp_chan *lc, struct lmp_bind_continuation cont,
struct event_queue_node *qnode, iref_t iref,
size_t buflen_words)
{
errval_t err;
lmp_chan_init(lc);
/* store bind arguments */
lc->iref = iref;
lc->buflen_words = buflen_words;
lc->bind_continuation = cont;
/* allocate a cap slot for the new endpoint cap */
err = slot_alloc(&lc->local_cap);
if (err_is_fail(err)) {
waitset_chanstate_destroy(&lc->send_waitset);
return err_push(err, LIB_ERR_SLOT_ALLOC);
}
/* allocate a local endpoint */
err = lmp_endpoint_create_in_slot(buflen_words, lc->local_cap,
&lc->endpoint);
if (err_is_fail(err)) {
slot_free(lc->local_cap);
waitset_chanstate_destroy(&lc->send_waitset);
return err_push(err, LIB_ERR_ENDPOINT_CREATE);
}
// wait for the ability to use the monitor binding
lc->connstate = LMP_BIND_WAIT;
struct monitor_binding *mb = lc->monitor_binding = get_monitor_binding();
event_mutex_enqueue_lock(&mb->mutex, qnode,
MKCLOSURE(send_bind_cont, lc));
return SYS_ERR_OK;
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:46,代码来源:lmp_chan.c
示例14: vregion_map_aligned
/**
* \brief Setup a new vregion with alignment constraints in an address space
*
* \param vregion The vregion
* \param vspace The vspace to associate with the vregion
* \param memobj The memory object to associate with the region
* \param offset Offset into the memory object
* \param size Size of the memoryg object to use
* \param flags Vregion specific flags
* \param alignment Minimum required alignment of mapping (may be increased)
*/
errval_t vregion_map_aligned(struct vregion *vregion, struct vspace* vspace,
struct memobj *memobj, size_t offset, size_t size,
vregion_flags_t flags, size_t alignment)
{
errval_t err;
struct pmap *pmap = vspace_get_pmap(vspace);
// Allocate some virtual address space
genvaddr_t address;
err = pmap->f.determine_addr(pmap, memobj, alignment, &address);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_PMAP_DETERMINE_ADDR);
}
// Initialize
vregion->vspace = vspace;
vregion->memobj = memobj;
vregion->base = address;
vregion->offset = offset;
vregion->size = size;
vregion->flags = flags;
// Add to the vspace
err = vspace_add_vregion(vspace, vregion);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_ADD_REGION);
}
// Add to memobj
err = memobj->f.map_region(memobj, vregion);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_MEMOBJ_MAP_REGION);
}
return SYS_ERR_OK;
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:47,代码来源:vregion.c
示例15: do_single_map
static errval_t do_single_map(struct pmap_arm *pmap, genvaddr_t vaddr, genvaddr_t vend,
struct capref frame, size_t offset, size_t pte_count,
vregion_flags_t flags)
{
// Get the page table
struct vnode *ptable;
errval_t err = get_ptable(pmap, vaddr, &ptable);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_PMAP_GET_PTABLE);
}
uintptr_t pmap_flags = vregion_flags_to_kpi_paging_flags(flags);
// XXX: reassess the following note -SG
// NOTE: strictly speaking a l2 entry only has 8 bits, but due to the way
// Barrelfish allocates l1 and l2 tables, we use 10 bits for the tracking
// index here and in the map syscall
uintptr_t index = ARM_USER_L2_OFFSET(vaddr);
// Create user level datastructure for the mapping
bool has_page = has_vnode(ptable, index, pte_count);
assert(!has_page);
struct vnode *page = slab_alloc(&pmap->slab);
assert(page);
page->is_vnode = false;
page->entry = index;
page->next = ptable->u.vnode.children;
ptable->u.vnode.children = page;
page->u.frame.cap = frame;
page->u.frame.pte_count = pte_count;
// Map entry into the page table
err = vnode_map(ptable->u.vnode.cap, frame, index,
pmap_flags, offset, pte_count);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VNODE_MAP);
}
return SYS_ERR_OK;
}
开发者ID:Karamax,项目名称:arrakis,代码行数:36,代码来源:pmap_arch.c
示例16: term_client_change_config_waitset
/**
* \brief Change the waitset used for configuration messages.
*
* \param client Terminal client state.
* \param conf_ws New waitset to use.
*
* \return SYS_ERR_OK if successful.
* TERM_ERR_CHANGE_WAITSET on error.
*/
errval_t term_client_change_config_waitset(struct term_client *client,
struct waitset *conf_ws)
{
errval_t err;
assert(client != NULL);
assert(conf_ws != NULL);
client->conf_ws = conf_ws;
err = client->conf_binding->change_waitset(client->conf_binding, conf_ws);
if (err_is_fail(err)) {
return err_push(err, TERM_ERR_CHANGE_WAITSET);
}
return SYS_ERR_OK;
}
开发者ID:Karamax,项目名称:arrakis,代码行数:25,代码来源:client.c
示例17: caps_delete
errval_t caps_delete(struct cte *cte)
{
errval_t err;
TRACE_CAP_MSG("deleting", cte);
if (cte->mdbnode.locked) {
return SYS_ERR_CAP_LOCKED;
}
err = caps_try_delete(cte);
if (err_no(err) == SYS_ERR_DELETE_LAST_OWNED) {
err = err_push(err, SYS_ERR_RETRY_THROUGH_MONITOR);
}
return err;
}
开发者ID:achreto,项目名称:barrelfish,代码行数:17,代码来源:cap_delete.c
示例18: option_S
static int option_S(char *argv[], FF_STD_ARGS_PTR std_args, int *i)
{
int error = 0;
switch (toupper(argv[*i][2])) /* -s? */
{
case STR_END :
std_args->cv_subset = TRUE;
break;
default:
error = err_push(ERR_UNKNOWN_OPTION, "==> %s <==", argv[*i]);
break;
}
return(error);
}
开发者ID:OPENDAP,项目名称:freeform_handler,代码行数:17,代码来源:makedbin.c
示例19: make_unique_format_titles
static int make_unique_format_titles(DATA_BIN_PTR dbin)
{
PROCESS_INFO_LIST plist = NULL;
PROCESS_INFO_PTR pinfo = NULL;
int error = 0;
int SCRATCH = strlen("Binary Output Separate Varied Record Header: ") + 1; /* Longest */
char *cp = NULL;
FF_VALIDATE(dbin);
db_ask(dbin, DBASK_PROCESS_INFO, 0, &plist);
plist = dll_first(plist);
pinfo = FF_PI(plist);
while (pinfo && !error)
{
FF_VALIDATE(pinfo);
cp = (char *)memRealloc(PINFO_FORMAT(pinfo)->name, strlen(PINFO_FORMAT(pinfo)->name) + SCRATCH + 1, "PINFO_FORMAT(pinfo)->name");
if (cp)
{
PINFO_FORMAT(pinfo)->name = cp;
memmove(cp + SCRATCH, cp, strlen(cp) + 1);
}
else
{
error = err_push(ERR_MEM_LACK, "");
break;
}
error = get_format_type(PINFO_FORMAT(pinfo), cp);
if (error)
break;
memmove(cp + strlen(cp), cp + SCRATCH, strlen(cp + SCRATCH) + 1);
plist = dll_next(plist);
pinfo = FF_PI(plist);
}
ff_destroy_process_info_list(plist);
return error;
}
开发者ID:OPENDAP,项目名称:freeform_handler,代码行数:46,代码来源:makedbin.c
示例20: morecore_init
errval_t morecore_init(void)
{
errval_t err;
struct morecore_state *state = get_morecore_state();
thread_mutex_init(&state->mutex);
err = vspace_mmu_aware_init(&state->mmu_state, HEAP_REGION);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_MMU_AWARE_INIT);
}
sys_morecore_alloc = morecore_alloc;
sys_morecore_free = morecore_free;
return SYS_ERR_OK;
}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:17,代码来源:morecore.c
注:本文中的err_push函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论