Use logging.h instead of syslog.h
This commit is contained in:
parent
72cd8938e2
commit
e26dd56416
21 changed files with 52 additions and 48 deletions
|
@ -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 <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "subnet.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
#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"
|
||||
|
||||
|
|
|
@ -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 <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
|
@ -48,6 +47,7 @@
|
|||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "subnet.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <avl_tree.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
@ -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 <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
/* 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"
|
||||
|
||||
|
|
|
@ -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 <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
/* 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"
|
||||
|
||||
|
|
|
@ -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 <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
/* 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"
|
||||
|
||||
|
|
|
@ -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 <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
/* 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"
|
||||
|
||||
|
|
|
@ -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 <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "subnet.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <utils.h>
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "netutl.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "subnet.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <syslog.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include "protocol.h"
|
||||
#include "meta.h"
|
||||
#include "connection.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
@ -50,6 +49,7 @@
|
|||
#include "node.h"
|
||||
#include "edge.h"
|
||||
#include "graph.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
@ -42,6 +41,7 @@
|
|||
#include "node.h"
|
||||
#include "edge.h"
|
||||
#include "graph.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
@ -37,6 +36,7 @@
|
|||
#include "protocol.h"
|
||||
#include "meta.h"
|
||||
#include "connection.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
@ -42,6 +41,7 @@
|
|||
#include "node.h"
|
||||
#include "edge.h"
|
||||
#include "graph.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <netinet/if_ether.h>
|
||||
#include <utils.h>
|
||||
#include <xalloc.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <avl_tree.h>
|
||||
|
@ -49,6 +48,7 @@
|
|||
#include "route.h"
|
||||
#include "protocol.h"
|
||||
#include "device.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
|
@ -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 <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stropts.h>
|
||||
|
@ -44,6 +43,7 @@
|
|||
#include "conf.h"
|
||||
#include "net.h"
|
||||
#include "subnet.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
|
12
src/tincd.c
12
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 <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue