 
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title><style type="text/css">
<!--
.style1 {font-size: 18px;font-weight: bold;font-family: Georgia, "Times New Roman", Times, serif;}
.style2 {font-size: 14px}
a{color:#0000cc;text-decoration:none}
a:visited{color:#0000cc;text-decoration:none}
.style3 {color: #660000}
-->
</style></head>
<body style="margin:0px 0px 0px 0px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#cccccc"><span class="style1" style="margin-left:5px">sys_syslog &nbsp;<span class="style2">[kernel/printk.c] </span></span></td>
  </tr>
  <tr>
    <td><p style="margin-left:22px;margin-top:0px"><br />
      Reads and/or clears kernel message ring buffer; sets <em>console_loglevel</em>. </p>
      <p style="margin-left:10px"><strong>Arguments</strong></p>
      <table width="100%" border="0" style="margin-left:20px; margin-right:20px">
        <tr>
          <td width="6%" valign="top"><em>eax</em></td>
          <td width="94%">103</td>
        </tr>
        <tr>
          <td valign="top"><em>ebx</em></td>
          <td>Action to take. It amy be one of the following: 
            <table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333">
              <tr>
                <td><table width="100%" border="0">
                    <tr>
                      <td width="4%" valign="top"><code>0</code></td>
                      <td width="96%"><code>Close the log.  Currently not implemented. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>1</code></td>
                      <td><code>Open the log. Currently not implemented. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>2</code></td>
                      <td><code>Read from the log. <br />
                      Waits until this kernel log buffer is nonempty, and then reads at most  <em>edx</em> bytes into the buffer pointed by <em>edx</em>. It returns the number of bytes  read. Bytes read from the log disappear from the log buffer: the information can  only be read once. This is the function executed by the kernel when a user  program reads <em>/proc/kmsg</em>. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>3</code></td>
                      <td><code>Read all messages remaining in the ring buffer.<br />
                      Read the last <em>ecx</em> bytes from the log buffer (nondestructively) into the buffer pointed by <em>edx</em>. (will not read more than was written into the buffer since the last 'clear ring  buffer' command (which does not clear the buffer at all)). It returns the number  of bytes read. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>4</code></td>
                      <td><code>Read and clear all messages remaining in the ring buffer.<br />
                      Does precisely the same as 3, but also executes the `clear ring buffer' command. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>5</code></td>
                      <td><code>Clear ring buffer.<br />
                      Executes the `clear ring buffer' command. <br />
                          <em>ecx</em> and <em>edx</em> are ignored. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>6</code></td>
                      <td><code>Disable printk's to console.<br />
                      Sets console loglevel to kernel panics only. <em>ecx</em> and <em>edx</em> are ignored. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>7</code></td>
                      <td><code>Enable printk's to console.<br />
                      Sets console loglevel to all except debugging messages. <em>ecx</em> and <em>edx</em> are ignored. </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>8</code></td>
                      <td><code>Set level of messages printed to console.<br />  
                          <br />
                      The kernel routine <em>printk</em>() will only print a message on the console, if  it has a loglevel less than the value of the variable <em>console_loglevel</em>.  This variable initially has the value DEFAULT_CONSOLE_LOGLEVEL, but is set  to 10 if the kernel command line contains the word `debug', and to 15 in case of  a kernel fault (the 10 and 15 are just silly, and equivalent to 8).<br />
                      <br />
                      </code><em>edx</em> should contain the desired loglevel value in range 1-8. <em>ecx</em> is ignored. <br />
                      Available loglevels are:
                        <table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333">
                          <tr>
                            <td><table width="100%" border="0">
                                <tr>
                                  <td width="20%" valign="top"><code>0 (KERN_EMERG)</code></td>
                                  <td width="80%"><code>System is unusable. </code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>1 (KERN_ALERT)</code></td>
                                  <td><code>Action must be taken immediately. </code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>2 (KERN_CRIT)</code></td>
                                  <td><code>Critical conditions.</code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>3 (KERN_ERR)</code></td>
                                  <td><code>Error conditions.</code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>4 (KERN_WARNING)</code></td>
                                  <td><code>Warning conditions.</code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>5 (KERN_NOTICE)</code></td>
                                  <td><code>Normal but significant condition.</code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>6 (KERN_INFO)</code></td>
                                  <td><code>Informational.</code></td>
                                </tr>
                                <tr>
                                  <td valign="top"><code>7 (KERN_DEBUG)</code></td>
                                  <td><code>Debug-level messages.</code></td>
                                </tr>
                            </table></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>9</code></td>
                      <td><code> Return number of unread characters in the log buffer. <span class="style3">*to be documented*</span> </code></td>
                    </tr>
                    <tr>
                      <td valign="top"><code>10</code></td>
                      <td><code>Return size of the log buffer. <span class="style3">*to be documented*</span> </code></td>
                    </tr>
                </table></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td valign="top"><em>ecx</em></td>
          <td>This parameter depends on the action taken <em>(ebx</em>). See above. </td>
        </tr>
        <tr>
          <td valign="top"><em>edx</em></td>
          <td>This parameter depends on the action taken <em>(ebx</em>). See above. </td>
        </tr>
      </table>
      <p style="margin-left:10px" ><strong>Return values</strong></p>
      <p style="margin-left:22px;margin-right:10px" >If the system call succeeds and ebx was specified as  2, 3 or 4 the return value is  the number of bytes read. Otherwise return values is 0. <br />
If the system call fails the return value is one of the following <em>errno</em> values:</p>
      <table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333;margin-left:22px;margin-right:22px">
        <tr>
          <td><table width="100%" border="0">
              <tr>
                <td width="10%" valign="top"><code>-EINVAL </code></td>
                <td width="90%"><code>Bad parameters. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>-EPERM </code></td>
                <td><code>An attempt was made to change console_loglevel or clear the kernel message ring  buffer by a process without root permissions. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>-ERESTARTSYS </code></td>
                <td><code>System call was interrupted by a signal; nothing was read. (This can be seen  only during a trace.) </code></td>
              </tr>
          </table></td>
        </tr>
      </table>
      <p style="margin-left:10px"><strong>Remarks</strong></p>
      <p style="margin-left:22px">n/a</p>
      <p style="margin-left:10px"><strong>Compatibility</strong></p>
    <p style="margin-left:22px">n/a</p></td>
  </tr>
</table>
</body></html>