libuproc  1.2.0
error.h
Go to the documentation of this file.
1 /* Copyright 2014 Peter Meinicke, Robin Martinjak
2  *
3  * This file is part of libuproc.
4  *
5  * libuproc is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation, either version 3 of the License, or (at your option)
8  * any later version.
9  *
10  * libuproc is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libuproc. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
32 #ifndef UPROC_ERROR_H
33 #define UPROC_ERROR_H
34 
35 #include "uproc/common.h"
36 
41 
44 
47 
50 
53 
56 
59 
62 
65 };
66 
67 /* Set error information */
68 int uproc_error_(enum uproc_error_code num, const char *func, const char *file,
69  int line, const char *fmt, ...);
70 
89 #define uproc_error_msg(num, ...) \
90  uproc_error_((num), __func__, __FILE__, __LINE__, __VA_ARGS__)
91 
92 /* Get pointer to thread-local uproc_errno */
93 int *uproc_error_errno_(void);
94 
96 #define uproc_error(num) uproc_error_msg((num), NULL)
97 
104 #define uproc_errno (*(uproc_error_errno_()))
105 
106 /* Get thread-local uproc_errmsg */
107 const char *uproc_error_errmsg_(void);
108 
114 #define uproc_errmsg (uproc_error_errmsg_())
115 
116 /* Get thread-local uproc_errloc */
117 const char *uproc_error_errloc_(void);
118 
125 #define uproc_errloc (uproc_error_errloc_())
126 
135 void uproc_perror(const char *fmt, ...);
136 
144 typedef void uproc_error_handler(enum uproc_error_code num, const char *msg,
145  const char *loc, void *context);
146 
167 void uproc_error_set_handler(uproc_error_handler *hdl, void *context);
168 
172 #endif
Success.
Definition: error.h:40
void uproc_error_set_handler(uproc_error_handler *hdl, void *context)
Set error handler.
uproc_error_code
Available error codes.
Definition: error.h:38
Object doesn't exist.
Definition: error.h:55
Invalid argument.
Definition: error.h:52
General failure.
Definition: error.h:43
Operation not supported.
Definition: error.h:64
Input/output error.
Definition: error.h:61
void uproc_error_handler(enum uproc_error_code num, const char *msg, const char *loc, void *context)
Error handler type.
Definition: error.h:144
Memory allocation failed.
Definition: error.h:49
Object already exists.
Definition: error.h:58
void uproc_perror(const char *fmt,...)
Print error message to stderr.
Module: Common definitions.
A system call (that sets errno) returned an error.
Definition: error.h:46