From 5b2eef31aa2f783a3f6e4418e4879cd8fb42bcc7 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 18 Sep 2005 18:22:44 +0000 Subject: * file.c (rb_thread_flock): wrap the flock system call by TRAP_BEG/TRAP_END to enable signals. [ruby-dev:27122] * ext/socket/socket.c (bsock_send): wrap the sendto and send system call by TRAP_BEG/TRAP_END to enable signals when writing to a socket which is full. [ruby-dev:27132] * io.c (rb_io_syswrite): wrap the write system call by TRAP_BEG/TRAP_END to enable signals when writing to a pipe which is full. [ruby-dev:27134] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++++++ ext/socket/socket.c | 4 ++++ file.c | 6 +++++- io.c | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24fcb929c6..f30396b06d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Mon Sep 19 03:17:48 2005 Tanaka Akira + + * file.c (rb_thread_flock): wrap the flock system call by + TRAP_BEG/TRAP_END to enable signals. [ruby-dev:27122] + + * ext/socket/socket.c (bsock_send): wrap the sendto and send system + call by TRAP_BEG/TRAP_END to enable signals when writing to a socket + which is full. [ruby-dev:27132] + + * io.c (rb_io_syswrite): wrap the write system call by + TRAP_BEG/TRAP_END to enable signals when writing to a pipe which is + full. [ruby-dev:27134] + Mon Sep 19 03:02:08 2005 Tanaka Akira * io.c (io_fwrite): wrap the write system call by TRAP_BEG/TRAP_END to diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 91aa53c163..09326ce16f 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -499,11 +499,15 @@ bsock_send(argc, argv, sock) rb_thread_fd_writable(fd); retry: if (!NIL_P(to)) { + TRAP_BEG; n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags), (struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len); + TRAP_END; } else { + TRAP_BEG; n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags)); + TRAP_END; } if (n < 0) { if (rb_io_wait_writable(fd)) { diff --git a/file.c b/file.c index 818d8087be..0f35ec0743 100644 --- a/file.c +++ b/file.c @@ -2915,7 +2915,11 @@ rb_thread_flock(fd, op, fptr) OpenFile *fptr; { if (rb_thread_alone() || (op & LOCK_NB)) { - return flock(fd, op); + int ret; + TRAP_BEG; + ret = flock(fd, op); + TRAP_END; + return ret; } op |= LOCK_NB; while (flock(fd, op) < 0) { diff --git a/io.c b/io.c index 78333d1d22..2c2fa80f15 100644 --- a/io.c +++ b/io.c @@ -2331,7 +2331,9 @@ rb_io_syswrite(io, str) if (!rb_thread_fd_writable(fileno(f))) { rb_io_check_closed(fptr); } + TRAP_BEG; n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len); + TRAP_END; if (n == -1) rb_sys_fail(fptr->path); -- cgit v1.2.3