这篇教程C++ virLastErrorObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中virLastErrorObject函数的典型用法代码示例。如果您正苦于以下问题:C++ virLastErrorObject函数的具体用法?C++ virLastErrorObject怎么用?C++ virLastErrorObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了virLastErrorObject函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: virDispatchError/** * virDispatchError: * @conn: pointer to the hypervisor connection * * Internal helper to do final stage of error * reporting in public APIs. * * - Copy the global error to per-connection error if needed * - Set a generic error message if none is already set * - Invoke the error callback functions */voidvirDispatchError(virConnectPtr conn){ virErrorPtr err = virLastErrorObject(); virErrorFunc handler = virErrorHandler; void *userData = virUserData; /* Can only happen on OOM. */ if (!err) return; /* Set a generic error message if none is already set */ if (err->code == VIR_ERR_OK) virErrorGenericFailure(err); /* Copy the global error to per-connection error if needed */ if (conn) { virMutexLock(&conn->lock); virCopyError(err, &conn->err); if (conn->handler != NULL) { handler = conn->handler; userData = conn->userData; } virMutexUnlock(&conn->lock); } /* Invoke the error callback functions */ if (handler != NULL) { (handler)(userData, err); } else { virDefaultErrorFunc(err); }}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:45,
示例2: virResetLastError/** * virResetLastError: * * Reset the last error caught at the library level. * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently, only resetting * their own error object. */voidvirResetLastError(void){ virErrorPtr err = virLastErrorObject(); if (err) virResetError(err);}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:16,
示例3: virGetLastError/** * virGetLastError: * * Provide a pointer to the last error caught at the library level * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * Returns a pointer to the last error or NULL if none occurred. */virErrorPtrvirGetLastError(void){ virErrorPtr err = virLastErrorObject(); if (!err || err->code == VIR_ERR_OK) return NULL; return err;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:18,
示例4: virGetLastErrorDomain/** * virGetLastErrorDomain: * * Get the most recent error domain (enum virErrorDomain). * * Returns a numerical value of the most recent error's origin, or VIR_FROM_NONE * if none is set. */intvirGetLastErrorDomain(void){ virErrorPtr err = virLastErrorObject(); if (!err) return VIR_FROM_NONE; return err->domain;}
开发者ID:libvirt,项目名称:libvirt,代码行数:16,
示例5: virGetLastErrorCode/** * virGetLastErrorCode: * * Get the most recent error code (enum virErrorNumber). * * Returns the most recent error code, or VIR_ERR_OK if none is set. */intvirGetLastErrorCode(void){ virErrorPtr err = virLastErrorObject(); if (!err) return VIR_ERR_OK; return err->code;}
开发者ID:libvirt,项目名称:libvirt,代码行数:15,
示例6: virGetLastErrorMessage/** * virGetLastErrorMessage: * * Get the most recent error message * * Returns the most recent error message string in this * thread, or a generic message if none is set */const char *virGetLastErrorMessage(void){ virErrorPtr err = virLastErrorObject(); if (!err || err->code == VIR_ERR_OK) return _("no error"); if (err->message == NULL) return _("unknown error"); return err->message;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:18,
示例7: virCopyLastError/** * virCopyLastError: * @to: target to receive the copy * * Copy the content of the last error caught at the library level * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * One will need to free the result with virResetError() * * Returns 0 if no error was found and the error code otherwise and -1 in case * of parameter error. */intvirCopyLastError(virErrorPtr to){ virErrorPtr err = virLastErrorObject(); /* We can't guarantee caller has initialized it to zero */ memset(to, 0, sizeof(*to)); if (err) virCopyError(err, to); else virResetError(to); return to->code;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:26,
示例8: virSetError/** * virSetError: * @newerr: previously saved error object * * Set the current error from a previously saved error object * * Can be used to re-set an old error, which may have been squashed by * other functions (like cleanup routines). * * Returns 0 on success, -1 on failure. Leaves errno unchanged. */intvirSetError(virErrorPtr newerr){ virErrorPtr err; int saved_errno = errno; int ret = -1; err = virLastErrorObject(); if (!err) goto cleanup; virResetError(err); ret = virCopyError(newerr, err);cleanup: errno = saved_errno; return ret;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:28,
示例9: virCopyLastError/** * virCopyLastError: * @to: target to receive the copy * * Copy the content of the last error caught at the library level * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * One will need to free the result with virResetError() * * Returns error code or -1 in case of parameter error. */intvirCopyLastError(virErrorPtr to){ virErrorPtr err = virLastErrorObject(); if (!to) return -1; /* We can't guarantee caller has initialized it to zero */ memset(to, 0, sizeof(*to)); if (err) { virCopyError(err, to); } else { virResetError(to); to->code = VIR_ERR_NO_MEMORY; to->domain = VIR_FROM_NONE; to->level = VIR_ERR_ERROR; } return to->code;}
开发者ID:libvirt,项目名称:libvirt,代码行数:33,
示例10: virLastErrorObject const char *str3, int int1, int int2, const char *fmt, ...){ int save_errno = errno; virErrorPtr to; char *str; int priority; /* * All errors are recorded in thread local storage * For compatibility, public API calls will copy them * to the per-connection error object when necessary */ to = virLastErrorObject(); if (!to) { errno = save_errno; return; /* Hit OOM allocating thread error object, sod all we can do now */ } virResetError(to); if (code == VIR_ERR_OK) { errno = save_errno; return; } /* * formats the message; drop message on OOM situations */
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:31,
注:本文中的virLastErrorObject函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ virMutexDestroy函数代码示例 C++ virJSONValueFree函数代码示例 |