diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-11-01 14:26:15 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-11-01 14:26:15 +0100 |
commit | 8e1e2856f2523c225a81840059e93fa9f61fbacf (patch) | |
tree | f1c708faf5aaeb27f255531d8c0f9dac32833b5b /mysys | |
parent | b0ff791618d97487fb7515d3f785b37f46eba132 (diff) | |
parent | 80c951ce2875aac521b82323b5b6ebf638593445 (diff) | |
download | mariadb-git-8e1e2856f2523c225a81840059e93fa9f61fbacf.tar.gz |
Merge branch '10.4' into 10.5
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_addr_resolve.c | 26 | ||||
-rw-r--r-- | mysys/my_error.c | 3 |
2 files changed, 18 insertions, 11 deletions
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index 8cfeff1d6f0..bf2c89a9463 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -159,10 +159,18 @@ err: #include <ctype.h> #include <sys/wait.h> +#if defined(HAVE_POLL_H) +#include <poll.h> +#elif defined(HAVE_SYS_POLL_H) +#include <sys/poll.h> +#endif /* defined(HAVE_POLL_H) */ + static int in[2], out[2]; static pid_t pid; static char addr2line_binary[1024]; static char output[1024]; +static struct pollfd poll_fds; +Dl_info info; int start_addr2line_fork(const char *binary_path) { @@ -214,12 +222,14 @@ static int addr_resolve(void *ptr, my_addr_loc *loc) ssize_t extra_bytes_read = 0; ssize_t parsed = 0; - fd_set set; - struct timeval timeout; + int ret; int filename_start = -1; int line_number_start = -1; + poll_fds.fd = out[0]; + poll_fds.events = POLLIN | POLLRDBAND; + len= my_snprintf(input, sizeof(input), "%p\n", ptr); if (write(in[1], input, len) <= 0) { @@ -228,16 +238,16 @@ static int addr_resolve(void *ptr, my_addr_loc *loc) return 3; } - FD_ZERO(&set); - FD_SET(out[0], &set); - /* 100 ms should be plenty of time for addr2line to issue a response. */ - timeout.tv_sec = 0; - timeout.tv_usec = 100000; + /* 500 ms should be plenty of time for addr2line to issue a response. */ /* Read in a loop till all the output from addr2line is complete. */ while (parsed == total_bytes_read && - select(out[0] + 1, &set, NULL, NULL, &timeout) > 0) + (ret= poll(&poll_fds, 1, 500))) { + /* error during poll */ + if (ret < 0) + return 1; + extra_bytes_read= read(out[0], output + total_bytes_read, sizeof(output) - total_bytes_read); if (extra_bytes_read < 0) diff --git a/mysys/my_error.c b/mysys/my_error.c index ad602c90f27..106e51de581 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -112,9 +112,6 @@ void my_error(uint nr, myf MyFlags, ...) char ebuff[ERRMSGSIZE]; DBUG_ENTER("my_error"); DBUG_PRINT("my", ("nr: %d MyFlags: %lu errno: %d", nr, MyFlags, errno)); - - DBUG_ASSERT(errno != 1213); - if (!(format = my_get_err_msg(nr))) (void) my_snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr); else |