summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--ext/pty/pty.c12
-rw-r--r--ext/socket/ancdata.c4
-rw-r--r--ext/socket/init.c6
-rw-r--r--ext/socket/socket.c4
-rw-r--r--ext/socket/unixsocket.c2
-rw-r--r--include/ruby/intern.h2
-rw-r--r--io.c6
8 files changed, 35 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 1895ca1d8ce..bc6d8cfe582 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Mon Oct 31 21:47:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_fd_fix_cloexec): renamed from
+ rb_fd_set_cloexec.
+
+ * io.c: follow the above renaming.
+
+ * ext/pty/pty.c: ditto.
+
+ * ext/socket/init.c: ditto.
+
+ * ext/socket/socket.c: ditto.
+
+ * ext/socket/ancdata.c: ditto.
+
+ * ext/socket/unixsocket.c: ditto.
+
Mon Oct 31 21:02:43 2011 Tanaka Akira <akr@fsij.org>
* lib/resolv.rb (Resolv::DNS): retry IO.select for premature wakeup.
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 98993f7c80d..353e1fa78f1 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -296,7 +296,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
if (grantpt(masterfd) == -1) goto grantpt_error;
- rb_fd_set_cloexec(masterfd);
+ rb_fd_fix_cloexec(masterfd);
#else
flags = O_RDWR|O_NOCTTY;
# ifdef O_CLOEXEC
@@ -306,7 +306,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
flags |= O_CLOEXEC;
# endif
if ((masterfd = posix_openpt(flags)) == -1) goto error;
- rb_fd_set_cloexec(masterfd);
+ rb_fd_fix_cloexec(masterfd);
if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
if (grantpt(masterfd) == -1) goto grantpt_error;
#endif
@@ -347,8 +347,8 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "openpty() failed");
}
- rb_fd_set_cloexec(*master);
- rb_fd_set_cloexec(*slave);
+ rb_fd_fix_cloexec(*master);
+ rb_fd_fix_cloexec(*slave);
if (no_mesg(SlaveName, nomesg) == -1) {
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "can't chmod slave pty");
@@ -365,7 +365,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "_getpty() failed");
}
- rb_fd_set_cloexec(*master);
+ rb_fd_fix_cloexec(*master);
*slave = rb_cloexec_open(name, O_RDWR, 0);
/* error check? */
@@ -387,7 +387,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if((masterfd = open("/dev/ptmx", O_RDWR, 0)) == -1) goto error;
s = signal(SIGCHLD, SIG_DFL);
if(grantpt(masterfd) == -1) goto error;
- rb_fd_set_cloexec(masterfd);
+ rb_fd_fix_cloexec(masterfd);
#else
if((masterfd = rb_cloexec_open("/dev/ptmx", O_RDWR, 0)) == -1) goto error;
rb_update_max_fd(masterfd);
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 848b332181c..6d824ffc993 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1396,7 +1396,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
int *end = (int *)((char *)cmh + cmh->cmsg_len);
while ((char *)fdp + sizeof(int) <= (char *)end &&
(char *)fdp + sizeof(int) <= msg_end) {
- rb_fd_set_cloexec(*fdp);
+ rb_fd_fix_cloexec(*fdp);
close(*fdp);
fdp++;
}
@@ -1439,7 +1439,7 @@ make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
VALUE io;
if (fstat(fd, &stbuf) == -1)
rb_raise(rb_eSocket, "invalid fd in SCM_RIGHTS");
- rb_fd_set_cloexec(fd);
+ rb_fd_fix_cloexec(fd);
if (S_ISSOCK(stbuf.st_mode))
io = rsock_init_sock(rb_obj_alloc(rb_cSocket), fd);
else
diff --git a/ext/socket/init.c b/ext/socket/init.c
index ca271f3b5a5..70c92d74521 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -252,7 +252,7 @@ rsock_socket(int domain, int type, int proto)
}
}
if (0 <= fd)
- rb_fd_set_cloexec(fd);
+ rb_fd_fix_cloexec(fd);
return fd;
}
@@ -466,7 +466,7 @@ rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, s
}
rb_sys_fail("accept(2)");
}
- rb_fd_set_cloexec(fd2);
+ rb_fd_fix_cloexec(fd2);
make_fd_nonblock(fd2);
return rsock_init_sock(rb_obj_alloc(klass), fd2);
}
@@ -513,7 +513,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
}
rb_sys_fail(0);
}
- rb_fd_set_cloexec(fd2);
+ rb_fd_fix_cloexec(fd2);
if (!klass) return INT2NUM(fd2);
return rsock_init_sock(rb_obj_alloc(klass), fd2);
}
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 92407185fc2..767446d8da2 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -119,8 +119,8 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
if (ret < 0) {
rb_sys_fail("socketpair(2)");
}
- rb_fd_set_cloexec(sp[0]);
- rb_fd_set_cloexec(sp[1]);
+ rb_fd_fix_cloexec(sp[0]);
+ rb_fd_fix_cloexec(sp[1]);
s1 = rsock_init_sock(rb_obj_alloc(klass), sp[0]);
s2 = rsock_init_sock(rb_obj_alloc(klass), sp[1]);
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 7f2d6281671..cd4dd7b05f2 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -383,7 +383,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
#if FD_PASSING_BY_MSG_CONTROL
memcpy(&fd, CMSG_DATA(&cmsg.hdr), sizeof(int));
#endif
- rb_fd_set_cloexec(fd);
+ rb_fd_fix_cloexec(fd);
if (klass == Qnil)
return INT2FIX(fd);
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index aa24d435f6a..675694179bf 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -509,7 +509,7 @@ int rb_cloexec_pipe(int fildes[2]);
int rb_cloexec_fcntl_dupfd(int fd, int minfd);
#define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
void rb_update_max_fd(int fd);
-void rb_fd_set_cloexec(int fd);
+void rb_fd_fix_cloexec(int fd);
/* marshal.c */
VALUE rb_marshal_dump(VALUE, VALUE);
VALUE rb_marshal_load(VALUE);
diff --git a/io.c b/io.c
index 83c04eee224..a87af126d86 100644
--- a/io.c
+++ b/io.c
@@ -165,7 +165,7 @@ fd_set_cloexec(int fd)
int flags, flags2, ret;
flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
if (flags == -1) {
- rb_bug("rb_fd_set_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
+ rb_bug("fd_set_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
}
if (fd <= 2)
flags2 = flags & ~FD_CLOEXEC; /* Clear CLOEXEC for standard file descriptors: 0, 1, 2. */
@@ -174,14 +174,14 @@ fd_set_cloexec(int fd)
if (flags != flags2) {
ret = fcntl(fd, F_SETFD, flags2);
if (ret == -1) {
- rb_bug("rb_fd_set_cloexec: fcntl(%d, F_SETFD, %d) failed: %s", fd, flags2, strerror(errno));
+ rb_bug("fd_set_cloexec: fcntl(%d, F_SETFD, %d) failed: %s", fd, flags2, strerror(errno));
}
}
#endif
}
void
-rb_fd_set_cloexec(int fd)
+rb_fd_fix_cloexec(int fd)
{
fd_set_cloexec(fd);
if (max_file_descriptor < fd) max_file_descriptor = fd;