diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-09-20 15:34:11 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-10-09 14:08:31 +0200 |
commit | 7b42076a77b81e205ecc704c3bb7538716567487 (patch) | |
tree | f1158e4ea14177f01ebf55355aa995257c7b79c8 /src/afb-trace.c | |
parent | 9ece61d2cbda88878b9f1e6a6e62d3d42cbdef00 (diff) |
Atomic context initialisation for bindings
Change-Id: I3e81b64d57c917da1fba9b3a9387d0f4d7f3e6b7
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-trace.c')
-rw-r--r-- | src/afb-trace.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/afb-trace.c b/src/afb-trace.c index e4134103..5e82274a 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -221,6 +221,7 @@ static struct flag xreq_flags[] = { /* must be sorted by names */ { "common", afb_hook_flags_req_common }, { "context", afb_hook_flags_req_context }, { "context_get", afb_hook_flag_req_context_get }, + { "context_make", afb_hook_flag_req_context_make }, { "context_set", afb_hook_flag_req_context_set }, { "end", afb_hook_flag_req_end }, { "event", afb_hook_flags_req_event }, @@ -472,6 +473,21 @@ static void hook_xreq_get_application_id(void *closure, const struct afb_hookid "result", result); } +static void hook_xreq_context_make(void *closure, const struct afb_hookid *hookid, const struct afb_xreq *xreq, int replace, void *(*create_value)(void*), void (*free_value)(void*), void *create_closure, void *result) +{ + char pc[50], pf[50], pv[50], pr[50]; + snprintf(pc, sizeof pc, "%p", create_value); + snprintf(pf, sizeof pf, "%p", free_value); + snprintf(pv, sizeof pv, "%p", create_closure); + snprintf(pr, sizeof pr, "%p", result); + hook_xreq(closure, hookid, xreq, "context_make", "{sb ss ss ss ss}", + "replace", replace, + "create", pc, + "free", pf, + "closure", pv, + "result", pr); +} + static struct afb_hook_xreq_itf hook_xreq_itf = { .hook_xreq_begin = hook_xreq_begin, .hook_xreq_end = hook_xreq_end, @@ -497,7 +513,8 @@ static struct afb_hook_xreq_itf hook_xreq_itf = { .hook_xreq_subcall_req = hook_xreq_subcall_req, .hook_xreq_subcall_req_result = hook_xreq_subcall_req_result, .hook_xreq_has_permission = hook_xreq_has_permission, - .hook_xreq_get_application_id = hook_xreq_get_application_id + .hook_xreq_get_application_id = hook_xreq_get_application_id, + .hook_xreq_context_make = hook_xreq_context_make }; /*******************************************************************************/ |