Skip to content

Commit 165f92d

Browse files
authored
Merge pull request syslog-ng#5099 from HofiOne/Fix-FreeBSD-builds
Fix free bsd builds
2 parents b05758e + 5029485 commit 165f92d

File tree

5 files changed

+51
-39
lines changed

5 files changed

+51
-39
lines changed

cmake/Modules/FindInotify.cmake

+29-23
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,39 @@
4646
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4747
#=============================================================================
4848

49-
find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
50-
if(Inotify_INCLUDE_DIRS)
51-
# On Linux there is no library to link against, on the BSDs there is.
52-
# On the BSD's, inotify is implemented through a library, libinotify.
53-
if( CMAKE_SYSTEM_NAME MATCHES "Linux")
49+
set(Inotify_FOUND FALSE)
50+
51+
find_path (Inotify_INCLUDE_DIRS sys/inotify.h)
52+
if (Inotify_INCLUDE_DIRS)
53+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
54+
# On Linux there is no library to link against, on the BSDs there is.
5455
set(Inotify_FOUND TRUE)
5556

5657
set(Inotify_INCLUDE_DIRS "")
57-
else()
58-
find_library(Inotify_LIBRARIES NAMES inotify)
59-
include(FindPackageHandleStandardArgs)
60-
find_package_handle_standard_args(Inotify
61-
FOUND_VAR
62-
Inotify_FOUND
63-
REQUIRED_VARS
64-
Inotify_LIBRARIES
65-
Inotify_INCLUDE_DIRS
66-
)
67-
mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS)
68-
include(FeatureSummary)
69-
set_package_properties(Inotify PROPERTIES
70-
URL "https://github.com/libinotify-kqueue/"
71-
DESCRIPTION "inotify API on the *BSD family of operating systems."
72-
)
58+
#else()
59+
# On the BSD's, inotify is implemented through a library, libinotify.
60+
# But we disabled that for now because
61+
# - Ivykis currently supports inotify only for directory monitoring, not for files
62+
# - libinotify is just a wrapper around kqueue, why would we want a wrapper around
63+
# a natively supported solution, instead of using it directly
64+
# https://github.com/buytenh/ivykis/issues/37
65+
66+
#find_library(Inotify_LIBRARIES NAMES inotify)
67+
#include(FindPackageHandleStandardArgs)
68+
#find_package_handle_standard_args(Inotify
69+
# FOUND_VAR
70+
# Inotify_FOUND
71+
# REQUIRED_VARS
72+
# Inotify_LIBRARIES
73+
# Inotify_INCLUDE_DIRS
74+
#)
75+
#mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS)
76+
#include(FeatureSummary)
77+
#set_package_properties(Inotify PROPERTIES
78+
# URL "https://github.com/libinotify-kqueue/"
79+
# DESCRIPTION "inotify API on the *BSD family of operating systems."
80+
#)
7381
endif()
74-
else()
75-
set(Inotify_FOUND FALSE)
7682
endif()
7783

7884
mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS)

cmake/Modules/FindRiemannClient.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ endif()
3030
if (NOT Riemann_LIBRARY)
3131
libfind_pkg_detect(Riemann riemann-client FIND_PATH riemann/event.h FIND_LIBRARY riemann-client-no-tls)
3232
endif()
33+
if (NOT Riemann_LIBRARY)
34+
libfind_pkg_detect (Riemann riemann-client FIND_PATH riemann/event.h FIND_LIBRARY riemann-client-gnutls)
35+
endif ()
36+
3337
if (Riemann_LIBRARY)
3438
message(STATUS "Found Riemann client: ${Riemann_LIBRARY}")
3539
endif()

lib/timeutils/cache.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ _get_system_tzofs(void)
147147
{
148148
#ifdef SYSLOG_NG_HAVE_TIMEZONE
149149
/* global variable */
150-
return timezone;
150+
return (glong) timezone;
151151
#elif SYSLOG_NG_HAVE_STRUCT_TM_TM_GMTOFF
152152
time_t t = time(NULL);
153153
struct tm *tm;

modules/affile/directory-monitor-factory.c

+11-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ directory_monitor_factory_get_monitor_method(const gchar *method)
4848
{
4949
return MM_INOTIFY;
5050
}
51-
#elif SYSLOG_NG_HAVE_KQUEUE
51+
#endif
52+
#if SYSLOG_NG_HAVE_KQUEUE
5253
else if (strcmp(method, "kqueue") == 0)
5354
{
5455
return MM_KQUEUE;
@@ -61,30 +62,26 @@ DirectoryMonitorConstructor
6162
directory_monitor_factory_get_constructor(DirectoryMonitorOptions *options)
6263
{
6364
DirectoryMonitorConstructor constructor = NULL;
65+
6466
#if SYSLOG_NG_HAVE_INOTIFY
6567
if (options->method == MM_AUTO || options->method == MM_INOTIFY)
6668
{
6769
constructor = directory_monitor_inotify_new;
6870
}
69-
else if (options->method == MM_POLL)
70-
{
71-
constructor = directory_monitor_poll_new;
72-
}
73-
#elif SYSLOG_NG_HAVE_KQUEUE
74-
if (options->method == MM_AUTO || options->method == MM_KQUEUE)
71+
#endif
72+
73+
#if SYSLOG_NG_HAVE_KQUEUE
74+
if (constructor == NULL && (options->method == MM_AUTO || options->method == MM_KQUEUE))
7575
{
7676
constructor = directory_monitor_kqueue_new;
7777
}
78-
else if (options->method == MM_POLL)
79-
{
80-
constructor = directory_monitor_poll_new;
81-
}
82-
#else
83-
if (options->method == MM_AUTO || options->method == MM_POLL)
78+
#endif
79+
80+
if (constructor == NULL && (options->method == MM_AUTO || options->method == MM_POLL))
8481
{
8582
constructor = directory_monitor_poll_new;
8683
}
87-
#endif
84+
8885
return constructor;
8986
}
9087

modules/affile/directory-monitor-kqueue.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ static void handle_kqueue_event(void *s)
6767
static gboolean
6868
_register_kqueue_watches(DirectoryMonitorKQueue *self)
6969
{
70-
gint fd = open(self->super.super.dir, O_EVTONLY);
70+
#ifdef __APPLE__
71+
gint open_mode = O_EVTONLY | O_DIRECTORY;
72+
#else
73+
gint open_mode = O_NONBLOCK | O_RDONLY | O_DIRECTORY;
74+
#endif
75+
gint fd = open(self->super.super.dir, open_mode);
7176
if (fd < 0)
7277
{
7378
msg_error("directory-monitor-kqueue: could not open directory for watching",

0 commit comments

Comments
 (0)