 
<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;}
a{color:#0000cc;text-decoration:none}
a:visited{color:#0000cc;text-decoration:none}
.style2 {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">MSGCTL</span></td>
  </tr>
  <tr>
    <td><p style="margin-left:22px;margin-top:0px"><br />
      Perform the control operation specified by <em>edx</em> on the message queue with   identifier <em>ecx</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>ecx</em></td>
          <td width="94%">Message queue ID. </td>
        </tr>
        <tr>
          <td valign="top"><em>edx</em></td>
          <td>Command to perform. It may be one of the following:<br />
          <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 height="130"><table width="100%" border="0">
                <tr>
                  <td width="11%" valign="top"><code>IPC_STAT </code></td>
                  <td width="89%"><code>Copy information from the kernel data structure associated with <em>ecx</em> into the <em>msqid_ds</em> structure pointed to by<em> esi</em>. The caller must   have read permission on the message queue.<br />
                    <br />
                    </code>
                    <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><code>struc msqid_ds<br>
                          {<br />
.msg_perm        &nbsp;&nbsp;&nbsp;ipc_perm ; Ownership and permissions<br />
.msg_first       &nbsp;&nbsp;rd 1  ;	First message on queue, unused<br />
.msg_last        &nbsp;&nbsp;&nbsp;rd 1 ;	 Last message in queue, unused<br />
.msg_stime       &nbsp;&nbsp;rd 1 ;	Time of last MSGSND <br />
.msg_rtime       &nbsp;&nbsp;rd 1 ;	Time of last MSGRCV <br />
.msg_ctime       &nbsp;&nbsp;rd 1 ;	Time of last change<br />
.msg_lcbytes     rd 1<span class="style2"> </span>;<span class="style2"> *to be documented* </span><br />
.msg_lqbytes     rd 1 ;<span class="style2"> *to be documented* </span><br />
.msg_cbytes      &nbsp;rw 1 ;	Current number of bytes in                                      queue (non-standard)<br />
.msg_qnum              &nbsp;&nbsp;&nbsp;rw 1  ;	Current number of messages                                      in queue<br />
.msg_qbytes      &nbsp;rw 1  ;	Maximum number of bytes                                      allowed in queue <br />
.msg_lspid       &nbsp;&nbsp;rw 1  ;	PID of last MSGSND<br />
.msg_lrpid       &nbsp;&nbsp;rw 1  ;	PID of last MSGRCV<br /> 
}
<br>
                        <br>
                        struc ipc_perm<br>
                        {<br>
                        .key             &nbsp;rd 1<br>
                        .uid             &nbsp;rw 1<br>
                        .gid             &nbsp;rw 1<br>
                        .cuid            rw 1<br>
                        .cgid            rw 1<br>
                        .mode            rw 1 <br>
                        .seq             &nbsp;rw 1<br>
                        }
                        </code></td>
                      </tr>
                    </table>                    </td>
                </tr>
                <tr>
                  <td valign="top"><code>IPC_SET </code></td>
                  <td><code>Write the values of some members of the <em>msqid_ds</em> structure pointed to by <em>esi</em> to the kernel data structure associated with this message queue,   updating also its <em>msg_ctime</em> member. The following members of the   structure are updated: <em>msg_qbytes</em>, <em>msg_perm.uid</em>, <em>msg_perm.gid</em>, and (the least significant 9 bits of) <em>msg_perm.mode</em>.   The effective UID of the calling process must match the owner   (<em>msg_perm.uid</em>) or creator (<em>msg_perm.cuid</em>) of the message queue, or   the caller must be privileged. Appropriate privilege (the CAP_IPC_RESOURCE capability) is required to raise the <em>msg_qbytes</em> value beyond the system parameter MSGMNB. </code></td>
                </tr>
                <tr>
                  <td valign="top"><code>IPC_RMID </code></td>
                  <td><code>Immediately remove the message queue, awakening all waiting reader and   writer processes (with an error return -EIDRM).   The calling process must have appropriate privileges or its effective user ID   must be either that of the creator or owner of the message queue. </code></td>
                </tr>
                <tr>
                  <td valign="top"><code>IPC_INFO</code></td>
                  <td><code>Returns information about system-wide message queue limits and parameters in the <em>msginfo</em>   structure pointed to by <em>esi</em>: <br />  
                      <br />  
                    </code>
                    <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><code>struc msginfo<br>
                          {<br />
  .msgpool         rd 1<br />
  .msgmap          &nbsp;rd 1<br />
  .msgmax          &nbsp;rd 1<br />
  .msgmnb          &nbsp;rd 1<br />
  .msgmni          &nbsp;rd 1<br />
  .msgssz          &nbsp;rd 1<br />
  .msgtql          &nbsp;rd 1<br />
  .msgseg          &nbsp;rw 1<br /> 
  }
</code></td>
                      </tr>
                    </table>
                    <p><code><em><u>msginfo</u></em><u> members:</u></code></p>
                    <code> <span style="margin-left:10px"><strong><em>msgpool</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Size in bytes of buffer pool used                      to hold message data; unused</code></div>
                    <code> <span style="margin-left:10px"><strong><em>msgmap</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of entries in message                      map; unused</code></div>
                    <code> <span style="margin-left:10px"><strong><em>msgmax</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of bytes that can be                      written in a single message</code></div>
                    <code><span style="margin-left:10px"><strong><em>msgmnb</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of bytes that can be written to                      queue; used to initialize msg_qbytes                      during queue creation (MSGGET)</code></div>
                    <code><span style="margin-left:10px"><strong><em>msgmni</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of message queues</code></div>
                    <code><span style="margin-left:10px"><strong><em>msgssz</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Message segment size; unused </code></div>
                    <code><span style="margin-left:10px"><strong><em>msgtql</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of messages on all queues                      in system; unused </code></div>
                    <code><span style="margin-left:10px"><strong><em>msgseg</em></strong><br />
                    </span></code>
                    <div style="margin-left:25px"><code>Max. # of segments; unused</code></div>
                    <p><code>The <em>msgmni</em>, <em>msgmax</em>, and <em>msgmnb</em> settings can be changed via <em>/proc</em> files of the same name.</code></p>
                    </td>
                </tr>
                <tr>
                  <td valign="top"><code>MSG_INFO</code></td>
                  <td><code>Returns a <em>msginfo</em> structure (see above) containing the same information as for IPC_INFO, except that the following fields are returned with information   about system resources consumed by message queues: the <em>msgpool</em> field   returns the number of message queues that currently exist on the system; the <em>msgmap</em> field returns the total number of messages in all queues on the   system; and the <em>msgtql</em> field returns the total number of bytes in all   messages in all queues on the system. </code></td>
                </tr>
                <tr>
                  <td valign="top"><code>MSG_STAT </code></td>
                  <td><code>Returns a <em>msqid_ds</em> structure as for IPC_STAT. However, the <em>msqid</em> argument is not a queue identifier, but instead an index into the   kernel's internal array that maintains information about all message queues on   the system.</code></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td valign="top"><em>esi</em></td>
          <td>This parameter depends on the command used (<em>edx</em>). See above for information on available commands.</td>
        </tr>
      </table>
      <p style="margin-left:10px" ><strong>Return values</strong></p>
      <p style="margin-left:22px;margin-right:10px" >If the function succeeds the return value depends on the command used:</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>IPC_STAT, IPC_SET, IPC_RMID</code></td>
                <td width="90%" valign="top"><code>Return value is 0. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>IPC_INFO, MSG_INFO </code></td>
                <td valign="top"><code>Return value is the index of the highest used entry in the kernel's internal array recording   information about all message queues. (This information can be used with   repeated MSG_STAT operations to obtain information about all queues on   the system.)</code></td>
              </tr>
              <tr>
                <td valign="top"><code>MSG_STAT</code></td>
                <td valign="top"><code>Return value is the identifier of the queue whose index was given in <em>ecx</em>. </code></td>
              </tr>

          </table></td>
        </tr>
      </table>
      <p style="margin-left:22px;margin-right:10px" > If the function 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>-EACCES </code></td>
              <td width="90%"><code>The argument <em>edx</em> is equal to IPC_STAT or MSG_STAT, but the   calling process does not have read permission on the message queue <em>ecx</em>,   and does not have the CAP_IPC_OWNER capability. </code></td>
            </tr>
            <tr>
              <td valign="top"><code>-EFAULT </code></td>
              <td><code>The argument <em>edx</em> has the value IPC_SET or IPC_STAT, but the   address pointed to by <em>esi</em> isn't accessible. </code></td>
            </tr>
            <tr>
              <td valign="top"><code>-EIDRM </code></td>
              <td><code>The message queue was removed. </code></td>
            </tr>
            <tr>
              <td valign="top"><code>-EINVAL</code></td>
              <td><code>Invalid value for <em>edx</em> or <em>ecx</em>. Or: for a MSG_STAT operation, the index value specified in <em>ecx</em> referred to an array slot   that is currently unused. </code></td>
            </tr>
            <tr>
              <td valign="top"><code>-EPERM </code></td>
              <td><code>The argument <em>edx</em> has the value IPC_SET or IPC_RMID, but the   effective user ID of the calling process is not the creator (as found in <em>msg_perm.cuid</em>) or the owner (as found in <em>msg_perm.uid</em>) of the   message queue, and the process is not privileged (it does not have the CAP_SYS_ADMIN capability).</code></td>
            </tr>
          </table></td>
        </tr>
      </table>
      <p style="margin-left:10px"><strong>Remarks</strong></p>
      <p style="margin-left:22px">The IPC_INFO, MSG_STAT and MSG_INFO operations are used by   the <em>ipcs</em> program to   provide information on allocated resources. In the future these may modified or   moved to a /proc file system interface.      </p>
    </td>
  </tr>
</table>
</body></html>