static inline
char *wrapper_getprocname(void)
{
- int nesting = URCU_TLS(procname_nesting);
+ int nesting = CMM_LOAD_SHARED(URCU_TLS(procname_nesting));
if (caa_unlikely(nesting >= PROCNAME_NESTING_MAX))
return "<unknown>";
if (caa_unlikely(!URCU_TLS(cached_procname)[nesting][0])) {
CMM_STORE_SHARED(URCU_TLS(procname_nesting), nesting + 1);
+ /* Increment nesting before updating cache. */
+ cmm_barrier();
lttng_ust_getprocname(URCU_TLS(cached_procname)[nesting]);
URCU_TLS(cached_procname)[nesting][LTTNG_UST_PROCNAME_LEN - 1] = '\0';
+ /* Decrement nesting after updating cache. */
+ cmm_barrier();
CMM_STORE_SHARED(URCU_TLS(procname_nesting), nesting);
}
return URCU_TLS(cached_procname)[nesting];
}
+/* Reset should not be called from a signal handler. */
void lttng_context_procname_reset(void)
{
- URCU_TLS(cached_procname)[1][0] = '\0';
+ CMM_STORE_SHARED(URCU_TLS(cached_procname)[1][0], '\0');
CMM_STORE_SHARED(URCU_TLS(procname_nesting), 1);
- URCU_TLS(cached_procname)[0][0] = '\0';
+ CMM_STORE_SHARED(URCU_TLS(cached_procname)[0][0], '\0');
CMM_STORE_SHARED(URCU_TLS(procname_nesting), 0);
}