Author: mturk
Date: Sat Apr 16 21:26:57 2011
New Revision: 1094056
URL: http://svn.apache.org/viewvc?rev=1094056&view=rev
Log:
Add config check for sem_open support
Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c
Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=1094056&r1=1094055&r2=1094056&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Sat Apr 16 21:26:57
2011
@@ -1093,6 +1093,24 @@ EOF
echo $rc
}
+have_sem_open()
+{
+ do_printf 'Checking for %-32s' "sem_open support"
+ cat > $cccsrc.c << EOF
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <semaphore.h>
+int main (){
+sem_open("/unknown$$", 0, 0, 0);
+if (errno==ENOSYS) puts("0");else puts("1");
+return 0;
+}
+EOF
+ rc=`test_compile x 0`
+ echo $rc
+}
+
have_ipv6()
{
do_printf 'Checking for %-32s' "ipv6 support"
@@ -1288,7 +1306,6 @@ extern "C" {
#define HAVE_READDIR64_R `have_function x readdir64_r`
#define HAVE_MMAP64 `have_function x mmap64`
#define HAVE_POSIX_MEMALIGN `have_function x posix_memalign`
-#define HAVE_POSIX_SEMAPHORE `have_function x sem_open`
#define HAVE_FDATASYNC `have_function x fdatasync`
#define HAVE_FLOCK `have_function x flock`
#define HAVE_CLOCK_GETTIME `have_function x clock_gettime`
@@ -1349,6 +1366,7 @@ extern "C" {
#define HAVE_FUNCTION `have_defined __FUNCTION__`
#define HAVE_FUNCSIG `have_defined __FUNCSIG__`
#define HAVE_FUNC `have_defined __func__`
+#define HAVE_POSIX_SEMAPHORE `have_sem_open`
#define HAVE_THREAD_LOCAL `have_thread_local`
#define HAVE_IPV6 `have_ipv6`
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c?rev=1094056&r1=1094055&r2=1094056&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c Sat Apr
16 21:26:57 2011
@@ -19,25 +19,15 @@
#include "acr/port.h"
#include "arch_opts.h"
-#if defined(__OpenBSD__)
-/* TODO: OpenBSD has sem_open but it returns ENOSYS */
-# undef HAVE_POSIX_SEMAPHORE
-# define HAVE_POSIX_SEMAPHORE 0
-#endif
#if HAVE_POSIX_SEMAPHORE
-#if HAVE_SEMAPHORE_H
-# include <semaphore.h>
+#include <semaphore.h>
-# if !defined(SEM_FAILED)
-# define SEM_FAILED (-1)
-# endif
-# if !defined(NAME_MAX)
-# define NAME_MAX 64
-# endif
-#else
-# error Cannot find semaphore.h
+#if !defined(SEM_FAILED)
+# define SEM_FAILED (-1)
+#endif
+#if !defined(NAME_MAX)
+# define NAME_MAX 64
#endif
-
J_DECLARE_CLAZZ = {
INVALID_FIELD_OFFSET,