Skip to content

Conversation

rruuaanng
Copy link
Contributor

Add a set of 'SYS_PORT_TRACK_K_*' wrapper macros for visible access to the global tracking list, and a macro 'SYS_PORT_TRACK_FOREACH' for iterating over the tracking list.

@rruuaanng rruuaanng marked this pull request as ready for review March 8, 2025 11:59
@zephyrbot zephyrbot added Release Notes To be mentioned in the release notes area: Tracing Tracing labels Mar 8, 2025
@rruuaanng rruuaanng removed the Release Notes To be mentioned in the release notes label Mar 8, 2025
@zephyrbot zephyrbot added the Release Notes To be mentioned in the release notes label Mar 8, 2025
@nashif nashif assigned nashif and unassigned kartben and fabiobaltieri Mar 8, 2025
Copy link

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 14, 2025
@ubieda
Copy link
Member

ubieda commented Jul 14, 2025

@rruuaanng Can you look at the CI failure?

@ubieda ubieda added this to the v4.3.0 milestone Jul 14, 2025
@ubieda ubieda removed the Stale label Jul 14, 2025
@rruuaanng
Copy link
Contributor Author

rruuaanng commented Jul 15, 2025

@ubieda It looks like it's not an issue, the warning is caused by my syntax.

/*
  *   SYS_PORT_TRACK_FOREACH(k_mutex, m) {
  *       ...
  *   }
  */
#define SYS_PORT_TRACK_FOREACH(object, var)		\
	for (struct object *var = _track_list_##object	\
               ; var != NULL; var++)
BRACES

include/zephyr/tracing/tracking.h:67  braces {} are required around if/while/for/else

@rruuaanng rruuaanng requested a review from ubieda July 15, 2025 08:21
@ubieda
Copy link
Member

ubieda commented Jul 15, 2025

@ubieda It looks like it's not an issue, the warning is caused by my syntax.

/*
  *   SYS_PORT_TRACK_FOREACH(k_mutex, m) {
  *       ...
  *   }
  */
#define SYS_PORT_TRACK_FOREACH(object, var)		\
	for (struct object *var = _track_list_##object	\
               ; var != NULL; var++)
BRACES

include/zephyr/tracing/tracking.h:67  braces {} are required around if/while/for/else

Try adding it under the ForEachMacros list:

zephyr/.clang-format

Lines 34 to 85 in 0b1cff2

ForEachMacros:
- 'ARRAY_FOR_EACH'
- 'ARRAY_FOR_EACH_PTR'
- 'FOR_EACH'
- 'FOR_EACH_FIXED_ARG'
- 'FOR_EACH_IDX'
- 'FOR_EACH_IDX_FIXED_ARG'
- 'FOR_EACH_NONEMPTY_TERM'
- 'FOR_EACH_FIXED_ARG_NONEMPTY_TERM'
- 'RB_FOR_EACH'
- 'RB_FOR_EACH_CONTAINER'
- 'SYS_DLIST_FOR_EACH_CONTAINER'
- 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
- 'SYS_DLIST_FOR_EACH_NODE'
- 'SYS_DLIST_FOR_EACH_NODE_SAFE'
- 'SYS_SEM_LOCK'
- 'SYS_SFLIST_FOR_EACH_CONTAINER'
- 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
- 'SYS_SFLIST_FOR_EACH_NODE'
- 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
- 'SYS_SLIST_FOR_EACH_CONTAINER'
- 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
- 'SYS_SLIST_FOR_EACH_NODE'
- 'SYS_SLIST_FOR_EACH_NODE_SAFE'
- '_WAIT_Q_FOR_EACH'
- 'Z_FOR_EACH'
- 'Z_FOR_EACH_ENGINE'
- 'Z_FOR_EACH_EXEC'
- 'Z_FOR_EACH_FIXED_ARG'
- 'Z_FOR_EACH_FIXED_ARG_EXEC'
- 'Z_FOR_EACH_IDX'
- 'Z_FOR_EACH_IDX_EXEC'
- 'Z_FOR_EACH_IDX_FIXED_ARG'
- 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
- 'Z_GENLIST_FOR_EACH_CONTAINER'
- 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
- 'Z_GENLIST_FOR_EACH_NODE'
- 'Z_GENLIST_FOR_EACH_NODE_SAFE'
- 'STRUCT_SECTION_FOREACH'
- 'STRUCT_SECTION_FOREACH_ALTERNATE'
- 'TYPE_SECTION_FOREACH'
- 'K_SPINLOCK'
- 'COAP_RESOURCE_FOREACH'
- 'COAP_SERVICE_FOREACH'
- 'COAP_SERVICE_FOREACH_RESOURCE'
- 'HTTP_RESOURCE_FOREACH'
- 'HTTP_SERVER_CONTENT_TYPE_FOREACH'
- 'HTTP_SERVICE_FOREACH'
- 'HTTP_SERVICE_FOREACH_RESOURCE'
- 'I3C_BUS_FOR_EACH_I3CDEV'
- 'I3C_BUS_FOR_EACH_I2CDEV'
- 'MIN_HEAP_FOREACH'

Copy link

ubieda
ubieda previously approved these changes Jul 16, 2025
@ubieda
Copy link
Member

ubieda commented Jul 22, 2025

Would you mind rebasing to resolve conflicts?

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

ubieda
ubieda previously approved these changes Sep 24, 2025
edersondisouza
edersondisouza previously approved these changes Sep 24, 2025
Copy link
Contributor

@edersondisouza edersondisouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curiosity - do you have use cases for accessing these lists from inside Zephyr? I've imagined they would be used by external tools only, so they would only care about the symbol name.

Add a set of `SYS_PORT_TRACK_K_*` wrapper macros for
visible access to the global tracking list, and a macro
`SYS_PORT_TRACK_FOR_EACH` for iterating over the tracking list.

Signed-off-by: James Roy <[email protected]>
Copy link

sonarqubecloud bot commented Oct 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Coding Guidelines Coding guidelines and style area: Linters area: Tracing Tracing Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants