strace: fix revents output for poll syscall
each poll_fd struct should be checked, valid when not -1 and revents not zero. Change-Id: Ia624ad1369ad1a6066c9970a47cfac63fa773702 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4821 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
3285dcae22
commit
101dc0ba83
@@ -134,11 +134,7 @@ format_signed_number(int32 value)
|
|||||||
static string
|
static string
|
||||||
read_pollfd(Context &context, void *data)
|
read_pollfd(Context &context, void *data)
|
||||||
{
|
{
|
||||||
nfds_t numfds = 0;
|
nfds_t numfds = get_value<nfds_t>(context.GetValue(context.GetSibling(1)));
|
||||||
if (context.GetContents(Context::INPUT_VALUES))
|
|
||||||
numfds = get_value<nfds_t>(context.GetValue(context.GetSibling(1)));
|
|
||||||
else if (context.GetContents(Context::OUTPUT_VALUES))
|
|
||||||
numfds = context.GetReturnValue();
|
|
||||||
if ((int64)numfds <= 0)
|
if ((int64)numfds <= 0)
|
||||||
return string();
|
return string();
|
||||||
|
|
||||||
@@ -157,6 +153,10 @@ read_pollfd(Context &context, void *data)
|
|||||||
r = "[";
|
r = "[";
|
||||||
|
|
||||||
for (nfds_t i = 0; i < numfds && added < 8; i++) {
|
for (nfds_t i = 0; i < numfds && added < 8; i++) {
|
||||||
|
if ((tmp[i].fd == -1 || tmp[i].revents == 0)
|
||||||
|
&& context.GetContents(Context::OUTPUT_VALUES)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (added > 0)
|
if (added > 0)
|
||||||
r += ", ";
|
r += ", ";
|
||||||
r += "{fd=" + format_signed_number(tmp[i].fd);
|
r += "{fd=" + format_signed_number(tmp[i].fd);
|
||||||
@@ -176,7 +176,7 @@ read_pollfd(Context &context, void *data)
|
|||||||
flags++;
|
flags++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmp[i].fd != -1 && context.GetContents(Context::OUTPUT_VALUES)) {
|
if (context.GetContents(Context::OUTPUT_VALUES)) {
|
||||||
r += ", revents=";
|
r += ", revents=";
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if ((tmp[i].revents & POLLIN) != 0) {
|
if ((tmp[i].revents & POLLIN) != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user