[PATCH 1/2] lib/replace: ensure NSIG always defined (system/wait.h)

Rusty Russell rusty at rustcorp.com.au
Fri Aug 28 01:51:56 MDT 2009


Linux and FreeBSD seem to define NSIG, at least (I've seen _NSIG used
as well; we could use that instead of "65" if available).

It's defined as the highest valid signal number, plus 1.

Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
---
 lib/replace/README           |    1 +
 lib/replace/system/config.m4 |    3 +++
 lib/replace/system/wait.h    |    5 +++++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lib/replace/README b/lib/replace/README
index 26383bc..60aa297 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -91,6 +91,7 @@ UINT16_MAX
 UINT32_MAX
 UINT64_MAX
 CHAR_BIT
+NSIG
 
 Macros:
 va_copy
diff --git a/lib/replace/system/config.m4 b/lib/replace/system/config.m4
index 39c2f58..4a591a9 100644
--- a/lib/replace/system/config.m4
+++ b/lib/replace/system/config.m4
@@ -13,6 +13,9 @@ AC_CHECK_FUNCS(utime utimes)
 
 # wait
 AC_HEADER_SYS_WAIT
+AC_HAVE_DECL(NSIG, [
+	#include <signal.h>
+])
 
 # capability
 AC_CHECK_HEADERS(sys/capability.h)
diff --git a/lib/replace/system/wait.h b/lib/replace/system/wait.h
index 79583ad..9687e92 100644
--- a/lib/replace/system/wait.h
+++ b/lib/replace/system/wait.h
@@ -56,4 +56,9 @@ typedef int sig_atomic_t;
 int rep_waitpid(pid_t pid,int *status,int options)
 #endif
 
+/* This is nowhere in ANSI, ISO or POSIX.  FreeBSD and Linux seem to have it. */
+#ifndef HAVE_NSIG_DECL
+#define NSIG 65
+#endif
+
 #endif
-- 
1.6.0.4




More information about the samba-technical mailing list