⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errnolib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/errnoLib.html - generated by refgen from errnoLib.c --> <title> errnoLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>errnoLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>errnoLib</strong> - error status library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./errnoLib.html#errnoGet">errnoGet</a>(&nbsp;)</b>  -  get the error status value of the calling task<br><b><a href="./errnoLib.html#errnoOfTaskGet">errnoOfTaskGet</a>(&nbsp;)</b>  -  get the error status value of a specified task<br><b><a href="./errnoLib.html#errnoSet">errnoSet</a>(&nbsp;)</b>  -  set the error status value of the calling task<br><b><a href="./errnoLib.html#errnoOfTaskSet">errnoOfTaskSet</a>(&nbsp;)</b>  -  set the error status value of a specified task<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains routines for setting and examining the error statusvalues of tasks and interrupts.  Most VxWorks functions return ERROR whenthey detect an error, or NULL in the case of functions returning pointers.In addition, they set an error status that elaborates the nature of theerror.<p>This facility is compatible with the UNIX error status mechanism in whicherror status values are set in the global variable <b>errno</b>.  However, inVxWorks there are many task and interrupt contexts that share common memoryspace and therefore conflict in their use of this global variable.VxWorks resolves this in two ways:<table></tr><tr valign=top><td>(1)<td>For tasks, VxWorks maintains the <b>errno</b> value for each contextseparately, and saves and restores the value of <b>errno</b> with every contextswitch.  The value of <b>errno</b> for a non-executing task is stored in thetask's TCB.  Thus, regardless of task context, code can always referenceor modify <b>errno</b> directly.</tr><tr valign=top><td>(2)<td>For interrupt service routines, VxWorks saves and restores <b>errno</b> onthe interrupt stack as part of the interrupt enter and exit code providedautomatically with the <b><a href="./intArchLib.html#intConnect">intConnect</a>(&nbsp;)</b> facility.   Thus, interrupt serviceroutines can also reference or modify <b>errno</b> directly.</table><p>The <b>errno</b> facility is used throughout VxWorks for error reporting.  Insituations where a lower-level routine has generated an error, by convention,higher-level routines propagate the same error status, leaving <b>errno</b>with the value set at the deepest level.  Developers are encouraged to usethe same mechanism for application modules where appropriate.<p></blockquote><h4>ERROR STATUS VALUES</h4><blockquote><p>An error status is a 4-byte integer.  By convention, the most significanttwo bytes are the module number, which indicates the module in which theerror occurred.  The lower two bytes indicate the specific error withinthat module.  Module number 0 is reserved for UNIX error numbers so thatvalues from the UNIX <b>errno.h</b> header file can be set and tested withoutmodification.  Module numbers 1-500 decimal are reserved for VxWorksmodules.  These are defined in <b>vwModNum.h</b>.  All other module numbers areavailable to applications.<p></blockquote><h4>PRINTING ERROR STATUS VALUES</h4><blockquote><p>VxWorks can include a special symbol table called <b>statSymTbl</b>which <b><a href="./usrLib.html#printErrno">printErrno</a>(&nbsp;)</b> uses to print human-readable error messages.<p>This table is created with the tool makeStatTbl, foundin <b>host/<i>hostOs</i>/bin</b>.This tool reads all the .h files in a specified directory and generates aC-language file, which generates a symbol table when compiled.  Each symbolconsists of an error status value and its definition, which was obtainedfrom the header file.<p>For example, suppose the header file <b>target/h/myFile.h</b> contains the line:<pre>    #define S_myFile_ERROR_TOO_MANY_COOKS       0x230003</pre>The table <b>statSymTbl</b> is created by first running:<p>On Unix:<pre>    makeStatTbl target/h &gt; statTbl.c</pre>On Windows:<pre>    makeStatTbl target/h</pre>This creates a file <b>statTbl.c</b> in the current directory, which, whencompiled, generates <b>statSymTbl</b>.  The table is then linked in withVxWorks.  Normally, these steps are performed automatically by the makefilein <b>target/src/usr</b>.<p>If the user now types from the VxWorks shell:<pre>    -&gt; printErrno 0x230003</pre>The <b><a href="./usrLib.html#printErrno">printErrno</a>(&nbsp;)</b> routine would respond:<pre>    S_myFile_ERROR_TOO_MANY_COOKS</pre>The makeStatTbl tool looks for error status lines of the form:<pre>    #define S_xxx  &lt;n&gt;</pre>where <i>xxx</i> is any string, and <i>n</i> is any number.All VxWorks status lines are of the form:<pre>    #define S_thisFile_MEANINGFUL_ERROR_MESSAGE   0xnnnn</pre>where <i>thisFile</i> is the name of the module.<p>This facility is available to the user by adding header files withstatus lines of the appropriate forms and remaking VxWorks.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p>The file <b>vwModNum.h</b> contains the module numbers for every VxWorks module.The include file for each module contains the error numbers which that modulecan generate.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./usrLib.html#printErrno">printErrno</a>(&nbsp;)</b>, makeStatTbl,<i>VxWorks Programmer's Guide: Basic OS </i><hr><a name="errnoGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>errnoGet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>errnoGet(&nbsp;)</strong> - get the error status value of the calling task</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int errnoGet (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the error status stored in <b>errno</b>.It is provided for compatibility with previous versions of VxWorks andsimply accesses <b>errno</b> directly.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The error status value contained in <b>errno</b>.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./errnoLib.html#top">errnoLib</a></b>, <b><a href="./errnoLib.html#errnoSet">errnoSet</a>(&nbsp;)</b>, <b><a href="./errnoLib.html#errnoOfTaskGet">errnoOfTaskGet</a>(&nbsp;)</b><hr><a name="errnoOfTaskGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>errnoOfTaskGet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>errnoOfTaskGet(&nbsp;)</strong> - get the error status value of a specified task</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int errnoOfTaskGet    (    int taskId                /* task ID, 0 means current task */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the error status most recently set for a specified task.If <i>taskId</i> is zero, the calling task is assumed, and the value currentlyin <b>errno</b> is returned.<p>This routine is provided primarily for debugging purposes.  Normally,tasks access <b>errno</b> directly to set and get their own error status values.<p></blockquote><h4>RETURNS</h4><blockquote><p>The error status of the specified task, or ERROR if the task doesnot exist.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./errnoLib.html#top">errnoLib</a></b>, <b><a href="./errnoLib.html#errnoSet">errnoSet</a>(&nbsp;)</b>, <b><a href="./errnoLib.html#errnoGet">errnoGet</a>(&nbsp;)</b><hr><a name="errnoSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>errnoSet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>errnoSet(&nbsp;)</strong> - set the error status value of the calling task</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS errnoSet    (    int errorValue            /* error status value to set */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the <b>errno</b> variable with a specified error status.It is provided for compatibility with previous versions of VxWorks andsimply accesses <b>errno</b> directly.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the interrupt nest level is too deep.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./errnoLib.html#top">errnoLib</a></b>, <b><a href="./errnoLib.html#errnoGet">errnoGet</a>(&nbsp;)</b>, <b><a href="./errnoLib.html#errnoOfTaskSet">errnoOfTaskSet</a>(&nbsp;)</b><hr><a name="errnoOfTaskSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>errnoOfTaskSet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>errnoOfTaskSet(&nbsp;)</strong> - set the error status value of a specified task</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS errnoOfTaskSet    (    int taskId,               /* task ID, 0 means current task */    int errorValue            /* error status value */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the error status for a specified task.If <i>taskId</i> is zero, the calling task is assumed, and <b>errno</b> is set withthe specified error status.<p>This routine is provided primarily for debugging purposes.  Normally,tasks access <b>errno</b> directly to set and get their own error status values.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the task does not exist.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./errnoLib.html#top">errnoLib</a></b>, <b><a href="./errnoLib.html#errnoSet">errnoSet</a>(&nbsp;)</b>, <b><a href="./errnoLib.html#errnoOfTaskGet">errnoOfTaskGet</a>(&nbsp;)</b></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -