2008-11-04 22:30:33 +00:00
|
|
|
/*
|
|
|
|
* virterror.h: internal error handling
|
|
|
|
*
|
2011-07-08 21:58:28 +00:00
|
|
|
* Copyright (C) 2006-2009, 2011 Red Hat, Inc.
|
2008-11-04 22:30:33 +00:00
|
|
|
*
|
|
|
|
* 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_
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __VIRT_ERROR_H_
|
2008-11-04 22:30:33 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2008-11-04 22:30:33 +00:00
|
|
|
|
|
|
|
extern virErrorFunc virErrorHandler;
|
|
|
|
extern void *virUserData;
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* *
|
|
|
|
* API for error handling *
|
|
|
|
* *
|
|
|
|
************************************************************************/
|
2009-01-20 12:01:45 +00:00
|
|
|
int virErrorInitialize(void);
|
2011-04-16 08:30:22 +00:00
|
|
|
void virRaiseErrorFull(const char *filename,
|
2009-05-27 12:10:47 +00:00
|
|
|
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, ...)
|
2011-04-16 08:30:22 +00:00
|
|
|
ATTRIBUTE_FMT_PRINTF(12, 13);
|
2009-05-27 12:10:47 +00:00
|
|
|
|
|
|
|
/* Includes 'dom' and 'net' for compatbility, but they're ignored */
|
2011-04-16 08:30:22 +00:00
|
|
|
# define virRaiseError(dom, net, domain, code, level, \
|
2009-05-27 12:10:47 +00:00
|
|
|
str1, str2, str3, int1, int2, msg, ...) \
|
2011-04-16 08:30:22 +00:00
|
|
|
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
2009-05-27 12:10:47 +00:00
|
|
|
domain, code, level, str1, str2, str3, int1, int2, \
|
|
|
|
msg, __VA_ARGS__)
|
|
|
|
|
2008-11-04 22:30:33 +00:00
|
|
|
const char *virErrorMsg(virErrorNumber error, const char *info);
|
2011-04-16 08:30:22 +00:00
|
|
|
void virReportErrorHelper(int domcode, int errcode,
|
2011-07-08 21:58:28 +00:00
|
|
|
const char *filename,
|
|
|
|
const char *funcname,
|
|
|
|
size_t linenr,
|
2008-11-04 22:30:33 +00:00
|
|
|
const char *fmt, ...)
|
2011-04-16 08:30:22 +00:00
|
|
|
ATTRIBUTE_FMT_PRINTF(6, 7);
|
2008-11-04 22:30:33 +00:00
|
|
|
|
2010-02-04 20:02:58 +00:00
|
|
|
void virReportSystemErrorFull(int domcode,
|
2009-01-20 17:13:33 +00:00
|
|
|
int theerrno,
|
|
|
|
const char *filename,
|
|
|
|
const char *funcname,
|
|
|
|
size_t linenr,
|
|
|
|
const char *fmt, ...)
|
2010-02-04 20:02:58 +00:00
|
|
|
ATTRIBUTE_FMT_PRINTF(6, 7);
|
2009-01-20 17:13:33 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define virReportSystemError(theerrno, fmt,...) \
|
2010-02-04 20:02:58 +00:00
|
|
|
virReportSystemErrorFull(VIR_FROM_THIS, \
|
2009-01-20 17:13:33 +00:00
|
|
|
(theerrno), \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
(fmt), __VA_ARGS__)
|
|
|
|
|
2010-02-04 18:19:08 +00:00
|
|
|
void virReportOOMErrorFull(int domcode,
|
2009-01-20 17:13:33 +00:00
|
|
|
const char *filename,
|
|
|
|
const char *funcname,
|
|
|
|
size_t linenr);
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define virReportOOMError() \
|
2010-02-04 18:19:08 +00:00
|
|
|
virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
|
2009-01-20 17:13:33 +00:00
|
|
|
|
2008-11-04 22:30:33 +00:00
|
|
|
|
2010-01-09 01:38:55 +00:00
|
|
|
int virSetError(virErrorPtr newerr);
|
2009-09-30 15:11:47 +00:00
|
|
|
void virDispatchError(virConnectPtr conn);
|
2009-02-05 16:10:07 +00:00
|
|
|
const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
|
2009-01-20 12:01:45 +00:00
|
|
|
|
2011-01-21 17:25:01 +00:00
|
|
|
typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int);
|
|
|
|
void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func);
|
|
|
|
|
2008-11-04 22:30:33 +00:00
|
|
|
#endif
|