Skip to content

Commit 5b2eef3

Browse files
committed
* 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
1 parent 94636e8 commit 5b2eef3

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Mon Sep 19 03:17:48 2005 Tanaka Akira <akr@m17n.org>
2+
3+
* file.c (rb_thread_flock): wrap the flock system call by
4+
TRAP_BEG/TRAP_END to enable signals. [ruby-dev:27122]
5+
6+
* ext/socket/socket.c (bsock_send): wrap the sendto and send system
7+
call by TRAP_BEG/TRAP_END to enable signals when writing to a socket
8+
which is full. [ruby-dev:27132]
9+
10+
* io.c (rb_io_syswrite): wrap the write system call by
11+
TRAP_BEG/TRAP_END to enable signals when writing to a pipe which is
12+
full. [ruby-dev:27134]
13+
114
Mon Sep 19 03:02:08 2005 Tanaka Akira <akr@m17n.org>
215

316
* io.c (io_fwrite): wrap the write system call by TRAP_BEG/TRAP_END to

ext/socket/socket.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,15 @@ bsock_send(argc, argv, sock)
499499
rb_thread_fd_writable(fd);
500500
retry:
501501
if (!NIL_P(to)) {
502+
TRAP_BEG;
502503
n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags),
503504
(struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len);
505+
TRAP_END;
504506
}
505507
else {
508+
TRAP_BEG;
506509
n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags));
510+
TRAP_END;
507511
}
508512
if (n < 0) {
509513
if (rb_io_wait_writable(fd)) {

file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,11 @@ rb_thread_flock(fd, op, fptr)
29152915
OpenFile *fptr;
29162916
{
29172917
if (rb_thread_alone() || (op & LOCK_NB)) {
2918-
return flock(fd, op);
2918+
int ret;
2919+
TRAP_BEG;
2920+
ret = flock(fd, op);
2921+
TRAP_END;
2922+
return ret;
29192923
}
29202924
op |= LOCK_NB;
29212925
while (flock(fd, op) < 0) {

io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,9 @@ rb_io_syswrite(io, str)
23312331
if (!rb_thread_fd_writable(fileno(f))) {
23322332
rb_io_check_closed(fptr);
23332333
}
2334+
TRAP_BEG;
23342335
n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len);
2336+
TRAP_END;
23352337

23362338
if (n == -1) rb_sys_fail(fptr->path);
23372339

0 commit comments

Comments
 (0)