1
/* NetworkManager -- Network link manager
3
* Ray Strode <rstrode@redhat.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* (C) Copyright 2005 Red Hat, Inc.
28
#define nm_print_backtrace() \
31
void *_call_stack[512]; \
32
int _call_stack_size; \
34
_call_stack_size = backtrace (_call_stack, \
35
G_N_ELEMENTS (_call_stack)); \
36
_symbols = backtrace_symbols (_call_stack, _call_stack_size); \
37
if (_symbols != NULL) \
41
g_critical ("traceback:\n"); \
42
while (_i < _call_stack_size) \
44
g_critical ("\t%s\n", _symbols[_i]); \
52
#define nm_get_timestamp(timestamp) \
56
g_get_current_time (&_tv); \
57
*timestamp = (_tv.tv_sec * (1.0 * G_USEC_PER_SEC) + \
58
_tv.tv_usec) / G_USEC_PER_SEC; \
62
#define nm_info(fmt, args...) \
65
g_message ("<information>\t" fmt "\n", ##args); \
68
#define nm_info_str(fmt_str, args...) \
71
g_message ("<information>\t%s\n", fmt_str, ##args); \
74
#define nm_debug(fmt, args...) \
78
nm_get_timestamp (&_timestamp); \
79
g_debug ("<debug info>\t[%f] %s (): " fmt "\n", _timestamp, \
83
#define nm_debug_str(fmt_str, args...) \
87
nm_get_timestamp (&_timestamp); \
88
g_debug ("<debug info>\t[%f] %s (): %s\n", _timestamp, \
89
G_STRFUNC, fmt_str, ##args); \
92
#define nm_warning(fmt, args...) \
95
g_warning ("<WARNING>\t %s (): " fmt "\n", \
99
#define nm_warning_str(fmt_str, args...) \
102
g_warning ("<WARNING>\t %s (): %s\n", \
103
G_STRFUNC, fmt_str, ##args); \
106
#define nm_error(fmt, args...) \
109
gdouble _timestamp; \
110
nm_get_timestamp (&_timestamp); \
111
g_critical ("<ERROR>\t[%f] %s (): " fmt "\n", _timestamp, \
112
G_STRFUNC, ##args); \
113
nm_print_backtrace (); \
117
#define nm_error_str(fmt_str, args...) \
120
gdouble _timestamp; \
121
nm_get_timestamp (&_timestamp); \
122
g_critical ("<ERROR>\t[%f] %s (): %s\n", _timestamp, \
123
G_STRFUNC, fmt_str, ##args); \
124
nm_print_backtrace (); \
128
gchar *nm_dbus_escape_object_path (const gchar *utf8_string);
129
gchar *nm_dbus_unescape_object_path (const gchar *object_path);
131
static inline const char *nm_find_openvpn (void)
133
static const char *openvpn_binary_paths[] =
140
const char **openvpn_binary = openvpn_binary_paths;
142
while (*openvpn_binary != NULL) {
143
if (g_file_test (*openvpn_binary, G_FILE_TEST_EXISTS))
148
return *openvpn_binary;
152
#endif /* NM_UTILS_H */