瀏覽代碼

- openbsd fixes

Andrei Pelinescu-Onciul 20 年之前
父節點
當前提交
263766043f
共有 2 個文件被更改,包括 13 次插入4 次删除
  1. 8 4
      io_wait.c
  2. 5 0
      io_wait.h

+ 8 - 4
io_wait.c

@@ -267,7 +267,9 @@ char* check_poll_method(enum poll_types poll_method)
 {
 	char* ret;
 	ret=0;
-	
+	unsigned int os_ver;
+
+	os_ver=get_sys_version(0,0,0);	
 	switch(poll_method){
 		case POLL_NONE:
 			break;
@@ -286,7 +288,7 @@ char* check_poll_method(enum poll_types poll_method)
 #ifndef HAVE_EPOLL
 			ret="epoll not supported, try re-compiling with -DHAVE_EPOLL";
 #else
-			if (get_sys_version(0,0,0)<0x020542) /* if ver < 2.5.66 */
+			if (os_ver<0x020542) /* if ver < 2.5.66 */
 			 	ret="epoll not supported on kernels < 2.6";
 #endif
 			break;
@@ -307,10 +309,12 @@ char* check_poll_method(enum poll_types poll_method)
 enum poll_types choose_poll_method()
 {
 	enum poll_types poll_method;
-	
+	unsigned int os_ver;
+
+	os_ver=get_sys_version(0,0,0);	
 	poll_method=0;
 #ifdef HAVE_EPOLL
-	if (get_sys_version(0,0,0)>=0x020542) /* if ver >= 2.5.66 */
+	if (os_ver>=0x020542) /* if ver >= 2.5.66 */
 		poll_method=POLL_EPOLL_LT; /* or POLL_EPOLL_ET */
 		
 #endif

+ 5 - 0
io_wait.h

@@ -65,6 +65,11 @@
 #include <sys/epoll.h>
 #endif
 #ifdef HAVE_SELECT
+/* needed on openbsd for select*/
+#include <sys/time.h> 
+#include <sys/types.h> 
+#include <unistd.h>
+/* needed according to POSIX for select*/
 #include <sys/select.h>
 #endif
 #include <sys/poll.h>