aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-06 15:27:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-06 15:27:25 +0000
commit40a0e7752935d02c803f1c2efb97322f59aa0433 (patch)
tree5030cb219b23206405ce11b45dddc8fda26b8b3f /thread_pthread.c
parent44ebdc8afdec3159e06110f4901312a26a565166 (diff)
downloadruby-40a0e7752935d02c803f1c2efb97322f59aa0433.tar.gz
thread_pthread.c: async_bug_fd
* thread_pthread.c (async_bug_fd): show failed file descriptor too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index fb76020cc9..9c571c913d 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1285,6 +1285,18 @@ static struct {
{-1, -1}, /* low priority */
};
+NORETURN(static void async_bug_fd(const char *mesg, int errno_arg, int fd));
+static void
+async_bug_fd(const char *mesg, int errno_arg, int fd)
+{
+ char buff[64];
+ size_t n = strlcpy(buff, mesg, sizeof(buff));
+ if (n < sizeof(buff)-3) {
+ ruby_snprintf(buff, sizeof(buff)-n, "(%d)", fd);
+ }
+ rb_async_bug_errno(buff, errno_arg);
+}
+
/* only use signal-safe system calls here */
static void
rb_thread_wakeup_timer_thread_fd(volatile int *fdp)
@@ -1306,7 +1318,7 @@ rb_thread_wakeup_timer_thread_fd(volatile int *fdp)
#endif
break;
default:
- rb_async_bug_errno("rb_thread_wakeup_timer_thread - write", e);
+ async_bug_fd("rb_thread_wakeup_timer_thread: write", e, fd);
}
}
if (TT_DEBUG) WRITE_CONST(2, "rb_thread_wakeup_timer_thread: write\n");
@@ -1358,7 +1370,7 @@ consume_communication_pipe(int fd)
#endif
return;
default:
- rb_async_bug_errno("consume_communication_pipe: read", e);
+ async_bug_fd("consume_communication_pipe: read", e, fd);
}
}
}
@@ -1373,7 +1385,7 @@ close_invalidate(volatile int *fdp, const char *msg)
*fdp = -1;
if (close(fd) < 0) {
- rb_async_bug_errno(msg, errno);
+ async_bug_fd(msg, errno, fd);
}
}