From d4035e5f623d24b706e22e23f4d900a89fac46b4 Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 16 Nov 2012 13:25:45 -0800 Subject: [PATCH] add freebsd crl-monitor support --- configure.ac | 5 +++-- src/crl.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 7c523480c..11df99e88 100644 --- a/configure.ac +++ b/configure.ac @@ -613,10 +613,10 @@ AC_ARG_ENABLE(crl-monitor, if test "$ENABLED_CRL_MONITOR" = "yes" then case $host_os in - *linux* | *darwin*) + *linux* | *darwin* | *freebsd*) AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;; *) - AC_MSG_ERROR([crl monitor only allowed on linux or OS X]) ;; + AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;; esac fi @@ -787,6 +787,7 @@ echo " * LEANPSK: $ENABLED_LEANPSK" echo " * ECC: $ENABLED_ECC" echo " * OCSP: $ENABLED_OCSP" echo " * CRL: $ENABLED_CRL" +echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR" echo " * NTRU: $ENABLED_NTRU" echo "" echo "---" diff --git a/src/crl.c b/src/crl.c index 599ec8057..b546af9cd 100644 --- a/src/crl.c +++ b/src/crl.c @@ -328,12 +328,20 @@ static int SwapLists(CYASSL_CRL* crl) } -#ifdef __MACH__ +#if (defined(__MACH__) || defined(__FreeBSD__)) +#include #include #include #include +#ifdef __MACH__ + #define XEVENT_MODE O_EVTONLY +#elif defined(__FreeBSD__) + #define XEVENT_MODE EVFILT_VNODE +#endif + + /* OS X monitoring */ static void* DoMonitor(void* arg) { @@ -354,7 +362,7 @@ static void* DoMonitor(void* arg) fDER = -1; if (crl->monitors[0].path) { - fPEM = open(crl->monitors[0].path, O_EVTONLY); + fPEM = open(crl->monitors[0].path, XEVENT_MODE); if (fPEM == -1) { CYASSL_MSG("PEM event dir open failed"); return NULL; @@ -362,7 +370,7 @@ static void* DoMonitor(void* arg) } if (crl->monitors[1].path) { - fDER = open(crl->monitors[1].path, O_EVTONLY); + fDER = open(crl->monitors[1].path, XEVENT_MODE); if (fDER == -1) { CYASSL_MSG("DER event dir open failed"); return NULL;