This was mentioned in #41, but breaking it out here. This is not urgent, but I'd like to discuss the API / get suggested improvements.
Let's suppose the user only wants to override a couple syscalls, {read,write}. Rather than building their own switch statement inside captured_syscall, and having an essentially untyped argument list, wouldn't it be better if they instead created a trait impl and defined only the read/write we're interested in? Further, we would use more strongly typed signatures when doing so.
The idea is that trait-provided methods would provide defaults, including the big fat captured_syscall definition which would have a giant switch statement dispatching to all the specific methods of the trait.
Then, to define our own instrumentation tool that intercepts just read/write, we would have to impl the above trait and replace only those default read/write methods of interest.
This was mentioned in #41, but breaking it out here. This is not urgent, but I'd like to discuss the API / get suggested improvements.
Let's suppose the user only wants to override a couple syscalls,
{read,write}
. Rather than building their own switch statement insidecaptured_syscall
, and having an essentially untyped argument list, wouldn't it be better if they instead created a trait impl and defined only the read/write we're interested in? Further, we would use more strongly typed signatures when doing so.The idea is that trait-provided methods would provide defaults, including the big fat
captured_syscall
definition which would have a giant switch statement dispatching to all the specific methods of the trait.Then, to define our own instrumentation tool that intercepts just read/write, we would have to
impl
the above trait and replace only those default read/write methods of interest.(Ideally, we would also configure the instrumentation at initialization so that it never traps on the other events we're not interested in anyway.)
To wire things up, we'd need to compile a cdylib that export
captured_syscall
as usual, but directly calls the genericg_cap_syscall
above.