freebsd-ports/net-mgmt/mk-livestatus/files/patch-src__livecheck.c
Olli Hauer f35cb70eca - update to 1.2.2p2
Changes:
==========
1.2.p1
 livestatus.log: show utf-8 decoding problems only with debug logging >=2

1.2.b6
 FIX: memory leak when removing downtime / comment

1.2.b5
 FIX: possible crash with VERY long downtime comments
 FIX: now able to handle equal comment id of host and service

1.2.b1
 Add: new column in hosts/services table: comments_with_extra_info Adds the entry type and entry time

1.2.1i4
 FIX: Changed logging output "Time to process request" to be debug output

1.2.1i2
 Added new table statehist, used for SLA queries
 Added new column check_command_expanded in table hosts
 Added new column check_command_expanded in table services
 New columns livestatus_threads, livestatus_{active,queued}_connections

1.2.0p4
 FIX: fix two problems when reloading module in Icinga (thanks to Ronny Biering) Mulitisite
2013-06-16 20:31:13 +00:00

63 lines
1.5 KiB
C

--- ./src/livecheck.c.orig 2013-06-10 14:49:02.000000000 +0200
+++ ./src/livecheck.c 2013-06-16 22:13:23.000000000 +0200
@@ -27,8 +27,14 @@
#include <sys/wait.h>
#include <sys/timeb.h>
#include <sys/resource.h>
+#ifdef __FreeBSD__
+#include <arpa/inet.h>
+#endif
#include <netinet/ip.h>
#include <stdlib.h>
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
#include <fcntl.h>
#include <string.h>
@@ -80,8 +86,13 @@
}
int is_host_check = service[0] == '\n';
+#ifndef __FreeBSD__
struct timeb start;
ftime(&start);
+#else
+ struct timeval start;
+ gettimeofday(&start);
+#endif
char output[16384];
int return_code;
// Optimization(1):
@@ -188,8 +199,13 @@
}
}
}
+#ifndef __FreeBSD__
struct timeb end;
ftime(&end);
+#else
+ struct timeval end;
+ gettimeofday(&end);
+#endif
char template[256];
snprintf(template, sizeof(template), "%s/cXXXXXX", check_result_path);
int fd = mkstemp(template);
@@ -212,10 +228,17 @@
getpid(),
0,
latency,
+#ifndef __FreeBSD__
(int)start.time,
start.millitm,
(int)end.time,
end.millitm,
+#else
+ (int)start.tv_sec,
+ start.tv_usec / 1000,
+ (int)end.tv_sec,
+ end.tv_usec / 1000,
+#endif
return_code);
char *ptr_output = output;
char *ptr_walk = output;