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

Fix #308, Improve SB create pipe error reporting #452

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion fsw/cfe-core/src/inc/cfe_sb_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
** and when you're done adding, set this to the highest EID you used. It may
** be worthwhile to, on occasion, re-number the EID's to put them back in order.
*/
#define CFE_SB_MAX_EID 61
#define CFE_SB_MAX_EID 63

/*
** SB task event message ID's.
Expand Down Expand Up @@ -858,6 +858,30 @@
**/
#define CFE_SB_LEN_ERR_EID 61

/** \brief <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
** \event <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_CreatePipe API tries to create
** a pipe with a name that is in use.
**/
#define CFE_SB_CR_PIPE_NAME_TAKEN_EID 62

/** \brief <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
** \event <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_CreatePipe API is unable to
** create a queue because there are no queues free.
**/
#define CFE_SB_CR_PIPE_NO_FREE_EID 63


#endif /* _cfe_sb_events_ */

Expand Down
24 changes: 19 additions & 5 deletions fsw/cfe-core/src/sb/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,27 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *

/* if OS_QueueCreate() failed because the pipe name passed in was already in use... */
/* let's make sure we don't alter the user's pipe ID data */
if (Status == CFE_OS_ERR_NAME_TAKEN){
*PipeIdPtr = OriginalPipeIdParamValue;
}

CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
switch(Status) {
case OS_ERR_NAME_TAKEN:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NAME_TAKEN_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:OS_QueueCreate failed, name taken (app=%s, name=%s)",
CFE_SB_GetAppTskName(TskId,FullName), PipeName);

*PipeIdPtr = OriginalPipeIdParamValue;

break;
case OS_ERR_NO_FREE_IDS:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NO_FREE_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:OS_QueueCreate failed, no free id's (app=%s)",
CFE_SB_GetAppTskName(TskId,FullName));

break;
default:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
CDKnightNASA marked this conversation as resolved.
Show resolved Hide resolved
"CreatePipeErr:OS_QueueCreate returned %d,app %s",
(int)Status,CFE_SB_GetAppTskName(TskId,FullName));
}/* end switch(Status) */

return CFE_SB_PIPE_CR_ERR;
}/* end if */

Expand Down