Page MenuHomeFreeBSD

kdump: decode pollfd struct arrays coming from poll(2)
ClosedPublic

Authored by kevans on Feb 29 2024, 4:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 1:40 AM
Unknown Object (File)
Wed, Nov 13, 8:23 PM
Unknown Object (File)
Tue, Nov 12, 7:57 AM
Unknown Object (File)
Mon, Nov 11, 10:57 PM
Unknown Object (File)
Mon, Nov 11, 10:50 PM
Unknown Object (File)
Mon, Nov 11, 9:37 PM
Unknown Object (File)
Mar 5 2024, 6:39 AM
Unknown Object (File)
Mar 4 2024, 6:47 PM
Subscribers

Details

Summary

We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.

Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:

CALL poll(0x820610560,0x3,0)
STRU struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
{ fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
{ fd=-1, events=0x4<POLLOUT>, revents=0} }
RET poll 2

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I love it, thank you!

This revision is now accepted and ready to land.Feb 29 2024, 4:51 PM

Next you might consider adding this to truss as well. :)

In D44160#1008533, @jhb wrote:

Next you might consider adding this to truss as well. :)

I'm actually not sure what this would look like for truss... it does some decoding of events already, just not returned events:

820 100189: poll({ 0/POLLIN 1/POLLOUT -1/POLLOUT 1/POLLHUP },4,0) = 1 (0x1)

It's a little more obvious with kqueue since the results are returned in a separate parameter, so that gives a natural representation... the best I can come up with off the top of my head is maybe something like:

820 100189: poll({ 0/{POLLIN -> 0} 1/{POLLOUT -> POLLOUT} -1/{POLLOUT -> 0} 1/{POLLHUP -> 0} },4,0) = 1 (0x1)

but I'm afraid that might get a little convoluted

Oh, that probably won't work... we probably printed the entire left-hand side before the return, so it'd need to be on a separate line or something