VxWorks Reference Manual : Libraries

taskInfo

NAME

taskInfo - task information library

ROUTINES

taskOptionsSet( ) - change task options
taskOptionsGet( ) - examine task options
taskRegsGet( ) - get a task's registers from the TCB
taskRegsSet( ) - set a task's registers
taskName( ) - get the name associated with a task ID
taskNameToId( ) - look up the task ID associated with a task name
taskIdDefault( ) - set the default task ID
taskIsReady( ) - check if a task is ready to run
taskIsSuspended( ) - check if a task is suspended
taskIdListGet( ) - get a list of active task IDs

DESCRIPTION

This library provides a programmatic interface for obtaining task information.

Task information is crucial as a debugging aid and user-interface convenience during the development cycle of an application. The routines taskOptionsGet( ), taskRegsGet( ), taskName( ), taskNameToId( ), taskIsReady( ), taskIsSuspended( ), and taskIdListGet( ) are used to obtain task information. Three routines -- taskOptionsSet( ), taskRegsSet( ), and taskIdDefault( ) -- provide programmatic access to debugging features.

The chief drawback of using task information is that tasks may change their state between the time the information is gathered and the time it is utilized. Information provided by these routines should therefore be viewed as a snapshot of the system, and not relied upon unless the task is consigned to a known state, such as suspended.

Task management and control routines are provided by taskLib. Higher-level task information display routines are provided by taskShow.

INCLUDE FILES

taskLib.h

SEE ALSO

taskInfo, taskLib, taskShow, taskHookLib, taskVarLib, semLib, kernelLib, VxWorks Programmer's Guide: Basic OS


Libraries : Routines

taskOptionsSet( )

NAME

taskOptionsSet( ) - change task options

SYNOPSIS

STATUS taskOptionsSet
    (
    int tid,       /* task ID */
    int mask,      /* bit mask of option bits to unset */
    int newOptions /* bit mask of option bits to set */
    )

DESCRIPTION

This routine changes the execution options of a task. The only option that can be changed after a task has been created is:

VX_UNBREAKABLE
do not allow breakpoint debugging.

For definitions, see taskLib.h.

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskInfo, taskOptionsGet( )


Libraries : Routines

taskOptionsGet( )

NAME

taskOptionsGet( ) - examine task options

SYNOPSIS

STATUS taskOptionsGet
    (
    int   tid,     /* task ID */
    int * pOptions /* task's options */
    )

DESCRIPTION

This routine gets the current execution options of the specified task. The option bits returned by this routine indicate the following modes:

VX_FP_TASK
execute with floating-point coprocessor support.

VX_PRIVATE_ENV
include private environment support (see envLib).

VX_NO_STACK_FILL
do not fill the stack for use by checkstack( ).

VX_UNBREAKABLE
do not allow breakpoint debugging.

For definitions, see taskLib.h.

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskInfo, taskOptionsSet( )


Libraries : Routines

taskRegsGet( )

NAME

taskRegsGet( ) - get a task's registers from the TCB

SYNOPSIS

STATUS taskRegsGet
    (
    int       tid,  /* task ID */
    REG_SET * pRegs /* put register contents here */
    )

DESCRIPTION

This routine gathers task information kept in the TCB. It copies the contents of the task's registers to the register structure pRegs.

NOTE

This routine only works well if the task is known to be in a stable, non-executing state. Self-examination, for instance, is not advisable, as results are unpredictable.

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskInfo, taskSuspend( ), taskRegsSet( )


Libraries : Routines

taskRegsSet( )

NAME

taskRegsSet( ) - set a task's registers

SYNOPSIS

STATUS taskRegsSet
    (
    int       tid,  /* task ID */
    REG_SET * pRegs /* get register contents from here */
    )

DESCRIPTION

This routine loads a specified register set pRegs into a specified task's TCB.

NOTE

This routine only works well if the task is known not to be in the ready state. Suspending the task before changing the register set is recommended.

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskInfo, taskSuspend( ), taskRegsGet( )


Libraries : Routines

taskName( )

NAME

taskName( ) - get the name associated with a task ID

SYNOPSIS

char *taskName
    (
    int tid /* ID of task whose name is to be found */
    )

DESCRIPTION

This routine returns a pointer to the name of a task of a specified ID, if the task has a name. If the task has no name, it returns an empty string.

RETURNS

A pointer to the task name, or NULL if the task ID is invalid.

SEE ALSO

taskInfo


Libraries : Routines

taskNameToId( )

NAME

taskNameToId( ) - look up the task ID associated with a task name

SYNOPSIS

int taskNameToId
    (
    char * name /* task name to look up */
    )

DESCRIPTION

This routine returns the ID of the task matching a specified name. Referencing a task in this way is inefficient, since it involves a search of the task list.

RETURNS

The task ID, or ERROR if the task is not found.

ERRNO

S_taskLib_NAME_NOT_FOUND

SEE ALSO

taskInfo


Libraries : Routines

taskIdDefault( )

NAME

taskIdDefault( ) - set the default task ID

SYNOPSIS

int taskIdDefault
    (
    int tid /* user supplied task ID; if 0, return default */
    )

DESCRIPTION

This routine maintains a global default task ID. This ID is used by libraries that want to allow a task ID argument to take on a default value if the user did not explicitly supply one.

If tid is not zero (i.e., the user did specify a task ID), the default ID is set to that value, and that value is returned. If tid is zero (i.e., the user did not specify a task ID), the default ID is not changed and its value is returned. Thus the value returned is always the last task ID the user specified.

RETURNS

The most recent non-zero task ID.

SEE ALSO

taskInfo, dbgLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

taskIsReady( )

NAME

taskIsReady( ) - check if a task is ready to run

SYNOPSIS

BOOL taskIsReady
    (
    int tid /* task ID */
    )

DESCRIPTION

This routine tests the status field of a task to determine if it is ready to run.

RETURNS

TRUE if the task is ready, otherwise FALSE.

SEE ALSO

taskInfo


Libraries : Routines

taskIsSuspended( )

NAME

taskIsSuspended( ) - check if a task is suspended

SYNOPSIS

BOOL taskIsSuspended
    (
    int tid /* task ID */
    )

DESCRIPTION

This routine tests the status field of a task to determine if it is suspended.

RETURNS

TRUE if the task is suspended, otherwise FALSE.

SEE ALSO

taskInfo


Libraries : Routines

taskIdListGet( )

NAME

taskIdListGet( ) - get a list of active task IDs

SYNOPSIS

int taskIdListGet
    (
    int idList[], /* array of task IDs to be filled in */
    int maxTasks  /* max tasks idList can accommodate */
    )

DESCRIPTION

This routine provides the calling task with a list of all active tasks. An unsorted list of task IDs for no more than maxTasks tasks is put into idList.

WARNING

Kernel rescheduling is disabled with taskLock( ) while tasks are filled into the idList. There is no guarantee that all the tasks are valid or that new tasks have not been created by the time this routine returns.

RETURNS

The number of tasks put into the ID list.

SEE ALSO

taskInfo