1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>OS_GetStackStatus</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_GetStackStatus <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <nitro/os.h></CODE></PRE> 16 <PRE><CODE>OSStackStatus OS_GetStackStatus( const OSThread* thread ); 17 </CODE></PRE> 18</DL> 19<H2>Arguments</H2> 20<TABLE border="1" width="100%"> 21 <TBODY> 22 <TR> 23 <TD width="13%"><EM><STRONG>thread</STRONG></EM></TD> 24 <TD width="87%">The thread to be checked.</TD> 25 </TR> 26 </TBODY> 27</TABLE> 28<H2>Return Values</H2> 29<P><code>OS_STACK_OVERFLOW</code> — The magic number at the bottom of the stack is rewritten.<BR><code>OS_STACK_UNDERFLOW</code> — The magic number at the top of the stack is rewritten.<BR><code>OS_STACK_ABOUT_TO_OVERFLOW</code> — The warning level magic number set by the user is rewritten.</P> 30<P>When none of the previous cases apply, returns <code>OS_STACK_NO_ERROR</code> (defined as <code>0</code>).</P> 31<H2>Description</H2> 32<P>Checks for stack leaks with regards to a specified thread and obtains the status</P> 33<P>This function checks a magic number that is preset in the top and bottom (in addition, a warning level if set by the user) of the stack, to see whether it is overwritten (if that portion is ever used).</P> 34<P>If the magic number at the bottom of the stack is overwritten, it returns <code>OS_STACK_OVERFLOW</code>.<br />If the magic number at the top of the stack is overwritten, it returns <code>OS_STACK_UNDERFLOW</code>.<br />If the magic number at the warning level set by the user in the stack is overwritten, it returns <code>OS_STACK_ABOUT_TO_OVERFLOW</code>.</P> 35<P>The stack is checked in this order so that <code>OS_STACK_OVERFLOW</code> is returned when both the top and bottom of the stack are overwritten. </P> 36<P>If none of these condition are met (none of the magic numbers have been overwritten), <CODE>OS_STACK_NO_ERROR</CODE> is returned. <CODE>OS_STACK_NO_ERROR</CODE> is defined as 0, so whether an error has occurred can be determined by whether the value is 0 or non-zero.</P> 37 38<H2>See Also</H2> 39<P><A href="OS_SetThreadStackWarningOffset.html"><CODE>OS_SetThreadStackWarningOffset</CODE></A></code>, <code><A href="OS_CheckStack.html"><CODE>OS_CheckStack</CODE></A></P> 40<H2>Revision History</H2> 41<P>2005/09/06 Added const to OSThread* type variables.<BR> 2004/10/28 Revised return value description.<BR> 2004/04/29 Initial version.</P> 42<hr><p>CONFIDENTIAL</p></body> 43</HTML>