DEBUG: unstatify a few functions that are often present in backtraces

It's useful to be able to recognize certain functions that are often
present in backtraces as they call lower level functions, and for this
they must not be static. Let's remove "static" in front of these
functions:

  sc_notify, sc_conn_recv, sc_conn_send, sc_conn_process,
  sc_applet_process, back_establish, stream_update_both_sc,
  httpclient_applet_io_handler, httpclient_applet_init,
  httpclient_applet_release
This commit is contained in:
Willy Tarreau 2023-11-30 17:04:16 +01:00
parent ff8db5a85d
commit 7f58e9f1e0
4 changed files with 22 additions and 17 deletions

View File

@ -1162,7 +1162,7 @@ int alloc_bind_address(struct sockaddr_storage **ss,
* (safe or idle connections). The <is_safe> argument means what type of * (safe or idle connections). The <is_safe> argument means what type of
* connection the caller wants. * connection the caller wants.
*/ */
static struct connection *conn_backend_get(struct stream *s, struct server *srv, int is_safe, int64_t hash) struct connection *conn_backend_get(struct stream *s, struct server *srv, int is_safe, int64_t hash)
{ {
struct connection *conn = NULL; struct connection *conn = NULL;
int i; // thread number int i; // thread number
@ -1339,7 +1339,7 @@ static int do_connect_server(struct stream *s, struct connection *conn)
* Additionally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted. * Additionally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
* The server-facing stream connector is expected to hold a pre-allocated connection. * The server-facing stream connector is expected to hold a pre-allocated connection.
*/ */
static int connect_server(struct stream *s) int connect_server(struct stream *s)
{ {
struct connection *cli_conn = objt_conn(strm_orig(s)); struct connection *cli_conn = objt_conn(strm_orig(s));
struct connection *srv_conn = NULL; struct connection *srv_conn = NULL;

View File

@ -690,7 +690,7 @@ int httpclient_set_proxy(struct httpclient *hc, struct proxy *px)
return 0; return 0;
} }
static void httpclient_applet_io_handler(struct appctx *appctx) void httpclient_applet_io_handler(struct appctx *appctx)
{ {
struct httpclient *hc = appctx->svcctx; struct httpclient *hc = appctx->svcctx;
struct stconn *sc = appctx_sc(appctx); struct stconn *sc = appctx_sc(appctx);
@ -1005,7 +1005,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
goto out; goto out;
} }
static int httpclient_applet_init(struct appctx *appctx) int httpclient_applet_init(struct appctx *appctx)
{ {
struct httpclient *hc = appctx->svcctx; struct httpclient *hc = appctx->svcctx;
struct stream *s; struct stream *s;
@ -1102,7 +1102,7 @@ static int httpclient_applet_init(struct appctx *appctx)
return -1; return -1;
} }
static void httpclient_applet_release(struct appctx *appctx) void httpclient_applet_release(struct appctx *appctx)
{ {
struct httpclient *hc = appctx->svcctx; struct httpclient *hc = appctx->svcctx;

View File

@ -1047,9 +1047,10 @@ void sc_update_tx(struct stconn *sc)
* It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are * It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are
* encouraged to watch to take appropriate action. * encouraged to watch to take appropriate action.
* It should not be called from within the stream itself, sc_update() * It should not be called from within the stream itself, sc_update()
* is designed for this. * is designed for this. Please do not statify this function, it's often
* present in backtraces, it's useful to recognize it.
*/ */
static void sc_notify(struct stconn *sc) void sc_notify(struct stconn *sc)
{ {
struct channel *ic = sc_ic(sc); struct channel *ic = sc_ic(sc);
struct channel *oc = sc_oc(sc); struct channel *oc = sc_oc(sc);
@ -1205,9 +1206,10 @@ static void sc_conn_eos(struct stconn *sc)
/* /*
* This is the callback which is called by the connection layer to receive data * This is the callback which is called by the connection layer to receive data
* into the buffer from the connection. It iterates over the mux layer's * into the buffer from the connection. It iterates over the mux layer's
* rcv_buf function. * rcv_buf function. Please do not statify this function, it's often present in
* backtraces, it's useful to recognize it.
*/ */
static int sc_conn_recv(struct stconn *sc) int sc_conn_recv(struct stconn *sc)
{ {
struct connection *conn = __sc_conn(sc); struct connection *conn = __sc_conn(sc);
struct channel *ic = sc_ic(sc); struct channel *ic = sc_ic(sc);
@ -1550,9 +1552,10 @@ int sc_conn_sync_recv(struct stconn *sc)
* This function is called to send buffer data to a stream socket. * This function is called to send buffer data to a stream socket.
* It calls the mux layer's snd_buf function. It relies on the * It calls the mux layer's snd_buf function. It relies on the
* caller to commit polling changes. The caller should check conn->flags * caller to commit polling changes. The caller should check conn->flags
* for errors. * for errors. Please do not statify this function, it's often present in
* backtraces, it's useful to recognize it.
*/ */
static int sc_conn_send(struct stconn *sc) int sc_conn_send(struct stconn *sc)
{ {
struct connection *conn = __sc_conn(sc); struct connection *conn = __sc_conn(sc);
struct stconn *sco = sc_opposite(sc); struct stconn *sco = sc_opposite(sc);
@ -1755,9 +1758,10 @@ void sc_conn_sync_send(struct stconn *sc)
* connection flags to the stream connector, updates the stream (which may or * connection flags to the stream connector, updates the stream (which may or
* may not take this opportunity to try to forward data), then update the * may not take this opportunity to try to forward data), then update the
* connection's polling based on the channels and stream connector's final * connection's polling based on the channels and stream connector's final
* states. The function always returns 0. * states. The function always returns 0. Please do not statify this function,
* it's often present in backtraces, it's useful to recognize it.
*/ */
static int sc_conn_process(struct stconn *sc) int sc_conn_process(struct stconn *sc)
{ {
struct connection *conn = __sc_conn(sc); struct connection *conn = __sc_conn(sc);
struct channel *ic = sc_ic(sc); struct channel *ic = sc_ic(sc);
@ -1906,9 +1910,10 @@ static void sc_applet_eos(struct stconn *sc)
/* Callback to be used by applet handlers upon completion. It updates the stream /* Callback to be used by applet handlers upon completion. It updates the stream
* (which may or may not take this opportunity to try to forward data), then * (which may or may not take this opportunity to try to forward data), then
* may re-enable the applet's based on the channels and stream connector's final * may re-enable the applet's based on the channels and stream connector's final
* states. * states. Please do not statify this function, it's often present in backtraces,
* it's useful to recognize it.
*/ */
static int sc_applet_process(struct stconn *sc) int sc_applet_process(struct stconn *sc)
{ {
struct channel *ic = sc_ic(sc); struct channel *ic = sc_ic(sc);

View File

@ -890,7 +890,7 @@ int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout
* Timeouts are cleared. Error are reported on the channel so that analysers * Timeouts are cleared. Error are reported on the channel so that analysers
* can handle them. * can handle them.
*/ */
static void back_establish(struct stream *s) void back_establish(struct stream *s)
{ {
struct connection *conn = sc_conn(s->scb); struct connection *conn = sc_conn(s->scb);
struct channel *req = &s->req; struct channel *req = &s->req;
@ -1536,7 +1536,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
* Note that this does not change the stream connector's current state, though * Note that this does not change the stream connector's current state, though
* it updates the previous state to the current one. * it updates the previous state to the current one.
*/ */
static void stream_update_both_sc(struct stream *s) void stream_update_both_sc(struct stream *s)
{ {
struct stconn *scf = s->scf; struct stconn *scf = s->scf;
struct stconn *scb = s->scb; struct stconn *scb = s->scb;