[prev in list] [next in list] [prev in thread] [next in thread]
List: strace
Subject: Re: [PATCH v4 2/5] drm: Add private data field to trace control block
From: Mike Frysinger <vapier () gentoo ! org>
Date: 2015-08-25 21:12:23
Message-ID: 20150825211223.GD12316 () vapier
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On 24 Aug 2015 14:42, Patrik Jakobsson wrote:
> We need to be able to store private data in the tcb across it's
> lifetime. To ensure proper destruction of the data a free_priv_data
> callback must be provided if an allocation is stored in priv_data. The
> callback is executed automatically when the life of the tcb ends.
>
> * defs.h: Add extern declaration of free_tcb_priv_data.
> (struct tcb): Add priv_data and free_priv_data.
> * strace.c (free_tcb_priv_data): New function
> (drop_tcb): Execute free_tcb_priv_data callback
> * syscall.c (trace_syscall_exiting): Execute free_tcb_priv_data callback
>
> Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
> ---
> defs.h | 6 ++++++
> strace.c | 14 ++++++++++++++
> syscall.c | 1 +
> 3 files changed, 21 insertions(+)
>
> diff --git a/defs.h b/defs.h
> index 9059026..bc3bd83 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -266,6 +266,10 @@ struct tcb {
> int u_error; /* Error code */
> long scno; /* System call number */
> long u_arg[MAX_ARGS]; /* System call arguments */
> +
> + void *priv_data; /* Private data for syscall decoding functions */
> + void (*free_priv_data)(void *); /* Callback for freeing priv_data */
should we name these _priv_data and _free_priv_data and provides accessor
functions ? i worry that code paths might stomp on each other by accident
and we don't end up noticing.
static void set_tcb_priv_data(struct tcb *tcp, void *data, void (*free_data)(void *))
{
assert(tcp->_priv_data == NULL && tcp->_free_priv_data == NULL);
...
}
-mike
["signature.asc" (application/pgp-signature)]
------------------------------------------------------------------------------
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic