Previous Thread
Next Thread
Print Thread
OS/2 patches for 0150 #90962 10/11/13 01:58 PM
Joined: Apr 2007
Posts: 58
K
KO Myung-Hun Offline OP
Member
OP Offline
Member
K
Joined: Apr 2007
Posts: 58
Hi/2, long time no see. ^^

I attach OS/2 patches for 0150.

Review, please...

Code:
diff -uNr  src/lib/web/mongoose.c.org src/lib/web/mongoose.c
--- src/lib/web/mongoose.c.org	2013-09-17 08:47:04.000000000 +0900
+++ src/lib/web/mongoose.c	2013-10-11 22:22:00.000000000 +0900
@@ -201,15 +201,6 @@
 	struct dirent  result;
 } DIR;
 
-#ifndef HAVE_POLL
-struct pollfd {
-	int fd;
-	short events;
-	short revents;
-};
-#define POLLIN 1
-#endif
-
 
 // Mark required libraries
 #ifdef _MSC_VER
@@ -219,7 +210,9 @@
 #else    // UNIX  specific
 #include <sys/wait.h>
 #include <sys/socket.h>
+#ifdef HAVE_POLL
 #include <sys/poll.h>
+#endif
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/time.h>
@@ -260,6 +253,20 @@
 
 #endif // End of Windows and UNIX specific includes
 
+#ifdef __OS2__
+#define NO_SOCKLEN_T
+#define SHUT_WR 1
+#endif
+
+#ifndef HAVE_POLL
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+#define POLLIN 1
+#endif
+
 #include "mongoose.h"
 
 #define MONGOOSE_VERSION "3.8"
@@ -1243,37 +1250,6 @@
 	return result;
 }
 
-#ifndef HAVE_POLL
-static int poll(struct pollfd *pfd, int n, int milliseconds) {
-	struct timeval tv;
-	fd_set set;
-	int i, result, maxfd = 0;
-
-	tv.tv_sec = milliseconds / 1000;
-	tv.tv_usec = (milliseconds % 1000) * 1000;
-	FD_ZERO(&set);
-
-	for (i = 0; i < n; i++) {
-	FD_SET((SOCKET) pfd[i].fd, &set);
-	pfd[i].revents = 0;
-
-	if (pfd[i].fd > maxfd) {
-		maxfd = pfd[i].fd;
-	}
-	}
-
-	if ((result = select(maxfd + 1, &set, NULL, NULL, &tv)) > 0) {
-	for (i = 0; i < n; i++) {
-		if (FD_ISSET(pfd[i].fd, &set)) {
-		pfd[i].revents = POLLIN;
-		}
-	}
-	}
-
-	return result;
-}
-#endif // HAVE_POLL
-
 #define set_close_on_exec(x) // No FD_CLOEXEC on Windows
 
 int mg_start_thread(mg_thread_func_t f, void *p) {
@@ -1483,6 +1459,37 @@
 }
 #endif // _WIN32
 
+#ifndef HAVE_POLL
+static int poll(struct pollfd *pfd, int n, int milliseconds) {
+	struct timeval tv;
+	fd_set set;
+	int i, result, maxfd = 0;
+
+	tv.tv_sec = milliseconds / 1000;
+	tv.tv_usec = (milliseconds % 1000) * 1000;
+	FD_ZERO(&set);
+
+	for (i = 0; i < n; i++) {
+	FD_SET((SOCKET) pfd[i].fd, &set);
+	pfd[i].revents = 0;
+
+	if (pfd[i].fd > maxfd) {
+		maxfd = pfd[i].fd;
+	}
+	}
+
+	if ((result = select(maxfd + 1, &set, NULL, NULL, &tv)) > 0) {
+	for (i = 0; i < n; i++) {
+		if (FD_ISSET(pfd[i].fd, &set)) {
+		pfd[i].revents = POLLIN;
+		}
+	}
+	}
+
+	return result;
+}
+#endif // HAVE_POLL
+
 // Write data to the IO channel - opened file descriptor, socket or SSL
 // descriptor. Return number of bytes written.
 static int64_t push(FILE *fp, SOCKET sock, SSL *ssl, const char *buf,
diff -uNr  src/osd/sdl/sdl.mak.org src/osd/sdl/sdl.mak
--- src/osd/sdl/sdl.mak.org	2013-09-09 06:10:08.000000000 +0900
+++ src/osd/sdl/sdl.mak	2013-10-11 22:41:12.000000000 +0900
@@ -635,7 +635,7 @@
 ifeq ($(BASE_TARGETOS),os2)
 
 INCPATH += `sdl-config --cflags`
-LIBS += `sdl-config --libs`
+LIBS += `sdl-config --libs` -lpthread
 
 endif # OS2
 

Re: OS/2 patches for 0150 [Re: KO Myung-Hun] #90963 10/11/13 02:04 PM
Joined: Mar 2001
Posts: 16,377
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,377
Thanks! Patch looks good, I'll apply it soon.


Moderated by  R. Belmont 

Who's Online Now
2 registered members (Alegend45, AJR), 73 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,713
Posts114,520
Members4,869
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3