这篇教程C++ xc_interface_close函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xc_interface_close函数的典型用法代码示例。如果您正苦于以下问题:C++ xc_interface_close函数的具体用法?C++ xc_interface_close怎么用?C++ xc_interface_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xc_interface_close函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(int argc, char *argv[]){ int i, ret = 0; xc_physinfo_t physinfo = { 0 }; int nr_matches = 0; int matches_main_options[ARRAY_SIZE(main_options)]; if ( argc < 2 ) { show_help(); return 0; } xc_handle = xc_interface_open(0,0,0); if ( !xc_handle ) { fprintf(stderr, "failed to get the handler/n"); return EIO; } ret = xc_physinfo(xc_handle, &physinfo); if ( ret ) { ret = errno; fprintf(stderr, "failed to get processor information (%d - %s)/n", ret, strerror(ret)); xc_interface_close(xc_handle); return ret; } max_cpu_nr = physinfo.nr_cpus; /* calculate how many options match with user's input */ for ( i = 0; i < ARRAY_SIZE(main_options); i++ ) if ( !strncmp(main_options[i].name, argv[1], strlen(argv[1])) ) matches_main_options[nr_matches++] = i; if ( nr_matches > 1 ) { fprintf(stderr, "Ambiguous options: "); for ( i = 0; i < nr_matches; i++ ) fprintf(stderr, " %s", main_options[matches_main_options[i]].name); fprintf(stderr, "/n"); ret = EINVAL; } else if ( nr_matches == 1 ) /* dispatch to the corresponding function handler */ main_options[matches_main_options[0]].function(argc - 2, argv + 2); else { show_help(); ret = EINVAL; } xc_interface_close(xc_handle); return ret;}
开发者ID:tklengyel,项目名称:xen,代码行数:56,
示例2: xencpu_initstatic int xencpu_init (void){ xc_handle = xc_interface_open(XC_INTERFACE_INIT_ARGS); if (!xc_handle) { ERROR ("xencpu: xc_interface_open() failed"); return (-1); } xc_physinfo_t *physinfo; physinfo = calloc(1, sizeof(xc_physinfo_t)); if (physinfo == NULL) { ERROR ("xencpu plugin: calloc() for physinfo failed."); xc_interface_close(xc_handle); return (ENOMEM); } if (xc_physinfo(xc_handle, physinfo) < 0) { ERROR ("xencpu plugin: xc_physinfo() failed"); xc_interface_close(xc_handle); free(physinfo); return (-1); } num_cpus = physinfo->nr_cpus; free(physinfo); INFO ("xencpu plugin: Found %"PRIu32" processors.", num_cpus); cpu_info = calloc(num_cpus, sizeof(xc_cpuinfo_t)); if (cpu_info == NULL) { ERROR ("xencpu plugin: calloc() for num_cpus failed."); xc_interface_close(xc_handle); return (ENOMEM); } cpu_states = calloc (num_cpus, sizeof (value_to_rate_state_t)); if (cpu_states == NULL) { ERROR ("xencpu plugin: calloc() for cpu_states failed."); xc_interface_close(xc_handle); free(cpu_info); return (ENOMEM); } return (0);} /* static int xencpu_init */
开发者ID:brd,项目名称:collectd,代码行数:51,
示例3: xencpu_shutdownstatic int xencpu_shutdown(void) { free(cpu_states); free(cpu_info); xc_interface_close(xc_handle); return 0;} /* static int xencpu_shutdown */
开发者ID:BrandonArp,项目名称:collectd,代码行数:7,
示例4: xen_initstatic int xen_init(MachineState *ms){ PCMachineState *pcms = PC_MACHINE(ms); /* Disable ACPI build because Xen handles it */ pcms->acpi_build_enabled = false; xen_xc = xc_interface_open(0, 0, 0); if (xen_xc == NULL) { xen_pv_printf(NULL, 0, "can't open xen interface/n"); return -1; } xen_fmem = xenforeignmemory_open(0, 0); if (xen_fmem == NULL) { xen_pv_printf(NULL, 0, "can't open xen fmem interface/n"); xc_interface_close(xen_xc); return -1; } qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); global_state_set_optional(); savevm_skip_configuration(); savevm_skip_section_footers(); return 0;}
开发者ID:AmesianX,项目名称:panda,代码行数:26,
示例5: checkpoint_closevoid checkpoint_close(checkpoint_state* s){ if (s->timer) delete_suspend_timer(s); if (s->suspend_thr) stop_suspend_thread(s); release_shutdown_watch(s); release_suspend_evtchn(s); if (s->xch >= 0) { xc_interface_close(s->xch); s->xch = -1; } if (s->xce >= 0) { xc_evtchn_close(s->xce); s->xce = -1; } if (s->xsh) { xs_daemon_close(s->xsh); s->xsh = NULL; } s->domid = 0; s->fd = -1;}
开发者ID:avasani,项目名称:modified-xen,代码行数:26,
示例6: xen_setupbool xen_setup(void){ xs = xs_daemon_open(); if (xs == NULL) { dolog(LOG_ERR, "Failed to contact xenstore (%m). Is it running?"); goto out; } xc = xc_interface_open(); if (xc == -1) { dolog(LOG_ERR, "Failed to contact hypervisor (%m)"); goto out; } if (!xs_watch(xs, "@introduceDomain", "domlist")) { dolog(LOG_ERR, "xenstore watch on @introduceDomain fails."); goto out; } if (!xs_watch(xs, "@releaseDomain", "domlist")) { dolog(LOG_ERR, "xenstore watch on @releaseDomain fails."); goto out; } return true; out: if (xs) xs_daemon_close(xs); if (xc != -1) xc_interface_close(xc); return false;}
开发者ID:andreiw,项目名称:xen3-arm-tegra,代码行数:35,
示例7: xc_interface_openstatic PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds){ int xc_handle; char *policy; uint32_t len; int ret; static char *kwd_list[] = { "policy", NULL }; if( !PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwd_list, &policy, &len) ) return NULL; xc_handle = xc_interface_open(); if (xc_handle < 0) { errno = xc_handle; return PyErr_SetFromErrno(xc_error_obj); } ret = flask_load(xc_handle, policy, len); xc_interface_close(xc_handle); if ( ret != 0 ) { errno = -ret; return PyErr_SetFromErrno(xc_error_obj); } return Py_BuildValue("i", ret);}
开发者ID:avasani,项目名称:modified-xen,代码行数:29,
示例8: __hypercall_performstatic int __hypercall_perform(unsigned long cmd, unsigned long *arr){ int ret; xc_interface *xch = xc_interface_open(0, 0, 0); DECLARE_HYPERCALL; if (xch == NULL) goto err; hypercall.op = __HYPERVISOR_xen_version; hypercall.arg[0] = cmd; hypercall.arg[1] = (unsigned long) arr; ret = do_xen_hypercall(xch, &hypercall); xc_interface_close(xch); if (ret != 0) goto err; out: return ret; err: ret = -1; goto out;}
开发者ID:gauthier-voron,项目名称:rwmsr,代码行数:25,
示例9: sizeofstatic PyObject *getpolicy(PyObject *self, PyObject *args){ struct acm_getpolicy getpolicy; int xc_handle, rc; uint8_t pull_buffer[8192]; PyObject *result; uint32_t len = sizeof(pull_buffer); memset(&getpolicy, 0x0, sizeof(getpolicy)); set_xen_guest_handle(getpolicy.pullcache, pull_buffer); getpolicy.pullcache_size = sizeof(pull_buffer); if ((xc_handle = xc_interface_open()) <= 0) { PyErr_SetString(PyExc_IOError, ctrlif_op); return NULL; } rc = xc_acm_op(xc_handle, ACMOP_getpolicy, &getpolicy, sizeof(getpolicy)); xc_interface_close(xc_handle); if (rc == 0) { struct acm_policy_buffer *header = (struct acm_policy_buffer *)pull_buffer; if (ntohl(header->len) < sizeof(pull_buffer)) len = ntohl(header->len); } else { len = 0; } result = Py_BuildValue("is#", rc, pull_buffer, len); return result;}
开发者ID:avsm,项目名称:xen-unstable,代码行数:33,
示例10: xc_interface_open/** * map_tbufs - memory map Xen trace buffers into user space * @tbufs_mfn: mfn of the trace buffers * @num: number of trace buffers to map * @size: size of each trace buffer * * Maps the Xen trace buffers them into process address space. */struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num, unsigned long size){ int xc_handle; struct t_buf *tbufs_mapped; xc_handle = xc_interface_open(); if ( xc_handle < 0 ) { exit(EXIT_FAILURE); } tbufs_mapped = xc_map_foreign_range(xc_handle, DOMID_XEN, size * num, PROT_READ | PROT_WRITE, tbufs_mfn); xc_interface_close(xc_handle); if ( tbufs_mapped == 0 ) { PERROR("Failed to mmap trace buffers"); exit(EXIT_FAILURE); } return tbufs_mapped;}
开发者ID:mikesun,项目名称:xen-cow-checkpointing,代码行数:35,
示例11: completestatic void complete(int retval) { int errnoval = retval ? errno : 0; /* suppress irrelevant errnos */ xtl_log(&logger,XTL_DEBUG,errnoval,program,"complete r=%d",retval); helper_stub_complete(retval,errnoval,0); xc_interface_close(xch); exit(0);}
开发者ID:chao-p,项目名称:xen,代码行数:7,
示例12: mainint main(int argc, char **argv){ int opt; while ((opt = getopt(argc, argv, "h")) != -1) { switch (opt) { case 'h': usage(0); break; default: usage(1); } } argv += optind; argc -= optind; if (argc <= 0) usage(1); xch = xc_interface_open(NULL, NULL, 0); if (!xch) err(1, "opening xc interface"); if (strcmp(argv[0], "reset") == 0) gcov_reset(); else if (strcmp(argv[0], "read") == 0) gcov_read(argc > 1 ? argv[1] : "-"); else usage(1); xc_interface_close(xch); return 0;}
开发者ID:Xilinx,项目名称:xen,代码行数:34,
示例13: PERROR/* generic shared function */static void *__getssid(int domid, uint32_t *buflen){ struct acm_getssid getssid; int xc_handle;#define SSID_BUFFER_SIZE 4096 void *buf = NULL; if ((xc_handle = xc_interface_open()) < 0) { goto out1; } if ((buf = malloc(SSID_BUFFER_SIZE)) == NULL) { PERROR("acm.policytype: Could not allocate ssid buffer!/n"); goto out2; } memset(buf, 0, SSID_BUFFER_SIZE); set_xen_guest_handle(getssid.ssidbuf, buf); getssid.ssidbuf_size = SSID_BUFFER_SIZE; getssid.get_ssid_by = ACM_GETBY_domainid; getssid.id.domainid = domid; if (xc_acm_op(xc_handle, ACMOP_getssid, &getssid, sizeof(getssid)) < 0) { if (errno == EACCES) PERROR("ACM operation failed."); free(buf); buf = NULL; goto out2; } else { *buflen = SSID_BUFFER_SIZE; goto out2; }out2: xc_interface_close(xc_handle);out1: return buf;}
开发者ID:avsm,项目名称:xen-unstable,代码行数:36,
示例14: mainint main(int argc, char **argv){ int err = 0; xc_interface *xch; int value; if (argc != 3) usage(argv); value = str2bool(argv[2]); xch = xc_interface_open(0,0,0); if ( !xch ) { fprintf(stderr, "Unable to create interface to xenctrl: %s/n", strerror(errno)); err = 1; goto done; } err = xc_flask_setbool(xch, argv[1], value, 1); if (err) { fprintf(stderr, "xc_flask_setbool: Unable to set boolean %s=%s: %s (%d)", argv[1], argv[2], strerror(errno), err); err = 2; goto done; } done: if ( xch ) xc_interface_close(xch); return err;}
开发者ID:0day-ci,项目名称:xen,代码行数:34,
示例15: xen_setupintxen_setup(void){ xs = xs_daemon_open(); if (xs == NULL) { dolog(LOG_ERR, "Failed to contact xenstore (%s). Is it running?", strerror(errno)); goto out; } xc = xc_interface_open(); if (xc == -1) { dolog(LOG_ERR, "Failed to contact hypervisor (%s)", strerror(errno)); goto out; } if (!xs_watch(xs, DOMAIN_PATH, "backend")) { dolog(LOG_ERR, "xenstore watch on backend fails."); goto out; } return 0; out: if (xs) xs_daemon_close(xs); if (xc != -1) xc_interface_close(xc); return -1;}
开发者ID:djbclark,项目名称:bb10qnx,代码行数:30,
示例16: xs_unwatchXenDomainWatcher::~XenDomainWatcher(){ xs_unwatch( xsh_, "@introduceDomain", introduceToken_.c_str() ); xs_unwatch( xsh_, "@releaseDomain", releaseToken_.c_str() ); xs_close( xsh_ ); xc_interface_close( xci_ );}
开发者ID:aoshiken,项目名称:libbdvmi,代码行数:8,
示例17: mainint main(int argc, char **argv){ xc_interface *xch; int domid, port, rc; xc_evtchn_status_t status; domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0; xch = xc_interface_open(0,0,0); if ( !xch ) errx(1, "failed to open control interface"); for ( port = 0; ; port++ ) { status.dom = domid; status.port = port; rc = xc_evtchn_status(xch, &status); if ( rc < 0 ) break; if ( status.status == EVTCHNSTAT_closed ) continue; printf("%4d: VCPU %u: ", port, status.vcpu); switch ( status.status ) { case EVTCHNSTAT_unbound: printf("Interdomain (Waiting connection) - Remote Domain %u", status.u.unbound.dom); break; case EVTCHNSTAT_interdomain: printf("Interdomain (Connected) - Remote Domain %u, Port %u", status.u.interdomain.dom, status.u.interdomain.port); break; case EVTCHNSTAT_pirq: printf("Physical IRQ %u", status.u.pirq); break; case EVTCHNSTAT_virq: printf("Virtual IRQ %u", status.u.virq); break; case EVTCHNSTAT_ipi: printf("IPI"); break; default: printf("Unknown"); break; } printf("/n"); } xc_interface_close(xch); return 0;}
开发者ID:Angel666,项目名称:android_hardware_intel,代码行数:56,
示例18: indexof// give index of this domain in the qos data arrayint indexof(int domid){ int idx; xc_dominfo_t dominfo[NDOMAINS]; int xc_handle, ndomains; extern void qos_kill_thread(int domid); if (domid < 0) { // shouldn't happen printf("bad domain id: %d/r/n", domid); return 0; } for (idx=0; idx<NDOMAINS; idx++) if ( (new_qos->domain_info[idx].id == domid) && new_qos->domain_info[idx].in_use) return idx; // not found, make a new entry for (idx=0; idx<NDOMAINS; idx++) if (new_qos->domain_info[idx].in_use == 0) { global_init_domain(domid, idx); return idx; } // call domaininfo hypercall to try and garbage collect unused entries xc_handle = xc_interface_open(); ndomains = xc_domain_getinfo(xc_handle, 0, NDOMAINS, dominfo); xc_interface_close(xc_handle); // for each domain in our data, look for it in the system dominfo structure // and purge the domain's data from our state if it does not exist in the // dominfo structure for (idx=0; idx<NDOMAINS; idx++) { int domid = new_qos->domain_info[idx].id; int jdx; for (jdx=0; jdx<ndomains; jdx++) { if (dominfo[jdx].domid == domid) break; } if (jdx == ndomains) // we didn't find domid in the dominfo struct if (domid != IDLE_DOMAIN_ID) // exception for idle domain, which is not // contained in dominfo qos_kill_thread(domid); // purge our stale data } // look again for a free slot for (idx=0; idx<NDOMAINS; idx++) if (new_qos->domain_info[idx].in_use == 0) { global_init_domain(domid, idx); return idx; } // still no space found, so bail fprintf(stderr, "out of space in domain table, increase NDOMAINS/r/n"); exit(2);}
开发者ID:stephanyzd,项目名称:Microbenchmarking,代码行数:57,
示例19: closeXenHandles static void closeXenHandles(HSP *sp) { if(sp->xc_handle && sp->xc_handle != -1) { xc_interface_close(sp->xc_handle); sp->xc_handle = 0; } if(sp->xs_handle) { xs_daemon_close(sp->xs_handle); sp->xs_handle = NULL; } }
开发者ID:svn2github,项目名称:host-sflow,代码行数:11,
示例20: closeIVCLibraryvoid closeIVCLibrary(libIVC_t *iface){ xc_evtchn_close(iface->ec); xs_close(iface->xs); xc_interface_close(iface->xc); xc_gnttab_close(iface->gt);#ifdef HAVE_XENSTORE_H if(iface->gs) xc_gntshr_close(iface->gs);#endif free(iface);}
开发者ID:AlexanderAA,项目名称:HaLVM,代码行数:11,
示例21: cleanupvoid cleanup(void){ if (virq_port > -1) xenevtchn_unbind(xce_handle, virq_port); if (xce_handle) xenevtchn_close(xce_handle); if (xch) xc_interface_close(xch); if (xs_handle) xs_daemon_close(xs_handle);}
开发者ID:0day-ci,项目名称:xen,代码行数:11,
示例22: xen_kexec_execvoid xen_kexec_exec(void){ xc_interface *xch; xch = xc_interface_open(NULL, NULL, 0); if (!xch) return; xc_kexec_exec(xch, KEXEC_TYPE_DEFAULT); xc_interface_close(xch);}
开发者ID:AnwariJr,项目名称:kexec-tools,代码行数:12,
示例23: xen_free_interfacevoid xen_free_interface(xen_interface_t* xen) { if (xen) { if (xen->xl_ctx) libxl_ctx_free(xen->xl_ctx); if (xen->xl_logger) xtl_logger_destroy(xen->xl_logger); //if (xen->xsh) xs_close(xen->xsh); if (xen->xc) xc_interface_close(xen->xc); free(xen); }}
开发者ID:JaonLin,项目名称:drakvuf,代码行数:12,
示例24: xenstat_uninitvoid xenstat_uninit(xenstat_handle * handle){ unsigned int i; if (handle) { for (i = 0; i < NUM_COLLECTORS; i++) collectors[i].uninit(handle); xc_interface_close(handle->xc_handle); xs_daemon_close(handle->xshandle); free(handle->priv); free(handle); }}
开发者ID:mikesun,项目名称:xen-cow-checkpointing,代码行数:12,
示例25: get_memory_ranges_xenstatic int get_memory_ranges_xen(struct memory_range **range, int *ranges){ int rc, ret = -1; struct e820entry e820entries[MAX_MEMORY_RANGES]; unsigned int i;#ifdef XENCTRL_HAS_XC_INTERFACE xc_interface *xc;#else int xc;#endif#ifdef XENCTRL_HAS_XC_INTERFACE xc = xc_interface_open(NULL, NULL, 0); if (!xc) { fprintf(stderr, "%s: Failed to open Xen control interface/n", __func__); goto err; }#else xc = xc_interface_open(); if (xc == -1) { fprintf(stderr, "%s: Failed to open Xen control interface/n", __func__); goto err; }#endif rc = xc_get_machine_memory_map(xc, e820entries, MAX_MEMORY_RANGES); if (rc < 0) { fprintf(stderr, "%s: xc_get_machine_memory_map: %s/n", __func__, strerror(rc)); goto err; } for (i = 0; i < rc; ++i) { memory_range[i].start = e820entries[i].addr; memory_range[i].end = e820entries[i].addr + e820entries[i].size; memory_range[i].type = xen_e820_to_kexec_type(e820entries[i].type); } qsort(memory_range, rc, sizeof(struct memory_range), compare_ranges); *range = memory_range; *ranges = rc; ret = 0;err: xc_interface_close(xc); return ret;}
开发者ID:UISS,项目名称:kexec-tools,代码行数:52,
示例26: xen_initstatic int xen_init(MachineState *ms){ xen_xc = xc_interface_open(0, 0, 0); if (xen_xc == NULL) { xen_pv_printf(NULL, 0, "can't open xen interface/n"); return -1; } xen_fmem = xenforeignmemory_open(0, 0); if (xen_fmem == NULL) { xen_pv_printf(NULL, 0, "can't open xen fmem interface/n"); xc_interface_close(xen_xc); return -1; } xen_dmod = xendevicemodel_open(0, 0); if (xen_dmod == NULL) { xen_pv_printf(NULL, 0, "can't open xen devicemodel interface/n"); xenforeignmemory_close(xen_fmem); xc_interface_close(xen_xc); return -1; } qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); return 0;}
开发者ID:8tab,项目名称:qemu,代码行数:23,
注:本文中的xc_interface_close函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xc_interface_open函数代码示例 C++ xc_hypercall_bounce_pre函数代码示例 |