[#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: select() on non-sockets in eval.c

From: BG - Ben Armstrong <BArmstrong@...>
Date: 2005-05-30 13:01:03 UTC
List: ruby-core #5124
Nobu,

I fixed up your patch a bit, so now it works:

static int
is_socket(int fd)
{
    int type;
    size_t 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, ret, socks, nsocks;
    fd_set rs, ws, es, *rp = 0, *wp = 0, *ep = 0;
    struct timeval z;

    FD_ZERO(&rs);
    FD_ZERO(&ws);
    FD_ZERO(&es);

    /* count socket and non-socket fds, and move socket bits to local
     * fd_sets */
    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));
		    FD_CLR(i, rfd);
		}
		if (w) {
		    FD_SET(i, (wp = &ws));
		    FD_CLR(i, wfd);
		}
		if (e) {
		    FD_SET(i, (ep = &es));
		    FD_CLR(i, efd);
		}
		maxsock = i + 1;
		socks++;
	    }
	    else {
		nsocks += r + w + e;
	    }
	}
    }

    if (!nsocks) {
	/* sockets only */
        ret = select(maxsock, rp, wp, ep, tv);
        if (rfd) *rfd = rs;
        if (wfd) *wfd = ws;
        if (efd) *efd = es;
	return ret;
    }

    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) {
	return nsocks;
    }

    /* copy set bits back */
    for (i = 0; i < maxsock; ++i) {
	if (rp && FD_ISSET(i, rp)) FD_SET(i, rfd);
	if (wp && FD_ISSET(i, wp)) FD_SET(i, wfd);
	if (ep && FD_ISSET(i, ep)) FD_SET(i, efd);
    }
    ret += nsocks;

    return ret;
} 

In This Thread

Prev Next