DEBUG: opentracing: show return values of all functions in the debug output
If the OpenTracing filter is compiled using the 'OT_DEBUG=1' option, then
log messages are printed to stderr when the filter is running. In the log
one can then find (among other things) the order in which the function is
called and the value that the function returns (if it is not a void type).
Prior to applying this patch, no value returned by a function was logged.
Log output example:
[ 1] 0.038807 [OT]: flt_ot_init_per_thread(0x56365bd45ec0, 0x56365bd48210) {
[ 1] 0.038807 [OT]: ot_start(0x56365bd58920, 0x56365bd4e3a0, 0x7f561acba168:(nil)) {
[ 1] 0.038807 [OT]: } = 0
[ 1] 0.038807 [OT]: } = 0
This patch must be backported as far as 2.4.
(cherry picked from commit ca09e01a137ebb557fbda3edb79dd22922753667)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 83eb076c3be8ef2eaa61c3b33f219d1decb575cb)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/addons/ot/src/cli.c b/addons/ot/src/cli.c
index 529c687..f9feeca 100644
--- a/addons/ot/src/cli.c
+++ b/addons/ot/src/cli.c
@@ -97,7 +97,7 @@
cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
#endif /* DEBUG_OT */
@@ -137,7 +137,7 @@
cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -175,7 +175,7 @@
cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -238,7 +238,7 @@
cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -289,7 +289,7 @@
cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -343,7 +343,7 @@
cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
diff --git a/addons/ot/src/conf.c b/addons/ot/src/conf.c
index d07be2c..d575e3a 100644
--- a/addons/ot/src/conf.c
+++ b/addons/ot/src/conf.c
@@ -48,7 +48,7 @@
if (strcmp(ptr->id, id) == 0) {
FLT_OT_ERR("'%s' : already defined", id);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
retptr = FLT_OT_CALLOC(1, size);
@@ -72,7 +72,7 @@
FLT_OT_ERR("out of memory");
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -102,7 +102,7 @@
if (retptr != NULL)
FLT_OT_DBG_CONF_PH("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -162,7 +162,7 @@
if (retptr != NULL)
FLT_OT_DBG_CONF_SAMPLE_EXPR("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -221,13 +221,13 @@
retptr = flt_ot_conf_hdr_init(sizeof(*retptr), args[1], linenum, head, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
flt_ot_args_to_str(args, 2, &(retptr->value));
if (retptr->value == NULL) {
FLT_OT_FREE_CLEAR(retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
retptr->num_exprs = flt_ot_args_count(args) - 2;
@@ -235,7 +235,7 @@
FLT_OT_DBG_CONF_SAMPLE("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -297,7 +297,7 @@
if (retptr != NULL)
FLT_OT_DBG_CONF_STR("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -357,7 +357,7 @@
if (retptr != NULL)
FLT_OT_DBG_CONF_CONTEXT("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -415,7 +415,7 @@
retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
LIST_INIT(&(retptr->tags));
LIST_INIT(&(retptr->logs));
@@ -423,7 +423,7 @@
FLT_OT_DBG_CONF_SPAN("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -486,7 +486,7 @@
retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
LIST_INIT(&(retptr->acls));
LIST_INIT(&(retptr->contexts));
@@ -495,7 +495,7 @@
FLT_OT_DBG_CONF_SCOPE("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
/***
@@ -566,13 +566,13 @@
retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
LIST_INIT(&(retptr->ph_scopes));
FLT_OT_DBG_CONF_GROUP("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -630,7 +630,7 @@
retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, NULL, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr->rate_limit = FLT_OT_FLOAT_U32(FLT_OT_RATE_LIMIT_MAX, FLT_OT_RATE_LIMIT_MAX);
init_new_proxy(&(retptr->proxy_log));
@@ -640,7 +640,7 @@
FLT_OT_DBG_CONF_TRACER("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -713,7 +713,7 @@
retptr = FLT_OT_CALLOC(1, sizeof(*retptr));
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr->proxy = px;
LIST_INIT(&(retptr->groups));
@@ -721,7 +721,7 @@
FLT_OT_DBG_CONF("- init ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
diff --git a/addons/ot/src/event.c b/addons/ot/src/event.c
index 90b5828..a96d27c 100644
--- a/addons/ot/src/event.c
+++ b/addons/ot/src/event.c
@@ -55,7 +55,7 @@
FLT_OT_FUNC("%p, %p, %p, %u, %p, %p, %p, %p, %p:%p", s, f, chn, dir, span, data, conf_span, ts, FLT_OT_DPTR_ARGS(err));
if (span == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
if (span->span == NULL) {
span->span = ot_span_init(conf->tracer->tracer, span->id, ts, NULL, span->ref_type, FLT_OT_DEREF(span->ref_ctx, idx, -1), span->ref_span, data->tags, data->num_tags, err);
@@ -104,7 +104,7 @@
}
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -179,7 +179,7 @@
break;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
}
@@ -257,7 +257,7 @@
flt_ot_scope_finish_marked(f->ctx, ts);
flt_ot_scope_free_unused(f->ctx, chn);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -319,7 +319,7 @@
FLT_OT_DBG(3, "event = %d, chn = %p, s->req = %p, s->res = %p", event, chn, &(s->req), &(s->res));
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
/*
diff --git a/addons/ot/src/filter.c b/addons/ot/src/filter.c
index 04c4a67..6c931fa 100644
--- a/addons/ot/src/filter.c
+++ b/addons/ot/src/filter.c
@@ -162,7 +162,7 @@
FLT_OT_FUNC("%p, %p", p, fconf);
if (conf == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
flt_ot_cli_init();
@@ -178,7 +178,7 @@
FLT_OT_ERR_FREE(err);
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -256,7 +256,7 @@
FLT_OT_FUNC("%p, %p", p, fconf);
if (conf == NULL)
- FLT_OT_RETURN(++retval);
+ FLT_OT_RETURN_INT(++retval);
/*
* If only the proxy specified with the <p> parameter is checked, then
@@ -421,7 +421,7 @@
FLT_OT_DBG_LIST(conf->tracer, ph_scope, " ", "used", _scope, FLT_OT_DBG_CONF_PH(" ", _scope));
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -450,7 +450,7 @@
FLT_OT_FUNC("%p, %p", p, fconf);
if (conf == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
/*
* Start the OpenTracing library tracer thread.
@@ -469,7 +469,7 @@
retval = FLT_OT_RET_OK;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -529,7 +529,7 @@
if (conf->tracer->flag_disabled) {
FLT_OT_DBG(2, "filter '%s', type: %s (disabled)", conf->id, flt_ot_type(f));
- FLT_OT_RETURN(FLT_OT_RET_IGNORE);
+ FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE);
}
else if (conf->tracer->rate_limit < FLT_OT_FLOAT_U32(FLT_OT_RATE_LIMIT_MAX, FLT_OT_RATE_LIMIT_MAX)) {
uint32_t rnd = ha_random32();
@@ -537,7 +537,7 @@
if (conf->tracer->rate_limit <= rnd) {
FLT_OT_DBG(2, "filter '%s', type: %s (ignored: %u <= %u)", conf->id, flt_ot_type(f), conf->tracer->rate_limit, rnd);
- FLT_OT_RETURN(FLT_OT_RET_IGNORE);
+ FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE);
}
}
@@ -548,7 +548,7 @@
if (f->ctx == NULL) {
FLT_OT_LOG(LOG_EMERG, "failed to create context");
- FLT_OT_RETURN(FLT_OT_RET_IGNORE);
+ FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE);
}
/*
@@ -563,7 +563,7 @@
flt_ot_vars_dump(s);
flt_ot_http_headers_dump(&(s->req));
- FLT_OT_RETURN(FLT_OT_RET_OK);
+ FLT_OT_RETURN_INT(FLT_OT_RET_OK);
}
@@ -593,9 +593,9 @@
FLT_OT_FUNC("%p, %p", s, f);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -624,11 +624,11 @@
FLT_OT_FUNC("%p, %p, %p", s, f, be);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
FLT_OT_DBG(3, "backend: %s", be->id);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -748,7 +748,7 @@
FLT_OT_FUNC("%p, %p, %p", s, f, chn);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, (chn->flags & CF_ISRESP) ? FLT_OT_EVENT_RES_SERVER_SESS_START : FLT_OT_EVENT_REQ_CLIENT_SESS_START)))
- FLT_OT_RETURN(FLT_OT_RET_OK);
+ FLT_OT_RETURN_INT(FLT_OT_RET_OK);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s));
@@ -772,7 +772,7 @@
// register_data_filter(s, chn, f);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -808,7 +808,7 @@
}
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, event)))
- FLT_OT_RETURN(FLT_OT_RET_OK);
+ FLT_OT_RETURN_INT(FLT_OT_RET_OK);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s), analyzer: %s", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), flt_ot_analyzer(an_bit));
@@ -819,7 +819,7 @@
channel_dont_close(chn);
}
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -857,13 +857,13 @@
}
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, event)))
- FLT_OT_RETURN(FLT_OT_RET_OK);
+ FLT_OT_RETURN_INT(FLT_OT_RET_OK);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s), analyzer: %s", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), flt_ot_analyzer(an_bit));
retval = flt_ot_event_run(s, f, chn, event, &err);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -891,7 +891,7 @@
FLT_OT_FUNC("%p, %p, %p", s, f, chn);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, (chn->flags & CF_ISRESP) ? FLT_OT_EVENT_RES_SERVER_SESS_END : FLT_OT_EVENT_REQ_CLIENT_SESS_END)))
- FLT_OT_RETURN(FLT_OT_RET_OK);
+ FLT_OT_RETURN_INT(FLT_OT_RET_OK);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s));
@@ -913,7 +913,7 @@
}
}
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -945,11 +945,11 @@
FLT_OT_FUNC("%p, %p, %p", s, f, msg);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s), %.*s %.*s %.*s", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), HTX_SL_P1_LEN(sl), HTX_SL_P1_PTR(sl), HTX_SL_P2_LEN(sl), HTX_SL_P2_PTR(sl), HTX_SL_P3_LEN(sl), HTX_SL_P3_PTR(sl));
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -978,14 +978,14 @@
FLT_OT_FUNC("%p, %p, %p, %u, %u", s, f, msg, offset, len);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(len);
+ FLT_OT_RETURN_INT(len);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s), offset: %u, len: %u, forward: %d", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), offset, len, retval);
if (retval != len)
task_wakeup(s->task, TASK_WOKEN_MSG);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -1013,11 +1013,11 @@
FLT_OT_FUNC("%p, %p, %p", s, f, msg);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s));
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
@@ -1111,7 +1111,7 @@
FLT_OT_FUNC("%p, %p, %p, %u, %u", s, f, chn, offset, len);
if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1)))
- FLT_OT_RETURN(len);
+ FLT_OT_RETURN_INT(len);
FLT_OT_DBG(3, "channel: %s, mode: %s (%s), offset: %u, len: %u, forward: %d", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), offset, len, retval);
@@ -1122,7 +1122,7 @@
if (retval != len)
task_wakeup(s->task, TASK_WOKEN_MSG);
- FLT_OT_RETURN(flt_ot_return_int(f, &err, retval));
+ FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval));
}
#endif /* DEBUG_OT */
diff --git a/addons/ot/src/group.c b/addons/ot/src/group.c
index f9fdecc..52b872d 100644
--- a/addons/ot/src/group.c
+++ b/addons/ot/src/group.c
@@ -66,13 +66,13 @@
if ((fconf == NULL) || (conf == NULL) || (conf_group == NULL)) {
FLT_OT_LOG(LOG_ERR, FLT_OT_ACTION_GROUP ": internal error, invalid group action");
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
if (conf->tracer->flag_disabled) {
FLT_OT_DBG(1, "filter '%s' disabled, group action '%s' ignored", conf->id, conf_group->id);
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
/* Find the OpenTracing filter instance from the current stream. */
@@ -86,10 +86,10 @@
if (rt_ctx == NULL) {
FLT_OT_DBG(1, "cannot find filter, probably not attached to the stream");
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
else if (flt_ot_is_disabled(filter FLT_OT_DBG_ARGS(, -1))) {
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
else {
FLT_OT_DBG(3, "run group '%s'", conf_group->id);
@@ -107,7 +107,7 @@
if (i >= FLT_OT_TABLESIZE(flt_ot_group_data)) {
FLT_OT_LOG(LOG_ERR, FLT_OT_ACTION_GROUP ": internal error, invalid rule->from=%d", rule->from);
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
list_for_each_entry(ph_scope, &(conf_group->ph_scopes), list) {
@@ -117,7 +117,7 @@
}
}
- FLT_OT_RETURN(ACT_RET_CONT);
+ FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d");
}
@@ -166,7 +166,7 @@
if (i >= FLT_OT_TABLESIZE(flt_ot_group_data)) {
FLT_OT_ERR("internal error, unexpected rule->from=%d, please report this bug!", rule->from);
- FLT_OT_RETURN(0);
+ FLT_OT_RETURN_INT(0);
}
/*
@@ -191,7 +191,7 @@
if (fconf == NULL) {
FLT_OT_ERR("unable to find the OpenTracing filter '%s' used by the " FLT_OT_ACTION_GROUP " '%s'", filter_id, group_id);
- FLT_OT_RETURN(0);
+ FLT_OT_RETURN_INT(0);
}
/*
@@ -208,7 +208,7 @@
if (!flag_found) {
FLT_OT_ERR("unable to find group '%s' in the OpenTracing filter '%s' configuration", group_id, filter_id);
- FLT_OT_RETURN(0);
+ FLT_OT_RETURN_INT(0);
}
FLT_OT_FREE_CLEAR(rule->arg.act.p[FLT_OT_ARG_FILTER_ID]);
@@ -218,7 +218,7 @@
rule->arg.act.p[FLT_OT_ARG_CONF] = conf;
rule->arg.act.p[FLT_OT_ARG_GROUP] = ph_group;
- FLT_OT_RETURN(1);
+ FLT_OT_RETURN_INT(1);
}
@@ -272,7 +272,7 @@
(strcmp(args[*cur_arg + 2], FLT_OT_CONDITION_UNLESS) != 0))) {
FLT_OT_ERR("expects: <filter-id> <group-id> [{ if | unless } ...]");
- FLT_OT_RETURN(ACT_RET_PRS_ERR);
+ FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d");
}
/* Copy the OpenTracing filter id. */
@@ -280,7 +280,7 @@
if (rule->arg.act.p[FLT_OT_ARG_FILTER_ID] == NULL) {
FLT_OT_ERR("%s : out of memory", args[*cur_arg]);
- FLT_OT_RETURN(ACT_RET_PRS_ERR);
+ FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d");
}
/* Copy the OpenTracing group id. */
@@ -290,7 +290,7 @@
FLT_OT_FREE_CLEAR(rule->arg.act.p[FLT_OT_ARG_FILTER_ID]);
- FLT_OT_RETURN(ACT_RET_PRS_ERR);
+ FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d");
}
rule->action = ACT_CUSTOM;
@@ -300,7 +300,7 @@
*cur_arg += 2;
- FLT_OT_RETURN(ACT_RET_PRS_OK);
+ FLT_OT_RETURN_EX(ACT_RET_PRS_OK, enum act_parse_ret, "%d");
}
diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c
index 4a12ed8..ea22469 100644
--- a/addons/ot/src/http.c
+++ b/addons/ot/src/http.c
@@ -97,7 +97,7 @@
FLT_OT_FUNC("%p, \"%s\", %zu, %p:%p", chn, prefix, len, FLT_OT_DPTR_ARGS(err));
if (chn == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
/*
* The keyword 'inject' allows you to define the name of the OpenTracing
@@ -161,7 +161,7 @@
otc_text_map_destroy(&retptr, OTC_TEXT_MAP_FREE_KEY | OTC_TEXT_MAP_FREE_VALUE);
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -194,7 +194,7 @@
FLT_OT_FUNC("%p, \"%s\", \"%s\", \"%s\", %p:%p", chn, prefix, name, value, FLT_OT_DPTR_ARGS(err));
if ((chn == NULL) || (!FLT_OT_STR_ISVALID(prefix) && !FLT_OT_STR_ISVALID(name)))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
htx = htxbuf(&(chn->buf));
@@ -205,7 +205,7 @@
if (htx_is_empty(htx)) {
FLT_OT_ERR("HTX is empty");
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
if (!FLT_OT_STR_ISVALID(prefix)) {
@@ -219,7 +219,7 @@
else {
buffer = flt_ot_trash_alloc(0, err);
if (buffer == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
(void)chunk_printf(buffer, "%s-%s", prefix, name);
@@ -264,7 +264,7 @@
flt_ot_trash_free(&buffer);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -291,7 +291,7 @@
retval = flt_ot_http_header_set(chn, prefix, NULL, NULL, err);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
/*
diff --git a/addons/ot/src/opentracing.c b/addons/ot/src/opentracing.c
index b79ba29..8ae5f02 100644
--- a/addons/ot/src/opentracing.c
+++ b/addons/ot/src/opentracing.c
@@ -162,13 +162,13 @@
if (getcwd(cwd, sizeof(cwd)) == NULL) {
FLT_OT_ERR("failed to get current working directory");
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
rc = snprintf(path, sizeof(path), "%s/%s", cwd, plugin);
if ((rc == -1) || (rc >= sizeof(path))) {
FLT_OT_ERR("failed to construct the OpenTracing plugin path");
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
*tracer = otc_tracer_load(path, errbuf, sizeof(errbuf));
@@ -180,7 +180,7 @@
retval = 0;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -207,13 +207,13 @@
FLT_OT_FUNC("%p, %p, %p:%p", tracer, cfgbuf, FLT_OT_DPTR_ARGS(err));
if (cfgbuf == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = otc_tracer_start(NULL, cfgbuf, errbuf, sizeof(errbuf));
if (retval == -1)
FLT_OT_ERR("%s", (*errbuf == '\0') ? "failed to start tracer" : errbuf);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -277,9 +277,9 @@
FLT_OT_FUNC("%p, \"%s\", %p, %p, %d, %d, %p, %p, %d, %p:%p", tracer, operation_name, ts_steady, ts_system, ref_type, ref_ctx_idx, ref_span, tags, num_tags, FLT_OT_DPTR_ARGS(err));
if (operation_name == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
(void)memset(&options, 0, sizeof(options));
@@ -303,7 +303,7 @@
else
FLT_OT_DBG(2, "span %p:%zd initialized", retptr, retptr->idx);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -354,7 +354,7 @@
retptr = ot_span_init(tracer, operation_name, ts_steady, ts_system, ref_type, ref_ctx_idx, ref_span, tags, num_tags, err);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -380,12 +380,12 @@
FLT_OT_FUNC("%p, %p, %d", span, tags, num_tags);
if ((span == NULL) || (tags == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
for (retval = 0; retval < num_tags; retval++)
span->set_tag(span, tags[retval].key, &(tags[retval].value));
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -414,7 +414,7 @@
FLT_OT_FUNC("%p, \"%s\", %d, ...", span, key, type);
if ((span == NULL) || (key == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
va_start(ap, type);
for (retval = 0; (key != NULL) && FLT_OT_IN_RANGE(type, otc_value_bool, otc_value_null); retval++) {
@@ -439,7 +439,7 @@
}
va_end(ap);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -465,13 +465,13 @@
FLT_OT_FUNC("%p, %p, %d", span, log_fields, num_fields);
if ((span == NULL) || (log_fields == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = MIN(OTC_MAXLOGFIELDS, num_fields);
span->log_fields(span, log_fields, retval);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -499,7 +499,7 @@
FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, value);
if ((span == NULL) || (key == NULL) || (value == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
va_start(ap, value);
for (retval = 0; (retval < FLT_OT_TABLESIZE(log_field)) && (key != NULL); retval++) {
@@ -515,7 +515,7 @@
span->log_fields(span, log_field, retval);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -543,7 +543,7 @@
FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, format);
if ((span == NULL) || (key == NULL) || (format == NULL))
- FLT_OT_RETURN(-1);
+ FLT_OT_RETURN_INT(-1);
va_start(ap, format);
n = vsnprintf(value, sizeof(value), format, ap);
@@ -554,7 +554,7 @@
}
va_end(ap);
- FLT_OT_RETURN(ot_span_log_va(span, key, value, NULL));
+ FLT_OT_RETURN_INT(ot_span_log_va(span, key, value, NULL));
}
@@ -580,10 +580,10 @@
FLT_OT_FUNC("%p, %p", span, baggage);
if ((span == NULL) || (baggage == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
if ((baggage->key == NULL) || (baggage->value == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
for (retval = i = 0; i < baggage->count; i++) {
FLT_OT_DBG(3, "set baggage: \"%s\" -> \"%s\"", baggage->key[i], baggage->value[i]);
@@ -595,7 +595,7 @@
}
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -622,7 +622,7 @@
FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, value);
if ((span == NULL) || (key == NULL) || (value == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
va_start(ap, value);
for (retval = 0; (key != NULL); retval++) {
@@ -636,7 +636,7 @@
}
va_end(ap);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -663,7 +663,7 @@
FLT_OT_FUNC("%p, \"%s\", ...", span, key);
if ((span == NULL) || (key == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
va_start(ap, key);
for (n = 1; va_arg(ap, typeof(key)) != NULL; n++);
@@ -671,7 +671,7 @@
retptr = otc_text_map_new(NULL, n);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
va_start(ap, key);
for (i = 0; (i < n) && (key != NULL); i++) {
@@ -689,7 +689,7 @@
}
va_end(ap);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -716,13 +716,13 @@
FLT_OT_FUNC("%p, %p, %p", tracer, span, carrier);
if ((span == NULL) || (carrier == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr = span->span_context((struct otc_span *)span);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
(void)memset(carrier, 0, sizeof(*carrier));
@@ -737,7 +737,7 @@
#endif
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -765,15 +765,15 @@
FLT_OT_FUNC("%p, %p, %p, %p:%p", tracer, span, carrier, FLT_OT_DPTR_ARGS(err));
if ((span == NULL) || (carrier == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr = span->span_context((struct otc_span *)span);
if (retptr == NULL) {
FLT_OT_ERR("failed to create span context");
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
(void)memset(carrier, 0, sizeof(*carrier));
@@ -791,7 +791,7 @@
#endif
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -818,13 +818,13 @@
FLT_OT_FUNC("%p, %p, %p", tracer, span, carrier);
if ((span == NULL) || (carrier == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr = span->span_context((struct otc_span *)span);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
(void)memset(carrier, 0, sizeof(*carrier));
@@ -844,7 +844,7 @@
#endif
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -871,9 +871,9 @@
FLT_OT_FUNC("%p, %p, %p", tracer, carrier, text_map);
if (carrier == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
if (text_map != NULL) {
(void)memset(carrier, 0, sizeof(*carrier));
@@ -888,7 +888,7 @@
else if (retptr != NULL)
FLT_OT_DBG_SPAN_CONTEXT(retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -916,9 +916,9 @@
FLT_OT_FUNC("%p, %p, %p, %p:%p", tracer, carrier, text_map, FLT_OT_DPTR_ARGS(err));
if (carrier == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
if (text_map != NULL) {
(void)memset(carrier, 0, sizeof(*carrier));
@@ -936,7 +936,7 @@
else if (retptr != NULL)
FLT_OT_DBG_SPAN_CONTEXT(retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -963,9 +963,9 @@
FLT_OT_FUNC("%p, %p, %p", tracer, carrier, binary_data);
if (carrier == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
else if (tracer == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
if ((FLT_OT_DEREF(binary_data, data, NULL) != NULL) && (binary_data->size > 0)) {
(void)memset(carrier, 0, sizeof(*carrier));
@@ -980,7 +980,7 @@
else if (retptr != NULL)
FLT_OT_DBG_SPAN_CONTEXT(retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
diff --git a/addons/ot/src/parser.c b/addons/ot/src/parser.c
index e26ca18..513054b 100644
--- a/addons/ot/src/parser.c
+++ b/addons/ot/src/parser.c
@@ -67,7 +67,7 @@
retval |= ERR_ABORT | ERR_ALERT;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -112,7 +112,7 @@
retval = flt_ot_parse_strdup(ptr, args[pos + 1], err, args[cur_arg]);
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -137,7 +137,7 @@
FLT_OT_FUNC("\"%s\", %d", name, type);
if (!FLT_OT_STR_ISVALID(name))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_EX(retptr, const char *, "%p");
if (type == 1) {
retptr = invalid_char(name);
@@ -162,7 +162,7 @@
retptr = NULL;
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_EX(retptr, const char *, "%p");
}
@@ -241,7 +241,7 @@
if (!(retval & ERR_CODE) && (*pdata)->flag_check_id && (id == NULL))
FLT_OT_PARSE_ERR(err, "'%s' : %s ID not set (use '%s%s')", args[0], parse_data[1].name, parse_data[1].name, parse_data[1].usage);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -285,7 +285,7 @@
if (retval & ERR_CODE)
flt_ot_conf_sample_expr_free(&expr);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -335,7 +335,7 @@
else
FLT_OT_DBG(3, "sample '%s' -> '%s' added", sample->key, sample->value);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -371,7 +371,7 @@
if (retval & ERR_CODE)
flt_ot_conf_str_free(&str);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -409,7 +409,7 @@
else
retval = flt_ot_parse_keyword(ptr, args, 0, 0, err, err_msg);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -470,13 +470,13 @@
FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod);
if (flt_ot_parse_check_scope())
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_tracer, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err);
if (retval & ERR_CODE) {
FLT_OT_PARSE_IFERR_ALERT();
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
if (pdata->keyword == FLT_OT_PARSE_TRACER_ID) {
@@ -554,7 +554,7 @@
if ((retval & ERR_CODE) && (flt_ot_current_tracer != NULL))
flt_ot_conf_tracer_free(&flt_ot_current_tracer);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -580,12 +580,12 @@
FLT_OT_FUNC("");
if (flt_ot_current_tracer == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
flt_ot_current_config->tracer = flt_ot_current_tracer;
if (flt_ot_current_tracer->id == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
if (flt_ot_current_tracer->config == NULL) {
FLT_OT_POST_PARSE_ALERT("tracer '%s' has no configuration file specified", flt_ot_current_tracer->cfg_line, flt_ot_current_tracer->id);
@@ -600,7 +600,7 @@
flt_ot_current_tracer = NULL;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -633,13 +633,13 @@
FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod);
if (flt_ot_parse_check_scope())
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_group, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err);
if (retval & ERR_CODE) {
FLT_OT_PARSE_IFERR_ALERT();
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
if (pdata->keyword == FLT_OT_PARSE_GROUP_ID) {
@@ -658,7 +658,7 @@
if ((retval & ERR_CODE) && (flt_ot_current_group != NULL))
flt_ot_conf_group_free(&flt_ot_current_group);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -683,7 +683,7 @@
FLT_OT_FUNC("");
if (flt_ot_current_group == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
/* Check that the group has at least one scope defined. */
if (LIST_ISEMPTY(&(flt_ot_current_group->ph_scopes)))
@@ -691,7 +691,7 @@
flt_ot_current_group = NULL;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -734,7 +734,7 @@
FLT_OT_DBG(2, "ctx_flags: 0x%02hhx (0x%02hhx)", flt_ot_current_span->ctx_flags, flags);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -774,7 +774,7 @@
if ((retptr != NULL) && (err != NULL))
FLT_OT_FREE_CLEAR(*err);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -807,13 +807,13 @@
FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod);
if (flt_ot_parse_check_scope())
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_span, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err);
if (retval & ERR_CODE) {
FLT_OT_PARSE_IFERR_ALERT();
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
if (pdata->keyword == FLT_OT_PARSE_SCOPE_ID) {
@@ -1005,7 +1005,7 @@
flt_ot_current_span = NULL;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -1034,7 +1034,7 @@
FLT_OT_FUNC("");
if (flt_ot_current_scope == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
/* If span context inject is used, check that this is possible. */
list_for_each_entry(conf_span, &(flt_ot_current_scope->spans), list)
@@ -1048,7 +1048,7 @@
flt_ot_current_scope = NULL;
flt_ot_current_span = NULL;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -1099,7 +1099,7 @@
flt_ot_current_config = NULL;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -1144,7 +1144,7 @@
if (otc_dbg_mem_init(&dbg_mem, dbg_mem_data, FLT_OT_TABLESIZE(dbg_mem_data), 0xff) == -1) {
FLT_OT_PARSE_ERR(err, "cannot initialize memory debugger");
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
);
#endif
@@ -1155,7 +1155,7 @@
if (conf == NULL) {
FLT_OT_PARSE_ERR(err, "'%s' : out of memory", args[*cur_arg]);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
for (pos = *cur_arg + 1; !(retval & ERR_CODE) && FLT_OT_ARG_ISVALID(pos); pos++) {
@@ -1198,7 +1198,7 @@
FLT_OT_DBG(3, "filter set: id '%s', config '%s'", conf->id, conf->cfg_file);
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
diff --git a/addons/ot/src/pool.c b/addons/ot/src/pool.c
index 0ee5426..fbcdbfc 100644
--- a/addons/ot/src/pool.c
+++ b/addons/ot/src/pool.c
@@ -55,7 +55,7 @@
else if (flag_clear)
(void)memset(retptr, 0, size);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -97,7 +97,7 @@
else
FLT_OT_ERR("out of memory");
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -175,7 +175,7 @@
else if (flag_clear)
(void)memset(retptr->area, 0, retptr->size);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c
index 8d70a08..ec5e81f 100644
--- a/addons/ot/src/scope.c
+++ b/addons/ot/src/scope.c
@@ -101,7 +101,7 @@
retptr = flt_ot_pool_alloc(pool_head_ot_runtime_context, sizeof(*retptr), 1, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr->stream = s;
retptr->filter = f;
@@ -125,7 +125,7 @@
FLT_OT_DBG_RUNTIME_CONTEXT("session context: ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -209,13 +209,13 @@
FLT_OT_FUNC("%p, \"%s\", %zu, %d, \"%s\", %zu, %u, %p:%p", rt_ctx, id, id_len, ref_type, ref_id, ref_id_len, dir, FLT_OT_DPTR_ARGS(err));
if ((rt_ctx == NULL) || (id == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
list_for_each_entry(span, &(rt_ctx->spans), list)
if ((span->id_len == id_len) && (memcmp(span->id, id, id_len) == 0)) {
FLT_OT_DBG(2, "found span %p", span);
- FLT_OT_RETURN(span);
+ FLT_OT_RETURN_PTR(span);
}
if (ref_id != NULL) {
@@ -241,14 +241,14 @@
} else {
FLT_OT_ERR("cannot find referenced span/context '%s'", ref_id);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
}
}
retptr = flt_ot_pool_alloc(pool_head_ot_scope_span, sizeof(*retptr), 1, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
retptr->id = id;
retptr->id_len = id_len;
@@ -260,7 +260,7 @@
FLT_OT_DBG_SCOPE_SPAN("new span ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -328,24 +328,24 @@
FLT_OT_FUNC("%p, %p, \"%s\", %zu, %p, %u, %p:%p", rt_ctx, tracer, id, id_len, text_map, dir, FLT_OT_DPTR_ARGS(err));
if ((rt_ctx == NULL) || (tracer == NULL) || (id == NULL) || (text_map == NULL))
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
list_for_each_entry(retptr, &(rt_ctx->contexts), list)
if ((retptr->id_len == id_len) && (memcmp(retptr->id, id, id_len) == 0)) {
FLT_OT_DBG(2, "found context %p", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
retptr = flt_ot_pool_alloc(pool_head_ot_scope_context, sizeof(*retptr), 1, err);
if (retptr == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
span_ctx = ot_extract_http_headers(tracer, &reader, text_map, err);
if (span_ctx == NULL) {
flt_ot_scope_context_free(&retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
retptr->id = id;
@@ -356,7 +356,7 @@
FLT_OT_DBG_SCOPE_CONTEXT("new context ", retptr);
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
@@ -523,7 +523,7 @@
retval = span_cnt + ctx_cnt;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
diff --git a/addons/ot/src/util.c b/addons/ot/src/util.c
index f6812bc..767685e 100644
--- a/addons/ot/src/util.c
+++ b/addons/ot/src/util.c
@@ -327,7 +327,7 @@
FLT_OT_FUNC("%p, %p, %zu, %p:%p", chk, src, n, FLT_OT_DPTR_ARGS(err));
if ((chk == NULL) || (src == NULL))
- FLT_OT_RETURN(-1);
+ FLT_OT_RETURN_EX(-1, ssize_t, "%ld");
if (chk->area == NULL)
chunk_init(chk, FLT_OT_CALLOC(1, global.tune.bufsize), global.tune.bufsize);
@@ -335,18 +335,18 @@
if (chk->area == NULL) {
FLT_OT_ERR("out of memory");
- FLT_OT_RETURN(-1);
+ FLT_OT_RETURN_EX(-1, ssize_t, "%ld");
}
else if (n > (chk->size - chk->data)) {
FLT_OT_ERR("chunk size too small");
- FLT_OT_RETURN(-1);
+ FLT_OT_RETURN_EX(-1, ssize_t, "%ld");
}
(void)memcpy(chk->area + chk->data, src, n);
chk->data += n;
- FLT_OT_RETURN(chk->data);
+ FLT_OT_RETURN_EX(chk->data, ssize_t, "%ld");
}
@@ -512,7 +512,7 @@
FLT_OT_FUNC("%p, %p, %zu, %p:%p", data, value, size, FLT_OT_DPTR_ARGS(err));
if ((data == NULL) || (value == NULL) || (size == 0))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
*value = '\0';
@@ -623,7 +623,7 @@
FLT_OT_ERR("invalid HTTP method");
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -650,7 +650,7 @@
FLT_OT_FUNC("\"%s\", %p, %p, %p:%p", key, data, value, FLT_OT_DPTR_ARGS(err));
if ((data == NULL) || (value == NULL))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
if (data->type == SMP_T_BOOL) {
value->type = otc_value_bool;
@@ -674,7 +674,7 @@
retval = flt_ot_sample_to_str(data, (char *)value->value.string_value, global.tune.bufsize, err);
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -802,7 +802,7 @@
FLT_OT_DBG(3, "baggage[%zu]: '%s' -> '%s'", data->baggage->count - 1, data->baggage->key[data->baggage->count - 1], data->baggage->value[data->baggage->count - 1]);
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
/*
diff --git a/addons/ot/src/vars.c b/addons/ot/src/vars.c
index a6074c6..d307b52 100644
--- a/addons/ot/src/vars.c
+++ b/addons/ot/src/vars.c
@@ -173,7 +173,7 @@
FLT_OT_FUNC("%p, %zu, %p, \"%s\", %p:%p", var_name, size, len, name, FLT_OT_DPTR_ARGS(err));
if (!FLT_OT_STR_ISVALID(name))
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
/*
* In case the name of the variable consists of several elements,
@@ -219,7 +219,7 @@
if (retval == -1)
*len = retval;
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -256,7 +256,7 @@
if (retval == -1)
FLT_OT_ERR("failed to construct variable name '%s.%s.%s'", scope, prefix, name);
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -286,7 +286,7 @@
var_name_len = flt_ot_var_name(scope, prefix, name, var_name, sizeof(var_name), err);
if (var_name_len == -1)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
/* Set <size> to 0 to not release var_name memory in vars_check_arg(). */
(void)memset(&arg, 0, sizeof(arg));
@@ -302,7 +302,7 @@
retval = var_name_len;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -335,7 +335,7 @@
var_name_len = flt_ot_var_name(scope, prefix, name, var_name, sizeof(var_name), err);
if (var_name_len == -1)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
flt_ot_smp_init(s, &smp, opt, SMP_T_STR, value);
@@ -347,7 +347,7 @@
retval = var_name_len;
}
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -381,11 +381,11 @@
vars = flt_ot_get_vars(s, scope);
if (vars == NULL)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
var_prefix_len = flt_ot_var_name(NULL, prefix, NULL, var_prefix, sizeof(var_prefix), err);
if (var_prefix_len == -1)
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
retval = 0;
@@ -412,7 +412,7 @@
}
HA_RWLOCK_WRUNLOCK(VARS_LOCK, &(vars->rwlock));
- FLT_OT_RETURN(retval);
+ FLT_OT_RETURN_INT(retval);
}
@@ -445,11 +445,11 @@
vars = flt_ot_get_vars(s, scope);
if (vars == NULL)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
rc = flt_ot_var_name(NULL, prefix, NULL, var_name, sizeof(var_name), err);
if (rc == -1)
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
HA_RWLOCK_RDLOCK(VARS_LOCK, &(vars->rwlock));
list_for_each_entry(var, &(vars->head), l) {
@@ -515,7 +515,7 @@
otc_text_map_destroy(&retptr, OTC_TEXT_MAP_FREE_KEY | OTC_TEXT_MAP_FREE_VALUE);
}
- FLT_OT_RETURN(retptr);
+ FLT_OT_RETURN_PTR(retptr);
}
/*