зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6533f070ba
Коммит
1a70dfe6f4
17
ChangeLog
17
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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
6
io.c
6
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче