diff options
author | Martin Carpenter <mcarpenter@free.fr> | 2012-11-27 10:09:16 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-09 12:25:56 +0100 |
commit | 218b0c0331beb2a5d28a6b8d0fddad1b06b1b82d (patch) | |
tree | 1eebb6fafd2447796699e4858c2206713da0d144 | |
parent | 20265db5a2810f0e9bfcdc1d320cdc5835d7b5ff (diff) | |
download | rsyslog-218b0c0331beb2a5d28a6b8d0fddad1b06b1b82d.tar.gz rsyslog-218b0c0331beb2a5d28a6b8d0fddad1b06b1b82d.tar.bz2 rsyslog-218b0c0331beb2a5d28a6b8d0fddad1b06b1b82d.zip |
Check that sysinfo(2) can return uptime
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | runtime/msg.c | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 14a33c6c..4b76170b 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,7 @@ AC_CHECK_DECL([SCM_CREDENTIALS], [AC_DEFINE(HAVE_SCM_CREDENTIALS, [1], [set defi #include <sys/socket.h>]) AC_CHECK_DECL([SO_TIMESTAMP], [AC_DEFINE(HAVE_SO_TIMESTAMP, [1], [set define])], [], [#include <sys/types.h> #include <sys/socket.h>]) +AC_CHECK_MEMBER([struct sysinfo.uptime], [AC_DEFINE(HAVE_SYSINFO_UPTIME, [1], [set define])], [], [#include <sys/sysinfo.h>]) # Check for MAXHOSTNAMELEN AC_MSG_CHECKING(for MAXHOSTNAMELEN) diff --git a/runtime/msg.c b/runtime/msg.c index 10605ba4..32a02424 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -36,7 +36,9 @@ #include <assert.h> #include <ctype.h> #include <sys/socket.h> +#if HAVE_SYSINFO_UPTIME #include <sys/sysinfo.h> +#endif #include <netdb.h> #include <libestr.h> #include <json/json.h> @@ -2773,7 +2775,10 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, *pbMustBeFreed = 0; break; case PROP_SYS_UPTIME: -# ifndef HAVE_SYSINFO +# ifndef HAVE_SYSINFO_UPTIME + /* An alternative on some systems (eg Solaris) is to scan + * /var/adm/utmpx for last boot time. + */ pRes = (uchar*) "UPTIME NOT available on this system"; *pbMustBeFreed = 0; # else |