1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-09-06 15:27:25 +00:00
parent 642e7c516d
commit 5bed80ee36

View file

@ -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);
}
}