summaryrefslogtreecommitdiffstats
path: root/src/fsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fsm.c')
-rw-r--r--src/fsm.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/fsm.c b/src/fsm.c
index eb457a17..4876c04f 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -108,8 +108,8 @@ void osmo_fsm_log_addr(bool log_addr)
/*! Enable or disable logging of timeout values for FSM instance state changes.
*
* By default, state changes are logged by state name only, omitting the timeout. When passing true, each state change
- * will also log the T number and the chosen timeout in seconds. osmo_fsm_inst_state_chg_keep_timer() will log remaining
- * timeout in millisecond precision.
+ * will also log the T number (or Osmocom-specific X number) and the chosen timeout in seconds.
+ * osmo_fsm_inst_state_chg_keep_timer() will log remaining timeout in millisecond precision.
*
* The default for this is false to reflect legacy behavior. Since various C tests that verify logging output already
* existed prior to this option, keeping timeout logging off makes sure that they continue to pass. Particularly,
@@ -205,9 +205,9 @@ static void fsm_tmr_cb(void *data)
{
struct osmo_fsm_inst *fi = data;
struct osmo_fsm *fsm = fi->fsm;
- uint32_t T = fi->T;
+ int32_t T = fi->T;
- LOGPFSM(fi, "Timeout of T%u\n", fi->T);
+ LOGPFSM(fi, "Timeout of " OSMO_T_FMT "\n", OSMO_T_FMT_ARGS(fi->T));
if (fsm->timer_cb) {
int rc = fsm->timer_cb(fi);
@@ -482,13 +482,13 @@ static int state_chg(struct osmo_fsm_inst *fi, uint32_t new_state,
if (fsm_log_timeouts) {
if (keep_timer && fi->timer.active && (osmo_timer_remaining(&fi->timer, NULL, &remaining) == 0))
- LOGPFSMSRC(fi, file, line, "State change to %s (keeping T%d, %ld.%03lds remaining)\n",
+ LOGPFSMSRC(fi, file, line, "State change to %s (keeping " OSMO_T_FMT ", %ld.%03lds remaining)\n",
osmo_fsm_state_name(fsm, new_state),
- fi->T, remaining.tv_sec, remaining.tv_usec / 1000);
+ OSMO_T_FMT_ARGS(fi->T), remaining.tv_sec, remaining.tv_usec / 1000);
else if (timeout_secs && !keep_timer)
- LOGPFSMSRC(fi, file, line, "State change to %s (T%d, %lus)\n",
+ LOGPFSMSRC(fi, file, line, "State change to %s (" OSMO_T_FMT ", %lus)\n",
osmo_fsm_state_name(fsm, new_state),
- T, timeout_secs);
+ OSMO_T_FMT_ARGS(T), timeout_secs);
else
LOGPFSMSRC(fi, file, line, "State change to %s (no timeout)\n",
osmo_fsm_state_name(fsm, new_state));
@@ -535,6 +535,10 @@ static int state_chg(struct osmo_fsm_inst *fi, uint32_t new_state,
* timer_cb. If passing timeout_secs == 0, it is recommended to also pass T ==
* 0, so that fi->T is reset to 0 when no timeout is invoked.
*
+ * Positive values for T are considered to be 3GPP spec compliant and appear in
+ * logging and VTY as "T1234", while negative values are considered to be
+ * Osmocom specific timers, represented in logging and VTY as "X1234".
+ *
* See also osmo_tdef_fsm_inst_state_chg() from the osmo_tdef API, which
* provides a unified way to configure and apply GSM style Tnnnn timers to FSM
* state transitions.
@@ -549,7 +553,9 @@ static int state_chg(struct osmo_fsm_inst *fi, uint32_t new_state,
* \param[in] fi FSM instance whose state is to change
* \param[in] new_state The new state into which we should change
* \param[in] timeout_secs Timeout in seconds (if !=0), maximum-clamped to 2147483647 seconds.
- * \param[in] T Timer number (if \ref timeout_secs != 0)
+ * \param[in] T Timer number, where positive numbers are considered to be 3GPP spec compliant timer numbers and are
+ * logged as "T1234", while negative numbers are considered Osmocom specific timer numbers logged as
+ * "X1234".
* \param[in] file Calling source file (from osmo_fsm_inst_state_chg macro)
* \param[in] line Calling source line (from osmo_fsm_inst_state_chg macro)
* \returns 0 on success; negative on error