Skip to content

Commit f26f323

Browse files
authored
Merge pull request #452 from CDKnightNASA/fix-308-createpipe_msgs
Fix #308, Improve SB create pipe error reporting
2 parents 3356da6 + 7d13f76 commit f26f323

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

fsw/cfe-core/src/inc/cfe_sb_events.h

+25-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
** and when you're done adding, set this to the highest EID you used. It may
4141
** be worthwhile to, on occasion, re-number the EID's to put them back in order.
4242
*/
43-
#define CFE_SB_MAX_EID 61
43+
#define CFE_SB_MAX_EID 63
4444

4545
/*
4646
** SB task event message ID's.
@@ -844,6 +844,30 @@
844844
**/
845845
#define CFE_SB_LEN_ERR_EID 61
846846

847+
/** \brief <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
848+
** \event <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
849+
**
850+
** \par Type: ERROR
851+
**
852+
** \par Cause:
853+
**
854+
** This error event message is issued when the #CFE_SB_CreatePipe API tries to create
855+
** a pipe with a name that is in use.
856+
**/
857+
#define CFE_SB_CR_PIPE_NAME_TAKEN_EID 62
858+
859+
/** \brief <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
860+
** \event <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
861+
**
862+
** \par Type: ERROR
863+
**
864+
** \par Cause:
865+
**
866+
** This error event message is issued when the #CFE_SB_CreatePipe API is unable to
867+
** create a queue because there are no queues free.
868+
**/
869+
#define CFE_SB_CR_PIPE_NO_FREE_EID 63
870+
847871

848872
#endif /* _cfe_sb_events_ */
849873

fsw/cfe-core/src/sb/cfe_sb_api.c

+19-5
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,27 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *
160160

161161
/* if OS_QueueCreate() failed because the pipe name passed in was already in use... */
162162
/* let's make sure we don't alter the user's pipe ID data */
163-
if (Status == CFE_OS_ERR_NAME_TAKEN){
164-
*PipeIdPtr = OriginalPipeIdParamValue;
165-
}
166-
167-
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
163+
switch(Status) {
164+
case OS_ERR_NAME_TAKEN:
165+
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NAME_TAKEN_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
166+
"CreatePipeErr:OS_QueueCreate failed, name taken (app=%s, name=%s)",
167+
CFE_SB_GetAppTskName(TskId,FullName), PipeName);
168+
169+
*PipeIdPtr = OriginalPipeIdParamValue;
170+
171+
break;
172+
case OS_ERR_NO_FREE_IDS:
173+
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NO_FREE_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
174+
"CreatePipeErr:OS_QueueCreate failed, no free id's (app=%s)",
175+
CFE_SB_GetAppTskName(TskId,FullName));
176+
177+
break;
178+
default:
179+
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
168180
"CreatePipeErr:OS_QueueCreate returned %d,app %s",
169181
(int)Status,CFE_SB_GetAppTskName(TskId,FullName));
182+
}/* end switch(Status) */
183+
170184
return CFE_SB_PIPE_CR_ERR;
171185
}/* end if */
172186

0 commit comments

Comments
 (0)