jjako | a760e32 | 2003-04-11 09:43:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Syslog functions. |
jjako | bd937b7 | 2004-12-30 16:22:42 +0000 | [diff] [blame] | 3 | * Copyright (C) 2003, 2004 Mondru AB. |
jjako | a760e32 | 2003-04-11 09:43:22 +0000 | [diff] [blame] | 4 | * |
| 5 | * The contents of this file may be used under the terms of the GNU |
| 6 | * General Public License Version 2, provided that the above copyright |
| 7 | * notice and this permission notice is included in all copies or |
| 8 | * substantial portions of the software. |
| 9 | * |
jjako | a760e32 | 2003-04-11 09:43:22 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef _SYSERR_H |
| 13 | #define _SYSERR_H |
| 14 | |
Holger Hans Peter Freyther | 9c7fd8e | 2014-12-04 16:32:37 +0100 | [diff] [blame] | 15 | #include <osmocom/core/logging.h> |
jjako | a760e32 | 2003-04-11 09:43:22 +0000 | [diff] [blame] | 16 | |
Holger Hans Peter Freyther | 9c7fd8e | 2014-12-04 16:32:37 +0100 | [diff] [blame] | 17 | enum { |
| 18 | DIP, |
| 19 | DTUN, |
| 20 | DGGSN, |
| 21 | DSGSN, |
Harald Welte | d46bcd2 | 2017-08-08 23:27:22 +0200 | [diff] [blame] | 22 | DICMP6, |
Holger Hans Peter Freyther | 9c7fd8e | 2014-12-04 16:32:37 +0100 | [diff] [blame] | 23 | }; |
Holger Hans Peter Freyther | 9c0ff4f | 2014-03-23 10:07:26 +0100 | [diff] [blame] | 24 | |
Holger Hans Peter Freyther | 9c7fd8e | 2014-12-04 16:32:37 +0100 | [diff] [blame] | 25 | #define SYS_ERR(sub, pri, en, fmt, args...) \ |
| 26 | if (en) { \ |
| 27 | logp2(sub, pri, __FILE__, __LINE__, 0, \ |
| 28 | "errno=%d/%s " fmt "\n", en, strerror(en), \ |
| 29 | ##args); \ |
| 30 | } else { \ |
| 31 | logp2(sub, pri, __FILE__, __LINE__, 0, \ |
| 32 | fmt "\n", ##args); \ |
| 33 | } |
| 34 | |
| 35 | extern const struct log_info log_info; |
jjako | a760e32 | 2003-04-11 09:43:22 +0000 | [diff] [blame] | 36 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 37 | #endif /* !_SYSERR_H */ |