[PATCH v3 1/1] syscall.c: split trace_syscall() into 6 functions

Dmitry V. Levin ldv at altlinux.org
Mon Jun 5 15:14:49 UTC 2017


On Mon, Jun 05, 2017 at 04:53:59PM +0300, Victor Krapivensky wrote:
> This change removes the trace_syscall function. Now, the code that uses
> syscall.c trace functions is expected to check whether it is a syscall
> entry or exit (with entering(tcp)/exiting(tcp)) itself, and then make an
> appropriate sequence of function calls.
> 
> * defs.h: Change comment on TCB_INSYSCALL, remove the prototype of
> trace_syscall, add prototypes for the new functions.
> * strace.c (trace_syscall): A static replacement for old trace_syscall.
> * syscall.c (trace_syscall): Remove.
> (trace_syscall_entering): Split into...
> (syscall_entering_decode, syscall_entering_trace,
> syscall_entering_finish): ...new functions.
> (trace_syscall_exiting): Split into...
> (syscall_exiting_decode, syscall_exiting_trace,
> syscall_exiting_finish): ...new functions.

This is more symmetric, I like it. :)

> --- a/defs.h
> +++ b/defs.h
> @@ -249,15 +249,9 @@ struct tcb {
>  /*
>   * Are we in system call entry or in syscall exit?
>   *
> - * This bit is set after all syscall entry processing is done.
> - * Therefore, this bit will be set when next ptrace stop occurs,
> - * which should be syscall exit stop. Other stops which are possible
> - * directly after syscall entry (death, ptrace event stop)
> - * are simpler and handled without calling trace_syscall(), therefore
> - * the places where TCB_INSYSCALL can be set but we aren't in syscall stop
> - * are limited to trace(), this condition is never observed in trace_syscall()
> - * and below.
> - * The bit is cleared after all syscall exit processing is done.
> + * This bit is set in syscall_entering_finish() and cleared in syscall_exiting_trace().
> + * Other stops which are possible directly after syscall entry (death, ptrace
> + * event stop) are handled without calling syscall_{entering,exiting}_*().

Your comments tend to be longer than 80 symbols, please wrap them.

Note that in this edition of the patch TCB_INSYSCALL is cleared in
syscall_exiting_finish, not in syscall_exiting_trace.  Please ensure
that other related comments are up to date with this change.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170605/ea2e4ed4/attachment.bin>


More information about the Strace-devel mailing list