summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-11 11:08:17 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-11 11:08:17 +0000
commitf69091fabc37019f495bda40707a7aa7c3c7cf6d (patch)
tree71eff46920bc71dfa8037aa7cb08cbd338d457e2 /io.c
parent52486197bc9e9df20752ea5630a72254b8ad8c94 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c24
1 files changed, 18 insertions, 6 deletions
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) {