nginx-0.0.7-2004-07-05-10:55:54 import
diff --git a/auto/os/freebsd b/auto/os/freebsd
index 5fa8e33..2d3353e 100644
--- a/auto/os/freebsd
+++ b/auto/os/freebsd
@@ -54,11 +54,29 @@
      -o $version -ge 500018 ]
 then
     echo " + using kqueue's NOTE_LOWAT"
-
     have=HAVE_LOWAT_EVENT . auto/have
 fi
 
 
+if [ $USE_THREADS = "rfork" ]; then
+
+    echo " + using rfork()"
+
+    # kqueue's EVFILT_SIGNAL is safe
+
+    if [ $version -gt 460101 ]; then
+        echo " + kqueue's EVFILT_SIGNAL is safe"
+        have=HAVE_SAFE_EVFILT_SIGNAL . auto/have
+    else
+        echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
+        echo "FreeBSD version, so --with-threads=rfork could not be used"
+        echo
+
+        exit 1
+    fi
+fi
+
+
 if [ $EVENT_AIO = YES ]; then
     have=HAVE_AIO . auto/have
     EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"