PxSysInfoGetTaskInfo()
Function to get task info.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxError_t PxSysInfoGetTaskInfo (PxInfoTask_t *TaskInfo, PxTask_t TaskId);
- ARGUMENTS
|
|
|
- RETURN VALUES
-
-
PXROS error code
-
- ERROR CODES
-
PXERR_PROT_PERMISSION
The task has no write permission on the
TaskInfo
objectPXERR_TASK_ILLTASK
The given object is not a task object
- DESCRIPTION
-
PxSysInfoGetTaskInfo stores the contents of the task control block task into the info structure Taskinfo.
The structure TaskInfo has the following format:
typedef struct PxInfoTask_t { char *PxInfoTask_Name; // task's name PxUChar_t PxInfoTask_Priority; // task's priority PxError_t PxInfoTask_Error; // task's last error code PxTmode_t PxInfoTask_Mode; // Bitmask of task's mode PxInfoTaskState_t PxInfoTask_State; // task's state PxEvents_t PxInfoTask_SavedEvents; // task's saved events PxEvents_t PxInfoTask_EventMask; // events, the task is waiting for PxMc_t PxInfoTask_Mc; // task's default memory class PxOpool_t PxInfoTask_Opool; // task's default object pool PxMbx_t PxInfoTask_PrivateMailbox; // task's private mailbox PxInt_t PxInfoTask_ExtremeStackSize; // task's extreme stack level PxInt_t PxInfoTask_CurrentStackSize; // task's current stack level PxInt_t PxInfoTask_TotalStackSize; // task's total stack size PxInt_t PxInfoTask_AbortStackSize; // task's abort stack size PxTask_t PxInfoTask_Creator; // task's creator task PxUInt_t PxInfoTask_AccessRights; // task's access rights } PxInfoTask_t;
The task may be in one of the following states:
typedef enum { TaskState_Unknown, // unknown state TaskState_Ready, // task is ready TaskState_Waiting, // task is waiting TaskState_Waiting_PxAwaitEvents, // task is waiting for events TaskState_Waiting_PxMsgRcv, // task is waiting for a message TaskState_Waiting_PxObjReq, // task is requesting an object TaskState_Waiting_PxMcTakeBlk, // task is requesting a memory block TaskState_Suspended, // task is suspended TaskState_Suspended_PxAwaitEvents, // task is suspended while waiting for events TaskState_Suspended_PxMsgRcv, // task is suspended while waiting for a message TaskState_Suspended_PxObjReq, // task is suspended while requesting an object TaskState_Suspended_PxMcTakeBlk, // task is suspended while requesting a memory block } PxInfoTaskState_t;
There is a union available containing all sysinfo types:
typedef union { PxInfoMC_t McInfo; // memory class information struct PxInfoOpool_t OpoolInfo; // Opool information struct PxInfoMsg_t MsgInfo; // message information struct PxInfoMbx_t MbxInfo; // mailbox information struct PxInfoDelay_t DelayInfo; // delay object information struct PxInfoPe_t PeInfo; // periodic event information struct PxInfoTo_t ToInfo; // timeout object information struct PxInfoInterrupt_t InterruptInfo; // interrupt object information struct } PxObjInfo_T;
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
TaskInfo
must be a pointer to a valid data area. -
The parameter
TaskId
must be a valid task object id. This id may be-
the calling task’s own id read by calling
PxGetId()
(V) -
the return value of a
PxTaskCreate()
call (V) -
the result of a nameserver query (V)
-
part of a message sent by another task (V)
-
-
Additionally the task id may be checked with
PxTaskCheck()
(F).
-
- After call
-
-
The function returns
PXERR_NOERROR
if the system information could be delivered. Any other return value describes an error, which has to be interpreted (C).
-
- Best Practice
-
-
No restrictions
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxError_t err = PxSysInfoGetTaskInfo(&TaskInfo, taskId); if (err == PXERR_NOERROR) { // Handle info } else { // Report error }