aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-02-10 12:02:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-02-10 12:02:47 +0200
commit3e8ab07d25da1310db86cfca7e18eb0ad1987c8d (patch)
tree17367f65947ac2ba7fc121f4f24fb0f23a3bd08c
parente9618132afa2b43e9ff71c1d0a46f4d962db8352 (diff)
Make buildable on *BSD
-rw-r--r--manifest2
-rw-r--r--openssl/agent/pkcs11/agent.cxx16
2 files changed, 15 insertions, 3 deletions
diff --git a/manifest b/manifest
index 0fad2d5..6fa2a77 100644
--- a/manifest
+++ b/manifest
@@ -13,7 +13,7 @@ doc-url: https://build2.org/doc.xhtml
src-url: https://git.build2.org/cgit/openssl-agent/tree/
email: users@build2.org
build-warning-email: builds@build2.org
-builds: host : &linux ; Currently only supported on Linux.
+builds: host : &( +linux +freebsd ); Currently only supported on Linux and BSD.
requires: c++14
depends: * build2 >= 0.15.0-
depends: * bpkg >= 0.15.0-
diff --git a/openssl/agent/pkcs11/agent.cxx b/openssl/agent/pkcs11/agent.cxx
index 8d61208..273414e 100644
--- a/openssl/agent/pkcs11/agent.cxx
+++ b/openssl/agent/pkcs11/agent.cxx
@@ -6,6 +6,20 @@
#include <sys/socket.h>
#include <signal.h> // kill(), sigaction(), sigemptyset(), SIG*
+
+// _NSIG is Linux-specific but *BSD appear to have NSIG/_NSIG.
+//
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+# include <sys/signal.h>
+# ifndef _NSIG
+# ifdef NSIG
+# define _NSIG NSIG
+# else
+# error neither _NSIG nor NSIG defined
+# endif
+# endif
+#endif
+
#include <unistd.h> // fork(), getpid(), dup2(), setsid()
#include <termios.h> // tcgetattr(), tcsetattr()
@@ -235,8 +249,6 @@ namespace openssl
// future versions. Thus, we will provide our own implementation of the
// function that is inspired by the openssh implementation.
//
- // Note: _NSIG is Linux-specic.
- //
static volatile sig_atomic_t received_signals[_NSIG];
extern "C" void