Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make OS_strnlen public #928

Closed
jphickey opened this issue Mar 24, 2021 · 2 comments
Closed

Make OS_strnlen public #928

jphickey opened this issue Mar 24, 2021 · 2 comments
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The OS_strnlen() wrapper could be useful for apps, because strnlen is not a standardized function, but many times this behavior is needed/desired when reading fixed size string buffers.

An inline function exists in OSAL to provide a substitute but it is currently in an internal header.

Describe the solution you'd like
Move the function to the public header so apps can also use it.

Describe alternatives you've considered
Leave as is

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Mar 24, 2021
@skliper skliper added this to the 6.0.0 milestone Mar 24, 2021
@jphickey
Copy link
Contributor Author

Unfortunately the "quick fix" to expose this and just move the header had some unintended consequences, due increased dependencies in the CFE PSP files that used "osapi-common.h" causing them to fail to build coverage tests.

Two options:

  1. Forget about it and just have users who want this make their own wrapper to provide strnlen-like functionality
  2. Fix PSP coverage test stubs so they work again (doable of course, but requires coordinated merge, makes this less trivial)

@jphickey
Copy link
Contributor Author

OK - this actually breaks more than PSP, it affects sample_lib too. Basically anything that has stubbed out C libraries and/or string.h breaks due to the new dependency on memchr. It seemed simple but then reality got in the way....

The only way for OSAL to provide this in a practical sense and make it coverage-testable would be to make it non-inline - but that would have a negative performance impact, it would require stubs, all sorts of fallout.

My recommendation is to go with (1) - lets just leave it alone. Create your own local wrapper around memchr to get the equivalent function to strnlen where needed. Its simple enough that there isn't much lost in not having this consolidated to a single implementation.

jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
- Removed all index/pointer accesses of message map and routing table
- All references now via IDs and APIs
- Note SB still owns destination logic (unchanged linear linked list)
- Limited whitespace fixes for readability
- Resolved observed instances of variables not declared at the
  start of functions
- Cleaned comments
- Resolved potential double locks in CFE_SB_SendPrevSubs
- Route and message write to file no longer guaranteed in msgid
  order to maintain performance for large msgid space implementations
- Removed unused CFE_SB_FindGlobalMsgIdCnt
- Clarified CFE_PLATFORM_SB_MAX_MSG_IDS config param description
- Eliminated potential race in CFE_SB_PipeDeleteFull
- Individual destination removal debug events no longer reported
  during a CFE_SB_PipeDeleteFull
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
- Implementation for direct map and unsorted routing table
- Includes full coverage tests
- Removed msg key and route stack concepts from direct map
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
- Linking SBR with SB unit test, not stubbed
- Confirms matching functionality (with updates for
  intended changes)
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#928 and nasa#929 - Modularize software bus routing, add msg map hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants