📄 streams.doc22.html
字号:
<h4 class="H3"><i><a name="80809" class="autotag">5.2.3 <b class="routine"><i class="routine">strlog</i></b><b>( )</b> </a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="80810" class="autotag"> </a>The <b class="routine"><i class="routine">strlog</i></b><b>( )</b>routine enables STREAMS drivers and modules to submit messages to the log device from within the STREAMS subsystem. The format of the call is:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80460" class="autotag">strlog ( short mid, short sid, char level, unsigned short flags, char *fmt, ...)</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="80461" class="autotag"> </a>The arguments to <b class="routine"><i class="routine">strlog</i></b><b>( )</b> are as follows:</p></dd></dl><dl class="margin"><dd><div class="Item"><a name="95448" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">mid</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95449" class="autotag"> </a>Identification number of the module or driver submitting the message. The number is the <b>mi_idnum</b> value from the <b>module_info</b> structure.</div><br></dd></dl><div class="Item"><a name="94789" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">sid</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95379" class="autotag"> </a>Sub-ID number such as the minor number of a device.</div><br></dd></dl><div class="Item"><a name="94790" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">level</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95380" class="autotag"> </a>Tracing level for selective screening of low priority messages. Larger values imply less important messages. </div><br></dd></dl><div class="Item"><a name="80465" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">flags</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95381" class="autotag"> </a>Valid flags are:</div><br></dd></dl><dl class="margin"><dd><div class="Item2"><a name="80466" class="autotag"> </a><b>SL_ERROR</b></div><dl class="margin"><dd><div class="Indent2"><a name="95382" class="autotag"> </a>Message is for error logger. The <b class="keyword">strerr</b> utility would receive this message.</div><br></dd></dl><div class="Item2"><a name="80574" class="autotag"> </a><b>SL_TRACE</b></div><dl class="margin"><dd><div class="Indent2"><a name="95383" class="autotag"> </a>Message is for trace logger. The <b class="keyword">strace</b> utility would receive this message.</div><br></dd></dl><div class="Item2"><a name="80575" class="autotag"> </a><b>SL_CONSOLE</b></div><dl class="margin"><dd><div class="Indent2"><a name="95384" class="autotag"> </a>Log message to console.</div><br></dd></dl><div class="Item2"><a name="80576" class="autotag"> </a><b>SL_FATAL</b></div><dl class="margin"><dd><div class="Indent2"><a name="95385" class="autotag"> </a>Error is fatal.</div><br></dd></dl><div class="Item2"><a name="80470" class="autotag"> </a><b>SL_WARN</b></div><dl class="margin"><dd><div class="Indent2"><a name="95386" class="autotag"> </a>Error is a warning</div><br></dd></dl><div class="Item2"><a name="80471" class="autotag"> </a><b>SL_NOTE</b></div><dl class="margin"><dd><div class="Indent2"><a name="95387" class="autotag"> </a>Error is a notice. </div><br></dd></dl></dd></dl></dd></dl><dl class="margin"><dd><p class="Body"><a name="80472" class="autotag"> </a>The <b class="routine"><i class="routine">strlog</i></b><b>( )</b> routine submits formatted messages to the log driver. The <b>flags</b> argument specifies the type of the message and where it is to be sent. The <b class="keyword">strace</b> application receives messages with the <b>SL_TRACE</b> flag set from the log driver and sends them to the log file. The <b class="keyword">strerr</b> application receives error messages from the log driver and appends them to the error log file. </p></dd></dl></dd></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="80473" class="autotag">Examples</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="84876" class="autotag"> </a>This routine writes the string to the log driver. An <b class="keyword">strace</b> application tracing for this moduleID of <b>mid</b> and <b>sub-ID</b> of 0 receives the string "This is a strace test". </p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80593" class="autotag">strlog (mid, 0, 1, SL_TRACE,"This is a strace test\n");</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="84882" class="autotag"> </a>This routine writes the string to the log driver. An <b class="keyword">strerr</b> application receives the string "This is a strerr test". </p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80475" class="autotag">strlog (mid, 0, 1, SL_ERROR,"This is a strerr test\n");</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="84888" class="autotag"> </a>This statement writes the string to both the <b class="keyword">strace</b> and <b class="keyword">strerr</b> applications. </p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80477" class="autotag">strlog (mid,0,1,SL_TRACE|SL_ERROR,"This is a test\n");</a></pre></dd></dl></dd></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="../../icons/contents.gif"></a><a href="streams.doc21.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc23.html"><img border="0" alt="[Next]" src="../../icons/next.gif"></a></p></body></html><!---This file generated April 10, 1998, 12:25PM PDTby WRS Documentation (jeff), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 3.5.0 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -