From: Ivo Timmermans Date: Sat, 13 Apr 2002 11:08:31 +0000 (+0000) Subject: Use logging.h instead of syslog.h X-Git-Tag: release-1.0.3~62 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=e26dd564163fca001ab1694a51e7412f9ac970de;p=tinc Use logging.h instead of syslog.h --- diff --git a/src/freebsd/device.c b/src/freebsd/device.c index 39f9df50..112ea200 100644 --- a/src/freebsd/device.c +++ b/src/freebsd/device.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.2 2002/04/09 15:32:14 zarq Exp $ + $Id: device.c,v 1.3 2002/04/13 11:08:31 zarq Exp $ */ #include "config.h" @@ -31,13 +31,13 @@ #include #include #include -#include #include #include #include "conf.h" #include "net.h" #include "subnet.h" +#include "logging.h" #include "system.h" diff --git a/src/graph.c b/src/graph.c index cf5a4165..1f370cd9 100644 --- a/src/graph.c +++ b/src/graph.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: graph.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: graph.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ /* We need to generate two trees from the graph: @@ -47,7 +47,6 @@ #include "config.h" #include -#include #include "config.h" #include #if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD) @@ -63,6 +62,7 @@ #include "edge.h" #include "connection.h" #include "process.h" +#include "logging.h" #include "system.h" diff --git a/src/linux/device.c b/src/linux/device.c index 09028dee..59b88469 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.2 2002/04/09 15:32:14 zarq Exp $ + $Id: device.c,v 1.3 2002/04/13 11:08:31 zarq Exp $ */ #include "config.h" @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -48,6 +47,7 @@ #include "conf.h" #include "net.h" #include "subnet.h" +#include "logging.h" #include "system.h" diff --git a/src/logging.c b/src/logging.c index 867dd3e8..59d74d91 100644 --- a/src/logging.c +++ b/src/logging.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: logging.c,v 1.3 2002/04/13 10:43:10 zarq Exp $ + $Id: logging.c,v 1.4 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -85,10 +85,10 @@ void log_syslog(int level, int priority, char *fmt, va_list ap) vsyslog(priorities[priority], fmt, ap); } -void syslog(int priority, char *fmt, ...) +void tinc_syslog(int priority, char *fmt, ...) { /* Mapping syslog prio -> tinc prio */ - const int priorities[] = { TLOG_CRIT, TLOG_CRIT, TLOG_CRIT, TLOG_ERR, + const int priorities[] = { TLOG_CRITICAL, TLOG_CRITICAL, TLOG_CRITICAL, TLOG_ERROR, TLOG_NOTICE, TLOG_NOTICE, TLOG_INFO, TLOG_DEBUG }; avl_node_t *avlnode; va_list args; diff --git a/src/meta.c b/src/meta.c index 352c691f..c0367829 100644 --- a/src/meta.c +++ b/src/meta.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: meta.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: meta.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -25,7 +25,6 @@ #include #include -#include #include #include /* This line must be below the rest for FreeBSD */ @@ -38,6 +37,7 @@ #include "connection.h" #include "system.h" #include "protocol.h" +#include "logging.h" int send_meta(connection_t *c, char *buffer, int length) { diff --git a/src/net.c b/src/net.c index 39f01fa7..cb060bf2 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.37 2002/04/09 15:26:00 zarq Exp $ + $Id: net.c,v 1.38 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -36,7 +36,6 @@ #include #include #include -#include #include #include /* SunOS really wants sys/socket.h BEFORE net/if.h, @@ -65,6 +64,7 @@ #include "route.h" #include "device.h" #include "event.h" +#include "logging.h" #include "system.h" diff --git a/src/net_packet.c b/src/net_packet.c index 087df8a5..45c4a338 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_packet.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: net_packet.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -36,7 +36,6 @@ #include #include #include -#include #include #include /* SunOS really wants sys/socket.h BEFORE net/if.h, @@ -74,6 +73,7 @@ #include "route.h" #include "device.h" #include "event.h" +#include "logging.h" #include "system.h" diff --git a/src/net_setup.c b/src/net_setup.c index 9591c941..2726aa25 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_setup.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: net_setup.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -36,7 +36,6 @@ #include #include #include -#include #include #include /* SunOS really wants sys/socket.h BEFORE net/if.h, @@ -67,6 +66,7 @@ #include "route.h" #include "device.h" #include "event.h" +#include "logging.h" #include "system.h" diff --git a/src/net_socket.c b/src/net_socket.c index cc509dc2..6b7ba644 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_socket.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: net_socket.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -36,7 +36,6 @@ #include #include #include -#include #include #include /* SunOS really wants sys/socket.h BEFORE net/if.h, @@ -63,6 +62,7 @@ #include "route.h" #include "device.h" #include "event.h" +#include "logging.h" #include "system.h" diff --git a/src/netbsd/device.c b/src/netbsd/device.c index 996dd875..f89c6bf5 100644 --- a/src/netbsd/device.c +++ b/src/netbsd/device.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.2 2002/04/09 15:32:14 zarq Exp $ + $Id: device.c,v 1.3 2002/04/13 11:08:31 zarq Exp $ */ #include "config.h" @@ -32,13 +32,13 @@ #include #include #include -#include #include #include #include "conf.h" #include "net.h" #include "subnet.h" +#include "logging.h" #include "system.h" diff --git a/src/netutl.c b/src/netutl.c index be901641..9b9ca314 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.14 2002/04/09 15:26:00 zarq Exp $ + $Id: netutl.c,v 1.15 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -30,7 +30,7 @@ #include #include #include -#include + #include #include @@ -40,6 +40,7 @@ #include "conf.h" #include "net.h" #include "netutl.h" +#include "logging.h" #include "system.h" diff --git a/src/openbsd/device.c b/src/openbsd/device.c index 7f20a950..f47cc448 100644 --- a/src/openbsd/device.c +++ b/src/openbsd/device.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.2 2002/04/09 15:32:14 zarq Exp $ + $Id: device.c,v 1.3 2002/04/13 11:08:31 zarq Exp $ */ #include "config.h" @@ -32,13 +32,13 @@ #include #include #include -#include #include #include #include "conf.h" #include "net.h" #include "subnet.h" +#include "logging.h" #include "system.h" diff --git a/src/process.c b/src/process.c index 1f0a012f..3e3cd93d 100644 --- a/src/process.c +++ b/src/process.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: process.c,v 1.3 2002/04/13 10:25:38 zarq Exp $ + $Id: process.c,v 1.4 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -27,11 +27,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -46,6 +46,7 @@ #include "device.h" #include "connection.h" #include "device.h" +#include "logging.h" #include "system.h" @@ -66,7 +67,9 @@ extern int do_purge; void memory_full(int size) { - syslog(LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exitting."), size); + log(0, TLOG_ERROR, + _("Memory exhausted (couldn't allocate %d bytes), exitting."), + size); cp_trace(); exit(1); } diff --git a/src/protocol.c b/src/protocol.c index fa43453f..f3a7cea4 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.c,v 1.30 2002/04/09 15:26:00 zarq Exp $ + $Id: protocol.c,v 1.31 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include "protocol.h" #include "meta.h" #include "connection.h" +#include "logging.h" #include "system.h" diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 24f8c758..b9f845b6 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -17,14 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_auth.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: protocol_auth.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include "node.h" #include "edge.h" #include "graph.h" +#include "logging.h" #include "system.h" diff --git a/src/protocol_edge.c b/src/protocol_edge.c index f387153c..b9fec18a 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -17,14 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_edge.c,v 1.2 2002/04/09 15:26:00 zarq Exp $ + $Id: protocol_edge.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" #include #include -#include #include #include #include @@ -42,6 +41,7 @@ #include "node.h" #include "edge.h" #include "graph.h" +#include "logging.h" #include "system.h" diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 96234e4f..d99ef5b3 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -17,14 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_misc.c,v 1.2 2002/04/09 15:26:01 zarq Exp $ + $Id: protocol_misc.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include "protocol.h" #include "meta.h" #include "connection.h" +#include "logging.h" #include "system.h" diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index 9d93dfbf..2eade14f 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -17,14 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_subnet.c,v 1.2 2002/04/09 15:26:01 zarq Exp $ + $Id: protocol_subnet.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" #include #include -#include #include #include #include @@ -42,6 +41,7 @@ #include "node.h" #include "edge.h" #include "graph.h" +#include "logging.h" #include "system.h" diff --git a/src/route.c b/src/route.c index 0496721a..1d2eafaa 100644 --- a/src/route.c +++ b/src/route.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: route.c,v 1.2 2002/04/09 15:26:01 zarq Exp $ + $Id: route.c,v 1.3 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -49,6 +48,7 @@ #include "route.h" #include "protocol.h" #include "device.h" +#include "logging.h" #include "system.h" diff --git a/src/solaris/device.c b/src/solaris/device.c index 1375d1f2..f7a0f855 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: device.c,v 1.2 2002/04/09 15:32:14 zarq Exp $ + $Id: device.c,v 1.3 2002/04/13 11:08:31 zarq Exp $ */ @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -44,6 +43,7 @@ #include "conf.h" #include "net.h" #include "subnet.h" +#include "logging.h" #include "system.h" diff --git a/src/tincd.c b/src/tincd.c index e53f5776..4e766a8c 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tincd.c,v 1.13 2002/04/13 10:25:38 zarq Exp $ + $Id: tincd.c,v 1.14 2002/04/13 11:07:12 zarq Exp $ */ #include "config.h" @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -52,6 +51,7 @@ #include "process.h" #include "protocol.h" #include "subnet.h" +#include "logging.h" #include "system.h" @@ -296,7 +296,7 @@ void make_names(void) if(!confbase) asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname); else - syslog(LOG_INFO, _("Both netname and configuration directory given, using the latter...")); + log(0, TLOG_INFO, _("Both netname and configuration directory given, using the latter...")); if(!identname) asprintf(&identname, "tinc.%s", netname); } @@ -379,17 +379,17 @@ cp cleanup_and_exit(1); } - syslog(LOG_ERR, _("Unrecoverable error")); + log(0, TLOG_ERROR, _("Unrecoverable error")); cp_trace(); if(do_detach) { - syslog(LOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout); + log(0, TLOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout); sleep(maxtimeout); } else { - syslog(LOG_ERR, _("Not restarting.")); + log(0, TLOG_ERROR, _("Not restarting.")); exit(1); } }