PxTrapGetTaskProtection()

Get the protection set of a task.

APPLIES TO

1.0.0

SYNOPSIS
PxDataProtectSet_T *PxTrapGetTaskProtection(PxTask_t tId);
ARGUMENTS
tId

Task Id

RETURN VALUES
  • Pointer to the protection set

  • 0 in case of error

ERROR CODES

PXERR_TASK_ILLTASK

task ID tId is not valid

PXERR_REQUEST_INVALID_PARAMETER

called in an illegal context

DESCRIPTION

Returns a pointer to the actual protection set of the requested task. It may only be used in supervisor context with protection set PRS_TSK_KERNEL. This context is valid inside an application defined trap handler.

IMPLEMENTATION GUIDELINES
Before call
  • The parameter tId 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 a pointer to the task’s protection set or a null pointer if tId is not a valid task object (C).

Best Practice
  • The caller must be in supervisor mode.

SEE ALSO
USAGE
#include "pxdef.h"

PxDataProtectSet_T *pset = PxTrapGetTaskProtection(tId);

if (pset != 0) {
    // Handle Trap context
}
else {
    // Report error
}