CLEANUP: tree-wide: fix more typos and outdated explanations in comments

Some outdated comments, as well as typos were fixed in the following files:

  dgram.h protocol.h queue-t.h cpu_topo.c debug.c dict.c
  protocol.c queue.c raw_sock.c trace.c wdt.c
This commit is contained in:
Willy Tarreau 2026-05-13 10:48:18 +02:00
parent a9f38c19b4
commit 31a3e16e16
11 changed files with 30 additions and 29 deletions

View File

@ -1,5 +1,5 @@
/*
* include/haproxy/proto_dgram.h
* include/haproxy/dgram.h
* This file provides functions related to DGRAM processing.
*
* Copyright (C) 2014 Baptiste Assmann <bedis9@gmail.com>

View File

@ -92,8 +92,8 @@ int protocol_resume_all(void);
int protocol_enable_all(void);
/* returns the protocol associated to family <family> with proto_type among the
* supported protocol types, and ctrl_type of either SOCK_STREAM or SOCK_DGRAM
* depending on the requested values, or NULL if not found.
* supported protocol types, and index <alt> (0 or 1) selecting between the two
* possible entries per (family, proto_type), or NULL if not found.
*/
static inline struct protocol *protocol_lookup(int family, enum proto_type proto_type, int alt)
{

View File

@ -42,7 +42,7 @@ struct pendconn {
};
struct queue {
struct eb_root head; /* queued pendconnds */
struct eb_root head; /* queued pendconns */
struct proxy *px; /* the proxy we're waiting for, never NULL in queue */
struct server *sv; /* the server we are waiting for, may be NULL if don't care */
__decl_thread(HA_SPINLOCK_T lock); /* for manipulations in the tree */

View File

@ -983,7 +983,7 @@ void cpu_compose_clusters(void)
/* renumber clusters and assign unassigned ones at the same
* time. For this, we'll compare pkg/die/llc with the last
* CPU's and verify if we need to create a new cluster ID.
* Note that some platforms don't report cache. The locao value
* Note that some platforms don't report cache. The local value
* is local to the pkg+node combination so that we reset it
* when changing, contrary to the global one which grows.
*/
@ -2402,7 +2402,7 @@ static int cpu_topo_alloc(void)
ha_cpu_clusters[cpu].idx = cpu;
}
/* pre-inizialize the configured CPU sets */
/* pre-initialize the configured CPU sets */
ha_cpuset_zero(&cpu_set_cfg.drop_cpus);
ha_cpuset_zero(&cpu_set_cfg.only_cpus);
ha_cpuset_zero(&cpu_set_cfg.drop_nodes);

View File

@ -1357,8 +1357,7 @@ static int debug_parse_cli_write(char **args, char *payload, struct appctx *appc
/*
* debug dev stream [strm=<ptr>] [strm.f[{+-=}<flags>]] [txn.f[{+-=}<flags>]] \
* [req.f[{+-=}<flags>]] [res.f[{+-=}<flags>]] \
* [sif.f[{+-=<flags>]] [sib.f[{+-=<flags>]] \
* [sif.s[=<state>]] [sib.s[=<state>]]
* [scf.s[=<state>]] [scb.s[=<state>]]
*/
static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private)
{
@ -1628,7 +1627,7 @@ static struct task *debug_delay_inj_task(struct task *t, void *ctx, unsigned int
*/
static int debug_parse_delay_inj(char **args, char *payload, struct appctx *appctx, void *private)
{
unsigned long *tctx; // [0] = inter, [2] = count
unsigned long *tctx; // [0] = inter, [1] = nbwakeups
struct task *task;
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))

View File

@ -59,7 +59,7 @@ static void free_dict_entry(struct dict_entry *de)
}
/*
* Simple function to lookup dictionary entries with <s> as value.
* Simple function to lookup dictionary entries with <s> as key.
*/
static struct dict_entry *__dict_lookup(struct dict *d, const char *s)
{
@ -75,7 +75,7 @@ static struct dict_entry *__dict_lookup(struct dict *d, const char *s)
}
/*
* Insert an entry in <d> dictionary with <s> as value. *
* Insert an entry in <d> dictionary with <s> as key.
*/
struct dict_entry *dict_insert(struct dict *d, char *s)
{

View File

@ -106,7 +106,7 @@ int protocol_supports_flag(struct protocol *proto, uint flag)
if (!(_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_SUPPORTED))
return 0;
/* at least nobody said it was not supported */
/* TESTED is set, assume supported (live test already ran and passed) */
if (_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_TESTED)
return 1;
@ -289,8 +289,7 @@ int protocol_resume_all(void)
}
/* enables all listeners of all registered protocols. This is intended to be
* used after a fork() to enable reading on all file descriptors. Returns
* composition of ERR_NONE.
* used after a fork() to enable reading on all file descriptors. Returns ERR_NONE.
*/
int protocol_enable_all(void)
{

View File

@ -24,9 +24,9 @@
* - if p->node.node.leaf_p is NULL, the element is unlinked,
* otherwise it necessarily belongs to one of the other lists ; this may
* not be atomically checked under threads though ;
* - pendconn->px is never NULL if pendconn->list is not empty
* - pendconn->srv is never NULL if pendconn->list is in the server's queue,
* and is always NULL if pendconn->list is in the backend's queue or empty.
* - pendconn->queue->px is never NULL if pendconn->node.node.leaf_p is not NULL
* - pendconn->queue->sv is never NULL if pendconn is in the server's queue,
* and is always NULL if it is in the proxy's queue or unlinked.
* - pendconn->target is NULL while the element is queued, and points to the
* assigned server when the pendconn is picked.
*
@ -44,7 +44,7 @@
* - a pendconn_add() is only performed by the stream which will own the
* pendconn ; the pendconn is allocated at this moment and returned ; it is
* added to either the server or the proxy's queue while holding this
s * queue's lock.
* queue's lock.
*
* - the pendconn is then met by a thread walking over the proxy or server's
* queue with the respective lock held. This lock is exclusive and the
@ -59,7 +59,7 @@ s * queue's lock.
* on the queue the pendconn is attached to.
*
* - no single operation except the pendconn initialisation prior to the
* insertion are performed without eithre a queue lock held or the element
* insertion are performed without either a queue lock held or the element
* being unlinked and visible exclusively to its stream.
*
* - pendconn_process_next_strm() assign ->target so that the stream knows
@ -126,7 +126,8 @@ unsigned int srv_dynamic_maxconn(const struct server *s)
* up to the caller to atomically decrement the pending counts.
*
* The caller must own the lock on the server queue. The pendconn must still be
* queued (p->node.leaf_p != NULL) and must be in a server (p->srv != NULL).
* queued (p->node.node.leaf_p != NULL) and must be in a server queue
* (p->queue->sv != NULL).
*/
static void __pendconn_unlink_srv(struct pendconn *p)
{
@ -139,7 +140,8 @@ static void __pendconn_unlink_srv(struct pendconn *p)
* up to the caller to atomically decrement the pending counts.
*
* The caller must own the lock on the proxy queue. The pendconn must still be
* queued (p->node.leaf_p != NULL) and must be in the proxy (p->srv == NULL).
* queued (p->node.node.leaf_p != NULL) and must be in the proxy queue
* (p->queue->sv == NULL).
*/
static void __pendconn_unlink_prx(struct pendconn *p)
{
@ -147,18 +149,18 @@ static void __pendconn_unlink_prx(struct pendconn *p)
eb32_delete(&p->node);
}
/* Locks the queue the pendconn element belongs to. This relies on both p->px
* and p->srv to be properly initialized (which is always the case once the
* element has been added).
/* Locks the queue the pendconn element belongs to. This relies on p->queue
* being properly initialized (which is always the case once the element
* has been added).
*/
static inline void pendconn_queue_lock(struct pendconn *p)
{
HA_SPIN_LOCK(QUEUE_LOCK, &p->queue->lock);
}
/* Unlocks the queue the pendconn element belongs to. This relies on both p->px
* and p->srv to be properly initialized (which is always the case once the
* element has been added).
/* Unlocks the queue the pendconn element belongs to. This relies on p->queue
* being properly initialized (which is always the case once the element
* has been added).
*/
static inline void pendconn_queue_unlock(struct pendconn *p)
{

View File

@ -365,7 +365,7 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
if (unlikely((flags & CO_RFL_TRY_HARDER) &&
!(conn->flags & CO_FL_SOCK_RD_SH) &&
!count)) {
/* we've read exactly what was being asked for, which is loewr
/* we've read exactly what was being asked for, which is lower
* than a full buffer, and the caller wants us to really check
* if there's something after. This happens in the context of
* SSL where the lib reads in tiny chunks without offering the

View File

@ -1188,7 +1188,7 @@ void trace_parse_cmds(void)
}
}
/* parse a "trace" statement in the "global" section, returns 1 if a message is returned, otherwise zero */
/* parse a "trace" statement in the "global" section, returns -1 on error, zero otherwise */
static int cfg_parse_trace(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,
char **err)

View File

@ -258,6 +258,7 @@ int init_wdt_per_thread()
fail1:
per_thread_wd_ctx[tid].timer = TIMER_INVALID;
ha_warning("Failed to setup watchdog timer for thread %u, disabling lockup detection.\n", tid);
/* don't fail to start just for this */
return 1;
}