summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-01-08 10:19:02 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-01-08 10:19:02 +0000
commit76f2da82e24e11be6cc119197f56875afc74b50f (patch)
tree58defe95f5b181fb28a8aa32bf62fe6dcd362925
parent02eba90dce53e2933e7f010d335c7a0052d13f83 (diff)
Test et inclusion de <sys/select.h>, en particulier pour AIX
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@601 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rwxr-xr-xconfig/autoconf5
-rw-r--r--config/s-templ.h5
-rw-r--r--otherlibs/threads/scheduler.c20
-rw-r--r--otherlibs/unix/select.c3
4 files changed, 29 insertions, 4 deletions
diff --git a/config/autoconf b/config/autoconf
index 8f7ba9f12..e11ae3088 100755
--- a/config/autoconf
+++ b/config/autoconf
@@ -186,6 +186,11 @@ if sh hasgot select; then
echo "#define HAS_SELECT" >> s.h
fi
+if test -f /usr/include/sys/select.h; then
+ echo "/usr/include/sys/select.h found."
+ echo "#define HAS_SYS_SELECT_H" >> s.h
+fi
+
if sh hasgot symlink readlink lstat; then
echo "symlink() found."
echo "#define HAS_SYMLINK" >> s.h
diff --git a/config/s-templ.h b/config/s-templ.h
index d56a28c9b..2e2dca29a 100644
--- a/config/s-templ.h
+++ b/config/s-templ.h
@@ -111,6 +111,11 @@
/* Define HAS_SELECT if you have select(). */
+#define HAS_SYS_SELECT_H
+
+/* Define HAS_SYS_SELECT_H if /usr/include/sys/select.h exists
+ and should be included before using select(). */
+
#define HAS_SYMLINK
/* Define HAS_SYMLINK if you have symlink() and readlink() and lstat(). */
diff --git a/otherlibs/threads/scheduler.c b/otherlibs/threads/scheduler.c
index f87d25952..bc3f627c9 100644
--- a/otherlibs/threads/scheduler.c
+++ b/otherlibs/threads/scheduler.c
@@ -1,7 +1,3 @@
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
#include "config.h"
#include "misc.h"
#include "mlvalues.h"
@@ -17,6 +13,22 @@
#include "Cannot compile libthreads, system calls missing"
#endif
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#ifdef HAS_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#ifndef FD_ISSET
+typedef int fd_set;
+#define FD_SETSIZE (sizeof(int) * 8)
+#define FD_SET(fd,fds) (*(fds) |= 1 << (fd))
+#define FD_CLR(fd,fds) (*(fds) &= ~(1 << (fd)))
+#define FD_ISSET(fd,fds) (*(fds) & (1 << (fd)))
+#define FD_ZERO(fds) (*(fds) = 0)
+#endif
+
/* Configuration */
/* Initial size of stack when a thread is created (4 Ko) */
diff --git a/otherlibs/unix/select.c b/otherlibs/unix/select.c
index ae1f5600a..0e6d16ec8 100644
--- a/otherlibs/unix/select.c
+++ b/otherlibs/unix/select.c
@@ -20,6 +20,9 @@
#include <sys/types.h>
#include <sys/time.h>
+#ifdef HAS_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#ifdef FD_ISSET
typedef fd_set file_descr_set;