Hello community, here is the log from the commit of package ndoutils for openSUSE:Factory checked in at 2013-08-13 10:47:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ndoutils (Old) and /work/SRC/openSUSE:Factory/.ndoutils.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ndoutils" Changes: -------- --- /work/SRC/openSUSE:Factory/ndoutils/ndoutils.changes 2012-11-02 17:37:54.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ndoutils.new/ndoutils.changes 2013-08-13 10:47:30.000000000 +0200 @@ -1,0 +2,9 @@ +Mon Aug 12 17:01:02 UTC 2013 - [email protected] + +- Update to 1.5.2: + + Added Linux kernel tuning instructions (Eric Stanley) + + Added code to limit retries when system resources are too low + (Eric Stanley) + + Added code to retry sending messages queue is full (Mike Guthrie) + +------------------------------------------------------------------- Old: ---- ndoutils-1.5.1.tar.gz New: ---- ndoutils-1.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ndoutils.spec ++++++ --- /var/tmp/diff_new_pack.e960Fl/_old 2013-08-13 10:47:31.000000000 +0200 +++ /var/tmp/diff_new_pack.e960Fl/_new 2013-08-13 10:47:31.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ndoutils # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ Summary: Nagios v3.x Data Output Utilities License: GPL-2.0+ Group: System/Monitoring -Version: 1.5.1 +Version: 1.5.2 Release: 0 Url: http://www.nagios.org/ Source0: %{name}-%{version}.tar.gz ++++++ ndoutils-1.5-return-non-void-queue.patch ++++++ --- /var/tmp/diff_new_pack.e960Fl/_old 2013-08-13 10:47:31.000000000 +0200 +++ /var/tmp/diff_new_pack.e960Fl/_new 2013-08-13 10:47:31.000000000 +0200 @@ -1,16 +1,16 @@ ---- src/queue.c 2012-02-03 17:59:20.000000000 +0100 -+++ src/queue.c.new 2012-02-06 12:23:09.804407264 +0100 -@@ -26,7 +26,7 @@ - } - } - --int get_queue_id(int id) { -+void get_queue_id(int id) { - key_t key = ftok(NDO_QUEUE_PATH, NDO_QUEUE_ID+id); - - if ((queue_id = msgget(key, IPC_CREAT | 0600)) < 0) { ---- include/queue.h 2012-02-06 12:36:10.982449749 +0100 -+++ include/queue.h.new 2012-02-06 12:36:22.964450504 +0100 +--- src/queue.c.orig 2012-06-07 06:21:50.000000000 -0400 ++++ src/queue.c 2013-03-09 14:15:32.455341470 -0500 +@@ -32,7 +32,7 @@ + } + } + +-int get_queue_id(int id) { ++void get_queue_id(int id) { + key_t key = ftok(NDO_QUEUE_PATH, NDO_QUEUE_ID+id); + + if ((queue_id = msgget(key, IPC_CREAT | 0600)) < 0) { +--- include/queue.h.orig 2012-02-03 11:53:16.000000000 -0500 ++++ include/queue.h 2013-03-09 14:15:45.971602027 -0500 @@ -16,7 +16,7 @@ void del_queue(); ++++++ ndoutils-1.5.1.tar.gz -> ndoutils-1.5.2.tar.gz ++++++ ++++ 7199 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/Changelog new/ndoutils-1.5.2/Changelog --- old/ndoutils-1.5.1/Changelog 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/Changelog 2012-06-08 14:46:50.000000000 +0200 @@ -3,6 +3,12 @@ =================== +1.5.2 - 06/08/2012 +------------------ +* Added Linux kernel tuning instructions (Eric Stanley) +* Added code to limit retries when system resources are too low (Eric Stanley) +* Added code to retry sending messages queue is full (Mike Guthrie) + 1.5.1 - 05/15/2012 ------------------ * Fixed off-by-one error packing data in ndomod. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/README new/ndoutils-1.5.2/README --- old/ndoutils-1.5.1/README 2007-04-23 17:49:24.000000000 +0200 +++ new/ndoutils-1.5.2/README 2012-06-07 12:21:50.000000000 +0200 @@ -182,3 +182,70 @@ /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg + + +************************ +TUNING KERNEL PARAMETERS +************************ + +NDOUTILS uses a single message queue to communicate between the broker +module and the NDO2DB daemon. Depending on the operating system, there +may be parameters that need to be tuned in order for this communication +to work correctly. The discussion below applies specifically to Linux, +but may apply generally to other Unices as well. + +There are three Linux kernel parameters that determine the resources +provided to the messaging subsystem: + * kernel.msgmax is the maximum size of a single message in a + message queue + * kernel.msgmni is the maximum number of messages allowed in any + one message queue + * kernel.msgmnb is the total number of bytes allow in all messages + in any one message queue + +To see the current values for any of these parameters, cat +/proc/sys/kernel/msg{max|mni|mnb}. + +In order for NDOUTILS to work at all, kernel.msgmax must be greater than +the size of the queue_msg struct (currently 1026 bytes). Most Linux +distributions set kernel.msgmax to a default of 65536. + +If there are insufficient resources for sending messages between the +broker and the daemon, you will see an entry similar to the following +in your logs. (This is logged via the syslog facility, using the level +LOG_ERR and the default facility.) + + ndo2db: Warning: Retrying message send. This can occur because + you have too few messages allowed or too few total bytes + allowed in message queues. You are currently using 16 of 16 + mesages and 65536 of 65536 bytes in the queue. See README for + kernel tuning options. + +If you see this entry, the message will likely eventually be sent, +but retrying uses system resources, and there is the possibility that +more messages will queued than can be handled, causing the broker +module to stall. + +If you are close to or have exceeded the number of messages, you may +need to increase kernel.msgmni. If you are close to or have exceeded +the number of bytes in the queue, you may need to increase +kernel.msgmnb. In some cases you may need to increase both. + +A conservative approach would be to double the necessary value, stop +and restart both the NDO2DB daemon and Nagios Core, and watch for any +further messages. Note that if NDO2DB is started after Nagios Core, +you may see the warning above as the broker module first attempts to +flush its backlog of messages. + +To increase a value, echo the value to /proc/sys/kernel/msgmni or +/proc/sys/kernel/msgmnb as appropriate. + +For example, to increase the number of messages allowed in the queue +to 32, use the command 'echo 32 > /proc/sys/kernel/msgmni' (without +the quotes). + +Once you have determine the correct parameters, you can make them +permanent by editing /etc/sysctl.conf. Add or update the line of +the form 'kernel.msg{mni|mnb} = <value>' with the value(s) determined +above. The next time the system is booted, the values of the +parameters in /etc/sysctl.conf will be loaded. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/configure.in new/ndoutils-1.5.2/configure.in --- old/ndoutils-1.5.1/configure.in 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/configure.in 2012-06-08 14:46:50.000000000 +0200 @@ -12,9 +12,9 @@ AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) PKG_NAME=ndoutils -PKG_VERSION="1.5.1" +PKG_VERSION="1.5.2" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="05-15-2012" +PKG_REL_DATE="06-08-2012" dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL @@ -392,6 +392,12 @@ fi +USE_NANOSLEEP=yes +AC_ARG_ENABLE(nanosleep,AC_HELP_STRING([--enable-nanosleep],[enables use of nanosleep (instead of sleep) in event timing])) +AS_IF([test x$enable_nanosleep = xno],[USE_NANOSLEEP=no],[USE_NANOSLEEP=yes]) +if test x$USE_NANOSLEEP = xyes ; then + AC_DEFINE_UNQUOTED(USE_NANOSLEEP) +fi AC_OUTPUT(Makefile src/Makefile docs/docbook/en-en/Makefile subst) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/db/installdb new/ndoutils-1.5.2/db/installdb --- old/ndoutils-1.5.1/db/installdb 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/db/installdb 2012-06-08 14:46:50.000000000 +0200 @@ -45,7 +45,7 @@ or die "Cannot connect to database"; # Current database version -my $thisversion="1.5.1"; +my $thisversion="1.5.2"; # Create version table if it doesn't exist eval { $dbh->do("SELECT * FROM nagios_dbversion LIMIT 1") }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/db/upgradedb new/ndoutils-1.5.2/db/upgradedb --- old/ndoutils-1.5.1/db/upgradedb 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/db/upgradedb 2012-06-08 14:46:50.000000000 +0200 @@ -53,9 +53,9 @@ # Get current database version my $version; -my $thisversion="1.5.1"; -my $lastversion="1.5.1"; -my $legacyversion="1.5.1"; +my $thisversion="1.5.2"; +my $lastversion="1.5.2"; +my $legacyversion="1.5.2"; $version = $dbh->selectrow_array("SELECT version FROM nagios_dbversion WHERE name='ndoutils'"); if ($version eq "") { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/include/config.h.in new/ndoutils-1.5.2/include/config.h.in --- old/ndoutils-1.5.1/include/config.h.in 2009-08-12 23:19:38.000000000 +0200 +++ new/ndoutils-1.5.2/include/config.h.in 2012-06-01 20:03:48.000000000 +0200 @@ -279,4 +279,6 @@ #include <rand.h> #endif +#undef USE_NANOSLEEP + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/file2sock.c new/ndoutils-1.5.2/src/file2sock.c --- old/ndoutils-1.5.1/src/file2sock.c 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/src/file2sock.c 2012-06-08 14:46:50.000000000 +0200 @@ -6,7 +6,7 @@ * License: GPL v2 * * First Written: 05-13-2005 - * Last Modified: 05-15-2012 + * Last Modified: 06-08-2012 * **************************************************************/ @@ -14,9 +14,9 @@ #include "../include/common.h" #include "../include/io.h" -#define FILE2SOCK_VERSION "1.5.1" +#define FILE2SOCK_VERSION "1.5.2" #define FILE2SOCK_NAME "FILE2SOCK" -#define FILE2SOCK_DATE "05-15-2012" +#define FILE2SOCK_DATE "06-08-2012" int process_arguments(int,char **); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/log2ndo.c new/ndoutils-1.5.2/src/log2ndo.c --- old/ndoutils-1.5.1/src/log2ndo.c 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/src/log2ndo.c 2012-06-08 14:46:50.000000000 +0200 @@ -4,7 +4,7 @@ * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 2005-2009 Ethan Galstad * - * Last Modified: 05-15-2012 + * Last Modified: 06-08-2012 * **************************************************************/ @@ -13,9 +13,9 @@ #include "../include/io.h" #include "../include/protoapi.h" -#define LOG2NDO_VERSION "1.5.1" +#define LOG2NDO_VERSION "1.5.2" #define LOG2NDO_NAME "LOG2NDO" -#define LOG2NDO_DATE "05-15-2012" +#define LOG2NDO_DATE "06-08-2012" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/ndo2db.c new/ndoutils-1.5.2/src/ndo2db.c --- old/ndoutils-1.5.1/src/ndo2db.c 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/src/ndo2db.c 2012-06-08 14:46:50.000000000 +0200 @@ -5,7 +5,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 05-15-2012 + * Last Modified: 06-08-2012 * **************************************************************/ @@ -30,9 +30,9 @@ #include "../include/dh.h" #endif -#define NDO2DB_VERSION "1.5.1" +#define NDO2DB_VERSION "1.5.2" #define NDO2DB_NAME "NDO2DB" -#define NDO2DB_DATE "05-15-2012" +#define NDO2DB_DATE "06-08-2012" #ifdef HAVE_SSL SSL_METHOD *meth; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/ndomod.c new/ndoutils-1.5.2/src/ndomod.c --- old/ndoutils-1.5.1/src/ndomod.c 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/src/ndomod.c 2012-06-08 14:46:50.000000000 +0200 @@ -6,7 +6,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 05-15-2012 + * Last Modified: 06-08-2012 * *****************************************************************************/ @@ -50,9 +50,9 @@ NEB_API_VERSION(CURRENT_NEB_API_VERSION) -#define NDOMOD_VERSION "1.5.1" +#define NDOMOD_VERSION "1.5.2" #define NDOMOD_NAME "NDOMOD" -#define NDOMOD_DATE "05-15-2012" +#define NDOMOD_DATE "06-08-2012" void *ndomod_module_handle=NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/queue.c new/ndoutils-1.5.2/src/queue.c --- old/ndoutils-1.5.1/src/queue.c 2012-02-03 17:59:50.000000000 +0100 +++ new/ndoutils-1.5.2/src/queue.c 2012-06-07 12:21:50.000000000 +0200 @@ -1,69 +1,171 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <syslog.h> -#include "../include/queue.h" - -static int queue_id; -static const int queue_buff_size = sizeof(struct queue_msg) - sizeof(long); - -void zero_string(char *str, int size) { - int i; - - for (i = 0; i < size; i++) { - str[i] = '\0'; - } -} - -void del_queue() { - struct msqid_ds buf; - - if (msgctl(queue_id,IPC_RMID,&buf) < 0) { - syslog(LOG_ERR,"Error: queue remove error.\n"); - } -} - -int get_queue_id(int id) { - key_t key = ftok(NDO_QUEUE_PATH, NDO_QUEUE_ID+id); - - if ((queue_id = msgget(key, IPC_CREAT | 0600)) < 0) { - syslog(LOG_ERR,"Error: queue init error.\n"); - } -} - -void push_into_queue (char* buf) { - struct queue_msg msg; - int size; - msg.type = NDO_MSG_TYPE; - zero_string(msg.text, NDO_MAX_MSG_SIZE); - - strncpy(msg.text, buf, NDO_MAX_MSG_SIZE-1); -// size = sizeof(struct queue_msg) - sizeof(long); - -// if (msgsnd(queue_id, &msg, size, IPC_NOWAIT) < 0) { - if (msgsnd(queue_id, &msg, queue_buff_size, IPC_NOWAIT) < 0) { - syslog(LOG_ERR,"Error: queue send error.\n"); - } -} - -char* pop_from_queue() { - struct queue_msg msg; - char *buf; - - zero_string(msg.text, NDO_MAX_MSG_SIZE); - - if (msgrcv(queue_id, &msg, queue_buff_size, NDO_MSG_TYPE, MSG_NOERROR) < 0) { - syslog(LOG_ERR,"Error: queue recv error.\n"); - } - - int size = strlen(msg.text); - buf = (char*)calloc(size+1, sizeof(char)); - strncpy(buf, msg.text, size); - buf[size] = '\0'; - - return buf; -} - +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include "../include/queue.h" +#include <errno.h> +#include <time.h> + +#define RETRY_LOG_INTERVAL 600 /* Seconds */ +#define MAX_RETRIES 20 /* Max number of times to retry sending message */ + +static time_t last_retry_log_time = ( time_t)0; +static int queue_id; +static const int queue_buff_size = sizeof(struct queue_msg) - sizeof(long); + +void zero_string(char *str, int size) { + int i; + + for (i = 0; i < size; i++) { + str[i] = '\0'; + } +} + +void del_queue() { + struct msqid_ds buf; + + if (msgctl(queue_id,IPC_RMID,&buf) < 0) { + syslog(LOG_ERR,"Error: queue remove error.\n"); + } +} + +int get_queue_id(int id) { + key_t key = ftok(NDO_QUEUE_PATH, NDO_QUEUE_ID+id); + + if ((queue_id = msgget(key, IPC_CREAT | 0600)) < 0) { + syslog(LOG_ERR,"Error: queue init error.\n"); + } +} + +long get_msgmni( void) { + FILE * fp; + char buf[ 1024]; + char * endptr; + long msgmni; + + if( !( fp = fopen( "/proc/sys/kernel/msgmni", "r"))) { + return -1; + } + else { + fgets( buf, sizeof( buf), fp); + msgmni = strtol((const char *)buf, &endptr, 10); + return msgmni; + } +} + +void log_retry( void) { + + time_t now; + struct msqid_ds queue_stats; + FILE * fp; + long msgmni; + char logmsg[ 1024]; + char curstats[ 1024]; + const char * logfmt = "Warning: Retrying message send. This can occur because you have too few messages allowed or too few total bytes allowed in message queues. %s See README for kernel tuning options.\n"; +#if defined( __linux__) + const char * statsfmt = "You are currently using %lu of %lu messages and %lu of %lu bytes in the queue."; +#endif + + time( &now); + + /* if we've never logged a retry message or we've exceeded the retry log interval */ + if(( now - last_retry_log_time) > RETRY_LOG_INTERVAL) { + /* Get the message queue statistics */ + if(msgctl(queue_id, IPC_STAT, &queue_stats)) { + sprintf(curstats, "Unable to determine current message queue usage: error reading IPC_STAT: %d", errno); + sprintf(logmsg, logfmt, curstats); + syslog(LOG_ERR, logmsg); + } + else { +#if defined( __linux__) + /* Get the maximum number of messages allowed in a queue */ + msgmni = get_msgmni(); + if( msgmni < 0) { + sprintf(curstats, "Unable to determine current message queue usage: error reading IPC_INFO: %d", errno); + sprintf(logmsg, logfmt, curstats); + syslog(LOG_ERR, logmsg); + } + else { + sprintf(curstats, statsfmt, queue_stats.msg_qnum, + (unsigned long)msgmni, queue_stats.__msg_cbytes, + queue_stats.msg_qbytes); + sprintf(logmsg, logfmt, curstats); + syslog(LOG_ERR, logmsg); + } +#else + sprintf(logmsg, logfmt, ""); + syslog(LOG_ERR, logmsg); +#endif + } + last_retry_log_time = now; + } + else { + syslog(LOG_ERR,"Warning: queue send error, retrying...\n"); + } +} + +void push_into_queue (char* buf) { + struct queue_msg msg; + int size; + msg.type = NDO_MSG_TYPE; + zero_string(msg.text, NDO_MAX_MSG_SIZE); + struct timespec delay; + int sleep_time; + unsigned retrynum = 0; + + strncpy(msg.text, buf, NDO_MAX_MSG_SIZE-1); + + if (msgsnd(queue_id, &msg, queue_buff_size, IPC_NOWAIT) < 0) { + if (EAGAIN == errno) { + log_retry(); + /* added retry loop, data was being dropped if queue was full 5/22/2012 -MG */ + while((EAGAIN == errno) && ( retrynum++ < MAX_RETRIES)) { + if(msgsnd(queue_id, &msg, queue_buff_size, IPC_NOWAIT)==0) + break; + #ifdef USE_NANOSLEEP + delay.tv_sec=(time_t)sleep_time; + delay.tv_nsec=(long)((sleep_time-(double)delay.tv_sec)*1000000000); + nanosleep(&delay,NULL); + #else + delay.tv_sec=(time_t)sleep_time; + if(delay.tv_sec==0L) + delay.tv_sec=1; + delay.tv_nsec=0L; + sleep((unsigned int)delay.tv_sec); + #endif + } + if (retrynum < MAX_RETRIES) { + syslog(LOG_ERR,"Message sent to queue.\n"); + } + else { + syslog(LOG_ERR,"Error: max retries exceeded sending message to queue. Kernel queue parameters may neeed to be tuned. See README.\n"); + } + } + else { + syslog(LOG_ERR,"Error: queue send error.\n"); + } + } + +} + +char* pop_from_queue() { + struct queue_msg msg; + char *buf; + + zero_string(msg.text, NDO_MAX_MSG_SIZE); + + if (msgrcv(queue_id, &msg, queue_buff_size, NDO_MSG_TYPE, MSG_NOERROR) < 0) { + syslog(LOG_ERR,"Error: queue recv error.\n"); + } + + int size = strlen(msg.text); + buf = (char*)calloc(size+1, sizeof(char)); + strncpy(buf, msg.text, size); + buf[size] = '\0'; + + return buf; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/src/sockdebug.c new/ndoutils-1.5.2/src/sockdebug.c --- old/ndoutils-1.5.1/src/sockdebug.c 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/src/sockdebug.c 2012-06-08 14:46:50.000000000 +0200 @@ -5,15 +5,15 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-13-2005 - * Last Modified: 05-15-2012 + * Last Modified: 06-08-2012 * **************************************************************/ #include "../include/config.h" -#define SOCKDEBUG_VERSION "1.5.1" +#define SOCKDEBUG_VERSION "1.5.2" #define SOCKDEBUG_NAME "SOCKDEBUG" -#define SOCKDEBUG_DATE "05-15-2012" +#define SOCKDEBUG_DATE "06-08-2012" int cleanup_socket(int,char *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ndoutils-1.5.1/update-version new/ndoutils-1.5.2/update-version --- old/ndoutils-1.5.1/update-version 2012-05-17 12:46:46.000000000 +0200 +++ new/ndoutils-1.5.2/update-version 2012-06-08 14:46:50.000000000 +0200 @@ -10,10 +10,10 @@ fi # Current version number -CURRENTVERSION=1.5.1 +CURRENTVERSION=1.5.2 # Last date -LASTDATE=05-15-2012 +LASTDATE=06-08-2012 if [ "x$1" = "x" ] then -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
