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

Improve consistency when working with OSAL status codes #1755

Closed
jphickey opened this issue Aug 3, 2021 · 2 comments · Fixed by #1756 or #1839
Closed

Improve consistency when working with OSAL status codes #1755

jphickey opened this issue Aug 3, 2021 · 2 comments · Fixed by #1756 or #1839
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Aug 3, 2021

Is your feature request related to a problem? Please describe.
Quite often in the CFE implementation, OSAL status codes are mixed with CFE status codes, often times sharing a single stack variable to hold either one, and even switching back and forth.

To improve clarity and consistency, OSAL status codes should be stored in a separate stack variable from the CFE status codes. Ideally, in the future, these should also migrate to a separate type (e.g. osal_status_t, as in nasa/osal#1108, or CFE_Status_t, as in #921).

Describe the solution you'd like

  • Anywhere that an OSAL status code is stored on the stack, make a separate variable.
  • Always use a consistent name for that variable, e.g. OsStatus (as opposed to "Status" or "ReturnCode" etc, which are vague).
  • Avoid intermixing CFE status codes and OSAL status codes whenever possible (there will still be some times its necessary, when calling generic functions). When it is necessary, make conversions between these types explicit/obvious via comments and/or type casting.
  • When printing OSAL status codes in a log or event message, print it as long decimal (%ld), not as hex as the CFE status codes are. This is because OSAL defines its status codes as decimal numbers, so logs/events should match this.

Additional context
This can be considered a prerequisite to #921 (cannot introduce a unique CFE_Status_t type until it is no longer being used to store OSAL codes).

This would be a fix for next release (not 7.0.0).

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Aug 3, 2021
jphickey added a commit to jphickey/cFE that referenced this issue Aug 3, 2021
Ensure a separate stack variable, always named "OsStatus", is used
to hold the result of an OSAL API call.  Do not use the same variable
that is used to store a CFE status code.
@zanzaben
Copy link
Contributor

zanzaben commented Aug 3, 2021

This is yet another addition to the growing list of problems due to OSAL error codes. #1676 #1672 #1723 #1675 #1599.

jphickey added a commit to jphickey/cFE that referenced this issue Aug 3, 2021
Ensure a separate stack variable, always named "OsStatus", is used
to hold the result of an OSAL API call.  Do not use the same variable
that is used to store a CFE status code.
@jphickey
Copy link
Contributor Author

jphickey commented Aug 3, 2021

This is yet another addition to the growing list of problems due to OSAL error codes. #1676 #1672 #1723 #1675 #1599.

Yes, I consider this related to #1676, as this addresses part of that one - however that previous issue was more general in nature. This issue just deals with specifically having a separate variable for OSAL status vs. CFE status.

jphickey added a commit to jphickey/cFE that referenced this issue Aug 4, 2021
Ensure a separate stack variable, always named "PspStatus", is used
to hold the result of a PSP API call.  Do not use the same variable
that is used to store a CFE status code.
jphickey added a commit to jphickey/cFE that referenced this issue Aug 9, 2021
Ensure a separate stack variable, always named "OsStatus", is used
to hold the result of an OSAL API call.  Do not use the same variable
that is used to store a CFE status code.
jphickey added a commit to jphickey/cFE that referenced this issue Aug 9, 2021
Ensure a separate stack variable, always named "PspStatus", is used
to hold the result of a PSP API call.  Do not use the same variable
that is used to store a CFE status code.
jphickey added a commit to jphickey/cFE that referenced this issue Aug 17, 2021
Ensure a separate stack variable, always named "OsStatus", is used
to hold the result of an OSAL API call.  Do not use the same variable
that is used to store a CFE status code.
jphickey added a commit to jphickey/cFE that referenced this issue Aug 17, 2021
Ensure a separate stack variable, always named "PspStatus", is used
to hold the result of a PSP API call.  Do not use the same variable
that is used to store a CFE status code.
astrogeco added a commit that referenced this issue Aug 18, 2021
@skliper skliper added this to the 7.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants