diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 30 | ||||
-rw-r--r-- | runtime/typedefs.h | 6 |
2 files changed, 32 insertions, 4 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index a5c52810..8c50b7b3 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2989,15 +2989,39 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, break; case PROP_SYS_UPTIME: # ifndef HAVE_SYSINFO_UPTIME - /* An alternative on some systems (eg Solaris) is to scan - * /var/adm/utmpx for last boot time. - */ + /* 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; + +# elseif defined(__FreeBSD__) + + { + struct timespec tp; + + if(*pbMustBeFreed == 1) + free(pRes); + if((pRes = (uchar*) MALLOC(sizeof(uchar) * 32)) == NULL) { + RET_OUT_OF_MEMORY; + } + *pbMustBeFreed = 1; + + if(clock_gettime(CLOCK_UPTIME, &tp) == -1) { + *pPropLen = sizeof("**SYSCALL FAILED**") - 1; + return(UCHAR_CONSTANT("**SYSCALL FAILED**")); + } + + snprintf((char*) pRes, sizeof(uchar) * 32, "%ld", tp.tv_sec); + } + # else + { struct sysinfo s_info; + if(*pbMustBeFreed == 1) + free(pRes); if((pRes = (uchar*) MALLOC(sizeof(uchar) * 32)) == NULL) { RET_OUT_OF_MEMORY; } diff --git a/runtime/typedefs.h b/runtime/typedefs.h index 5cc24e4a..ca63d0d5 100644 --- a/runtime/typedefs.h +++ b/runtime/typedefs.h @@ -3,7 +3,7 @@ * * Begun 2010-11-25 RGerhards * - * Copyright (C) 2005-2008 by Rainer Gerhards and Adiscon GmbH + * Copyright (C) 2005-2013 by Rainer Gerhards and Adiscon GmbH * * This file is part of the rsyslog runtime library. * @@ -148,6 +148,10 @@ typedef enum { FIOP_ISEMPTY = 6 /* string empty <=> strlen(s) == 0 ?*/ } fiop_t; +#if defined(__FreeBSD__) + typedef off_t off64_t; +#endif + /* types of configuration handlers */ typedef enum cslCmdHdlrType { |