[#4858] Build fails on OSX Tiger 10.4 — noreply@...

Bugs item #1883, was opened at 2005-05-06 14:55

21 messages 2005/05/06
[#4862] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Yukihiro Matsumoto <matz@...> 2005/05/07

Hi,

[#4865] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Ryan Davis <ryand-ruby@...> 2005/05/07

[#4868] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — nobu.nokada@... 2005/05/07

Hi,

[#5053] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Shugo Maeda <shugo@...> 2005/05/19

Hi,

[#5056] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Mark Hubbart <discordantus@...> 2005/05/19

On 5/19/05, Shugo Maeda <shugo@ruby-lang.org> wrote:

[#4874] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...>

Hello all,

31 messages 2005/05/10
[#4879] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Pit Capitain <pit@...> 2005/05/11

Ilias Lazaridis schrieb:

[#4883] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

Pit Capitain wrote:

[#4884] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ryan Davis <ryand-ruby@...> 2005/05/12

[#4888] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

Ryan Davis wrote:

[#4889] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — ES <ruby-ml@...> 2005/05/12

[#4890] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

ES wrote:

[#4891] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Alexander Kellett <ruby-lists@...> 2005/05/12

On May 12, 2005, at 3:13 PM, Ilias Lazaridis wrote:

[#4911] Pointless argc check in Array#select — noreply@...

Patches item #1900, was opened at 2005-05-12 09:33

11 messages 2005/05/12

[#4919] - Hierarchical/Modular Directory Structure — Ilias Lazaridis <ilias@...>

The source-code structure should be simplified, lowering barriers for

20 messages 2005/05/12

Re: shim for select() for VMS & general porting questions

From: nobuyoshi nakada <nobuyoshi.nakada@...>
Date: 2005-05-26 09:26:49 UTC
List: ruby-core #5102
Hi,

At Thu, 26 May 2005 08:47:11 +0900,
nobu.nokada@softhome.net wrote in [ruby-core:05101]:
> > I'm also uncertain where this stuff all properly belongs.  There is a
> > vms/vmsruby_private.c for which I see no equivalent file in other ports.
> > There are no comments explaining what the file is for, so it is not
> > clear what the author's intent was in designating these as "private".
> 
> I did see just CVS trunk, not 1.8 branch.  Those apparently
> haven't been committed to the trunk yet, irregularly.  I added
> them to the trunk now.

Moved all to vmsruby_private.[ch].  Does this work?


Index: vms/config.h
===================================================================
RCS file: /cvs/ruby/src/ruby/vms/config.h,v
retrieving revision 1.2
diff -U2 -p -r1.2 config.h
--- vms/config.h	14 May 2005 14:57:03 -0000	1.2
+++ vms/config.h	26 May 2005 03:34:52 -0000
@@ -112,4 +112,5 @@
 #define SIZEOF_FLOAT 4
 #define SIZEOF_DOUBLE 8
+#define SIZEOF_LONG_LONG 8
 
 #if defined(__vax)
Index: vms/vms.h
===================================================================
RCS file: /cvs/ruby/src/ruby/vms/vms.h,v
retrieving revision 1.3
diff -U2 -p -r1.3 vms.h
--- vms/vms.h	26 Dec 2003 01:38:31 -0000	1.3
+++ vms/vms.h	26 May 2005 09:13:07 -0000
@@ -11,3 +11,2 @@ extern int snprintf();
 
 #define LONG_LONG long long
-#define SIZEOF_LONG_LONG sizeof(long long)
Index: vms/vmsruby_private.c
===================================================================
RCS file: /cvs/ruby/src/ruby/vms/vmsruby_private.c,v
retrieving revision 1.2
diff -U2 -p -r1.2 vmsruby_private.c
--- vms/vmsruby_private.c	25 May 2005 23:35:25 -0000	1.2
+++ vms/vmsruby_private.c	26 May 2005 09:13:41 -0000
@@ -1,5 +1,8 @@
-#include "vmsruby_private.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>.
+#include <socket.h>
+#include <errno.h>
+#include "vmsruby_private.h"
 
 void _vmsruby_init(void)
@@ -51,2 +54,87 @@ long _vmsruby_set_switch(char *name, cha
     return status;
 }
+
+static int
+is_socket(int fd)
+{
+    int type, len;
+
+    len = sizeof(type);
+    if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&type, &len) == 0)
+	return 1;
+    if (errno == ENOTSOCK) errno = 0;
+
+    return 0;
+}
+
+#undef select
+int
+rb_vms_select(int maxfd, fd_set *rfd, fd_set *wfd, fd_set *efd, struct timeval *tv)
+{
+    int i, maxsock, socks, nsocks, ret;
+    fd_set rs, ws, es, *rp, *wp, *ep;
+    struct timeval z;
+
+    FD_ZERO(&rs);
+    FD_ZERO(&ws);
+    FD_ZERO(&es);
+
+    /* count socket and non-socket fds */
+    maxsock = socks = nsocks = 0;
+    if (rfd || wfd || efd) {
+	for (i = 0; i < maxfd; ++i) {
+	    int r = (rfd != 0) && FD_ISSET(i, rfd);
+	    int w = (wfd != 0) && FD_ISSET(i, wfd);
+	    int e = (efd != 0) && FD_ISSET(i, efd);
+	    if (!r && !w && !e) continue;
+	    if (is_socket(i)) {
+		if (r) FD_SET(i, (rp = &rs));
+		if (w) FD_SET(i, (wp = &ws));
+		if (e) FD_SET(i, (ep = &es));
+		maxsock = i + 1;
+		socks++;
+	    }
+	    else {
+		nsocks++;
+	    }
+	}
+    }
+
+    if (!nsocks) {
+	/* sockets only */
+	return select(maxsock, rfd, wfd, efd, tv);
+    }
+
+    if (!socks) {
+	/* assuming non-socket fds are always ready */
+	return nsocks;
+    }
+
+    /* check if sockets are ready */
+    z.tv_sec = 0;
+    z.tv_usec = 0;
+    ret = select(maxsock, rp, wp, ep, &z);
+    if (ret < 0) {
+	if (rfd) *rfd = rs;
+	if (wfd) *wfd = ws;
+	if (efd) *efd = es;
+	return nsocks;
+    }
+
+    for (i = 0; i < maxsock; ++i) {
+	if (rp && FD_ISSET(i, rp)) {
+	    FD_SET(i, rfd);
+	    ret++;
+	}
+	if (wp && FD_ISSET(i, wp)) {
+	    FD_SET(i, wfd);
+	    ret++;
+	}
+	if (ep && FD_ISSET(i, ep)) {
+	    FD_SET(i, efd);
+	    ret++;
+	}
+    }
+
+    return ret;
+}
Index: vms/vmsruby_private.h
===================================================================
RCS file: /cvs/ruby/src/ruby/vms/vmsruby_private.h,v
retrieving revision 1.2
diff -U2 -p -r1.2 vmsruby_private.h
--- vms/vmsruby_private.h	25 May 2005 23:35:25 -0000	1.2
+++ vms/vmsruby_private.h	26 May 2005 09:12:36 -0000
@@ -5,3 +5,6 @@ void _vmsruby_init(void);
 long _vmsruby_set_switch(char *, char *);
 
+int rb_vms_select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
+#define select(n, r, w, e, t) rb_vms_select(n, r, w, e, t)
+
 #endif /* VMSRUBY_H_INCLUDED */


-- 
Nobu Nakada

In This Thread

Prev Next