mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
899ae0d2b5
GCC >= 4.4 assumes the 'printf' attribute refers to the native runtime libraries format specifiers. Thanks to gnulib, libvirt has GNU format specifiers everywhere. This means we need to use 'gnu_printf' with GCC >= 4.4 to get correct compiler checking of printf format specifiers. * HACKING: Document new rules for ATTRIBUTE_FMT_PRINTF * autobuild.sh, mingw32-libvirt.spec.in: Disable OpenNebula driver on mingw32 builds * qemud/dispatch.h, qemud/qemu.h, src/buf.h src/internal.h, src/logging.h, src/security.h, src/sexpr.h, src/util.h, src/virterror_internal.h, src/xend_internal.c: Change over to ATTRIBUTE_FMT_PRINTF. * src/virsh.c: Disable 'cd' and 'pwd' commands on Win32 since they don't compile * src/threads-win32.c: Add missing return value check
98 lines
3.8 KiB
C
98 lines
3.8 KiB
C
/*
|
|
* virterror.h: internal error handling
|
|
*
|
|
* Copyright (C) 2006-2009 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*/
|
|
|
|
#ifndef __VIRT_ERROR_H_
|
|
#define __VIRT_ERROR_H_
|
|
|
|
#include "internal.h"
|
|
|
|
extern virErrorFunc virErrorHandler;
|
|
extern void *virUserData;
|
|
|
|
/************************************************************************
|
|
* *
|
|
* API for error handling *
|
|
* *
|
|
************************************************************************/
|
|
int virErrorInitialize(void);
|
|
void virRaiseErrorFull(virConnectPtr conn,
|
|
const char *filename,
|
|
const char *funcname,
|
|
size_t linenr,
|
|
int domain,
|
|
int code,
|
|
virErrorLevel level,
|
|
const char *str1,
|
|
const char *str2,
|
|
const char *str3,
|
|
int int1,
|
|
int int2,
|
|
const char *fmt, ...)
|
|
ATTRIBUTE_FMT_PRINTF(13, 14);
|
|
|
|
/* Includes 'dom' and 'net' for compatbility, but they're ignored */
|
|
#define virRaiseError(conn, dom, net, domain, code, level, \
|
|
str1, str2, str3, int1, int2, msg, ...) \
|
|
virRaiseErrorFull(conn, __FILE__, __FUNCTION__, __LINE__, \
|
|
domain, code, level, str1, str2, str3, int1, int2, \
|
|
msg, __VA_ARGS__)
|
|
|
|
const char *virErrorMsg(virErrorNumber error, const char *info);
|
|
void virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
|
|
const char *filename ATTRIBUTE_UNUSED,
|
|
const char *funcname ATTRIBUTE_UNUSED,
|
|
size_t linenr ATTRIBUTE_UNUSED,
|
|
const char *fmt, ...)
|
|
ATTRIBUTE_FMT_PRINTF(7, 8);
|
|
|
|
void virReportSystemErrorFull(virConnectPtr conn,
|
|
int domcode,
|
|
int theerrno,
|
|
const char *filename,
|
|
const char *funcname,
|
|
size_t linenr,
|
|
const char *fmt, ...)
|
|
ATTRIBUTE_FMT_PRINTF(7, 8);
|
|
|
|
#define virReportSystemError(conn, theerrno, fmt,...) \
|
|
virReportSystemErrorFull((conn), \
|
|
VIR_FROM_THIS, \
|
|
(theerrno), \
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
(fmt), __VA_ARGS__)
|
|
|
|
void virReportOOMErrorFull(virConnectPtr conn,
|
|
int domcode,
|
|
const char *filename,
|
|
const char *funcname,
|
|
size_t linenr);
|
|
|
|
#define virReportOOMError(conn) \
|
|
virReportOOMErrorFull((conn), VIR_FROM_THIS, \
|
|
__FILE__, __FUNCTION__, __LINE__)
|
|
|
|
|
|
void virSetGlobalError(void);
|
|
void virSetConnError(virConnectPtr conn);
|
|
const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
|
|
|
|
#endif
|