OS_GetStackStatus


C Specification

#include <nitro/os.h>

OSStackStatus OS_GetStackStatus( OSThread* thread );

Description

Checks for stack leaks with regards to a specified thread and obtains the status

This function checks a magic number that is preset in the top and bottom of the stack (in addition, if set, at a warning level that is set by the user), to see whether it is overwritten (if that portion is ever used).

If the magic number at the bottom of the stack is overwritten, it returns OS_STACK_OVERFLOW.
If the magic number at the top of the stack is overwritten, it returns OS_STACK_UNDERFLOW.
If the magic number at the warning level set by the user in the stack is overwritten, it returns OS_STACK_ABOUT_TO_OVERFLOW.

Determination occurs in this order so that OS_STACK_OVERFLOW is returned when both the top and bottom of the stack are overwritten.

If none of these condition are met (none of the magic numbers have been overwritten), it returns OS_STACK_NO_ERROR.

Arguments

thread The thread you want to check

Return Values

OS_STACK_OVERFLOW — The last magic number of the stack is rewritten.
OS_STACK_UNDERFLOW — The topmost magic number of the stack is rewritten.
OS_STACK_ABOUT_TO_OVERFLOW — The magic number of the warning level set by the user is rewritten.

When none of previous apply, returns OS_STACK_NO_ERROR (defined as 0).

See Also

OS_SetThreadStackWarningOffset, OS_CheckStack

Revision History

10/28/2004 Revised description of return values
04/29/2004 Initial Version