From f69091fabc37019f495bda40707a7aa7c3c7cf6d Mon Sep 17 00:00:00 2001 From: ocean Date: Fri, 11 Nov 2005 11:08:17 +0000 Subject: [PATCH] * eval.c, intern.h: failed to compile where NFDBITS is defined but howmany() is not defined. [ruby-dev:27680] * io.c (is_socket): failed to compile where S_ISSOCK is not defined. * io.c (pipe_open): failed to compile where socketpair is not supported. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ eval.c | 2 +- intern.h | 2 +- io.c | 24 ++++++++++++++++++------ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e267e6dc0e..37e36f2248 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri Nov 11 19:53:47 2005 Hirokazu Yamamoto + + * eval.c, intern.h: failed to compile where NFDBITS is defined but + howmany() is not defined. [ruby-dev:27680] + + * io.c (is_socket): failed to compile where S_ISSOCK is not defined. + + * io.c (pipe_open): failed to compile where socketpair is not supported. + Fri Nov 11 08:20:56 2005 Nobuyoshi Nakada * Makefile.in (OUTFLAG): keep trailing spaces. [ruby-dev:27666] diff --git a/eval.c b/eval.c index b98746e517..fd7a209aff 100644 --- a/eval.c +++ b/eval.c @@ -9546,7 +9546,7 @@ enum thread_status { # endif #endif -#ifdef NFDBITS +#if defined(NFDBITS) && defined(howmany) void rb_fd_init(fds) volatile rb_fdset_t *fds; diff --git a/intern.h b/intern.h index 7c33d7c225..31602598f6 100644 --- a/intern.h +++ b/intern.h @@ -161,7 +161,7 @@ NORETURN(void rb_load_fail(const char*)); NORETURN(void rb_error_frozen(const char*)); void rb_check_frozen(VALUE); /* eval.c */ -#ifdef NFDBITS +#if defined(NFDBITS) && defined(howmany) typedef struct { int maxfd; fd_set *fdset; diff --git a/io.c b/io.c index addebc3607..f8395f144e 100644 --- a/io.c +++ b/io.c @@ -166,16 +166,28 @@ static VALUE lineno = INT2FIX(0); }\ } while(0) +#ifndef S_ISSOCK +# ifdef _S_ISSOCK +# define S_ISSOCK(m) _S_ISSOCK(m) +# else +# ifdef _S_IFSOCK +# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK) +# else +# ifdef S_IFSOCK +# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK) +# endif +# endif +# endif +#endif + #if defined(_WIN32) #define is_socket(fd, path) rb_w32_is_socket(fd) -#elif defined(__DJGPP__) +#elif !defined(S_ISSOCK) #define is_socket(fd, path) 0 #define shutdown(a,b) 0 #else static int -is_socket(fd, path) - int fd; - const char *path; +is_socket(int fd, const char *path) { struct stat sbuf; if (fstat(fd, &sbuf) < 0) @@ -2817,7 +2829,7 @@ pipe_open(int argc, VALUE *argv, char *mode) int pid = 0; OpenFile *fptr; VALUE port, prog; -#if defined(HAVE_FORK) +#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR) int status; struct popen_arg arg; volatile int doexec; @@ -2835,7 +2847,7 @@ pipe_open(int argc, VALUE *argv, char *mode) prog = argv[0]; } -#if defined(HAVE_FORK) +#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR) cmd = StringValueCStr(prog); doexec = (strcmp("-", cmd) != 0); if (!doexec) {