Page MenuHomeFreeBSD

truss(1): add AIO syscalls
ClosedPublic

Authored by tmunro on Dec 8 2020, 11:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 1:51 AM
Unknown Object (File)
Tue, Apr 30, 7:02 AM
Unknown Object (File)
Tue, Apr 30, 7:02 AM
Unknown Object (File)
Feb 20 2024, 1:12 PM
Unknown Object (File)
Feb 8 2024, 7:29 PM
Unknown Object (File)
Feb 8 2024, 7:29 PM
Unknown Object (File)
Dec 20 2023, 7:17 AM
Unknown Object (File)
Nov 23 2023, 4:17 PM

Details

Summary

Display the arguments of aio_read(2), aio_write(2), aio_suspend(2), aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2), aio_waitcomplete(2) and lio_listio(2) in human-readable form.

Test Plan

Trace simple test programs. Example output:

aio_read({ 3,0,0x7fffffffc5f0,1,LIO_NOP,{ sigev_notify=SIGEV_NONE } }) = 0 (0x0)
aio_waitcomplete({ 3,0,0x7fffffffc5f0,1,LIO_NOP,{ sigev_notify=SIGEV_NONE } },{ 1.000000000 }) = 1 (0x1)
lio_listio(LIO_NOWAIT,[{ 3,0,0x7fffffffc5f0,1,LIO_READ,{ sigev_notify=SIGEV_NONE } },{ 3,0,0x7fffffffc5f0,1,LIO_WRITE,{ sigev_notify=SIGEV_NONE } }],2,0x0) = 0 (0x0)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This looks like a good change, but I'm not a truss user. I use ktrace instead. With this patch, how does the output of truss compare to ktrace? And could you also please add aio_mlock?

tmunro edited the summary of this revision. (Show Details)

Added aio_mlock(2).

This looks like a good change, but I'm not a truss user. I use ktrace instead. With this patch, how does the output of truss compare to ktrace?

I'm not too familiar with ktrace, but kdump doesn't seem to show the contents of the aiocb structs/arrays, just pointers; with -r it shows some other structs as STRU records but not these ones, perhaps some ktrstruct() calls might need to be sprinkled in vfs_aio.c?

96425 a.out    CALL  lio_listio(LIO_NOWAIT,0x7fffffffb0d0,0x2,0)
96425 a.out    RET   lio_listio 0
asomers requested changes to this revision.Dec 9 2020, 2:22 AM
asomers added inline comments.
usr.bin/truss/syscalls.c
1384 ↗(On Diff #80467)

Probably not very useful to print sigev_notify_function if it's just a pointer, don't you think?

2732 ↗(On Diff #80467)

This limit is obsolete. I removed it in r324941 (but now I see that I neglected to update the man page accordingly). You should either malloc cbs so there won't be a limit, or else impose some reasonable limit based on the text format of the output, or something like that.

This revision now requires changes to proceed.Dec 9 2020, 2:22 AM

Dropped the SIGEV_THREAD function pointer. Switched to a hardcoded limit on how many lio_listio array elements to display, following a coding pattern from nearby similar things.

Thanks for doing this. It looks like it could be pretty helpful. Helpful enough that I may need to learn to start using truss.

This revision is now accepted and ready to land.Dec 9 2020, 4:44 AM
This revision was automatically updated to reflect the committed changes.

Thanks for doing this. It looks like it could be pretty helpful. Helpful enough that I may need to learn to start using truss.

Thanks for the review! I've found this useful for debugging a complicated AIO-based app.