wez Mon Apr 29 09:11:05 2002 EDT
Added files:
/phpdoc/en/reference/sem/functions msg-get-queue.xml
msg-receive.xml
msg-remove-queue.xml
msg-send.xml msg-set-queue.xml
msg-stat-queue.xml
Modified files:
/phpdoc/en/reference/sem functions.xml reference.xml
/phpdoc/en/reference/sem/functions sem-get.xml shm-attach.xml
Log:
Document sysvmsg extension functions.
Flesh out the ftok docs and add see-also links to relevant functions.
Index: phpdoc/en/reference/sem/functions.xml
diff -u phpdoc/en/reference/sem/functions.xml:1.1
phpdoc/en/reference/sem/functions.xml:1.2
--- phpdoc/en/reference/sem/functions.xml:1.1 Sun Apr 14 20:11:03 2002
+++ phpdoc/en/reference/sem/functions.xml Mon Apr 29 09:11:04 2002
@@ -1,4 +1,10 @@
&reference.sem.functions.ftok;
+&reference.sem.functions.msg-get-queue;
+&reference.sem.functions.msg-receive;
+&reference.sem.functions.msg-remove-queue;
+&reference.sem.functions.msg-send;
+&reference.sem.functions.msg-set-queue;
+&reference.sem.functions.msg-stat-queue;
&reference.sem.functions.sem-acquire;
&reference.sem.functions.sem-get;
&reference.sem.functions.sem-release;
Index: phpdoc/en/reference/sem/reference.xml
diff -u phpdoc/en/reference/sem/reference.xml:1.2
phpdoc/en/reference/sem/reference.xml:1.3
--- phpdoc/en/reference/sem/reference.xml:1.2 Mon Apr 15 17:57:21 2002
+++ phpdoc/en/reference/sem/reference.xml Mon Apr 29 09:11:04 2002
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<reference id="ref.sem">
- <title>Semaphore and Shared Memory Functions</title>
+ <title>Semaphore, Shared Memory and IPC Functions</title>
<titleabbrev>Semaphore</titleabbrev>
<partintro>
<para>
- This module provides semaphore functions using System V
- semaphores. Semaphores may be used to provide exclusive access to
+ This module provides wrappers for the System V IPC family of functions.
+ It includes semaphores, shared memory and inter-process messaging (IPC).
+ </para>
+ <para>
+ Semaphores may be used to provide exclusive access to
resources on the current machine, or to limit the number of
processes that may simultaneously use a resource.
</para>
@@ -46,6 +49,12 @@
</tbody>
</tgroup>
</table>
+ </para>
+ <para>
+ The messaging functions may be used to send and receive messages to/from
+ other processes. They provide a simple and effective means of exchanging
+ data between processes, without the need for setting up an alternative
+ using unix domain sockets.
</para>
<note>
<simpara>
Index: phpdoc/en/reference/sem/functions/sem-get.xml
diff -u phpdoc/en/reference/sem/functions/sem-get.xml:1.2
phpdoc/en/reference/sem/functions/sem-get.xml:1.3
--- phpdoc/en/reference/sem/functions/sem-get.xml:1.2 Wed Apr 17 02:43:52 2002
+++ phpdoc/en/reference/sem/functions/sem-get.xml Mon Apr 29 09:11:04 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/sem.xml, last change in rev 1.2 -->
<refentry id="function.sem-get">
<refnamediv>
@@ -33,8 +33,8 @@
identifiers access the same underlying semaphore.
</para>
<para>
- See also: <function>sem_acquire</function> and
- <function>sem_release</function>.
+ See also: <function>sem_acquire</function>,
+ <function>sem_release</function> and <function>ftok</function>.
</para>
<note>
<simpara>
Index: phpdoc/en/reference/sem/functions/shm-attach.xml
diff -u phpdoc/en/reference/sem/functions/shm-attach.xml:1.2
phpdoc/en/reference/sem/functions/shm-attach.xml:1.3
--- phpdoc/en/reference/sem/functions/shm-attach.xml:1.2 Wed Apr 17 02:43:52
2002
+++ phpdoc/en/reference/sem/functions/shm-attach.xml Mon Apr 29 09:11:05 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/sem.xml, last change in rev 1.2 -->
<refentry id="function.shm-attach">
<refnamediv>
@@ -28,6 +28,9 @@
identifier, but both identifiers access the same underlying
shared memory. <parameter>Memsize</parameter> and
<parameter>perm</parameter> will be ignored.
+ </para>
+ <para>
+ See also: <function>ftok</function>.
</para>
<note>
<simpara>
Index: phpdoc/en/reference/sem/functions/msg-get-queue.xml
+++ phpdoc/en/reference/sem/functions/msg-get-queue.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-get-queue">
<refnamediv>
<refname>msg_get_queue</refname>
<refpurpose>
Create or attach to a message queue
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>msg_get_queue</methodname>
<methodparam><type>int</type><parameter>key</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>perms</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_get_queue</function> returns an id that can be used to
access the System V message queue with the given
<parameter>key</parameter>. The first call creates the message queue with
the optional <parameter>perms</parameter> (default: 0666).
A second call to <function>msg_get_queue</function> for the same
<parameter>key</parameter> will return a different message queue
identifier, but both identifiers access the same underlying message
queue.
If the message queue already exists, the <parameter>perms</parameter>
will be ignored.
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_receive</function>, <function>msg_send</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Index: phpdoc/en/reference/sem/functions/msg-receive.xml
+++ phpdoc/en/reference/sem/functions/msg-receive.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-receive">
<refnamediv>
<refname>msg_receive</refname>
<refpurpose>
Receive a message from a message queue
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>msg_receive</methodname>
<methodparam><type>int</type><parameter>queue</parameter></methodparam>
<methodparam><type>int</type><parameter>desiredmsgtype</parameter></methodparam>
<methodparam><type>int</type><parameter>msgtype</parameter></methodparam>
<methodparam><type>int</type><parameter>maxsize</parameter></methodparam>
<methodparam><type>mixed</type><parameter>message</parameter></methodparam>
<methodparam
choice="opt"><type>bool</type><parameter>unserialize</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>errorcode</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_receive</function> will receive the first message from the
specified <parameter>queue</parameter> of the type specified by
<parameter>desiredmsgtype</parameter>.
The type of the message that was received will be stored in
<parameter>msgtype</parameter>.
The maximum size of message to be accepted is specified by the
<parameter>maxsize</parameter>; if the message in the queue is larger
than this size the function will fail (unless you set
<parameter>flags</parameter> as described below).
The received message will be stored in <parameter>message</parameter>,
unless there were errors receiving the message, in which case the
optional <parameter>errorcode</parameter> will be set to the value of the
system errno variable to help you identify the cause.
</para>
<para>
If <parameter>desiredmsgtype</parameter> is 0, the message from the front
of the queue is returned. If <parameter>desiredmsgtype</parameter> is
greater than 0, then the first message of that type is returned.
If <parameter>desiredmsgtype</parameter> is less than 0, the first
message on the queue with the lowest type less than or equal to the
absolute value of <parameter>desiredmsgtype</parameter> will be read.
If no messages match the criteria, your script will wait until a suitable
message arrives on the queue. You can prevent the script from blocking
by specifying MSG_IPC_NOWAIT in the <parameter>flags</parameter> parameter.
</para>
<para>
<parameter>unserialize</parameter> defaults to &true;; if it is set to
&true;, the message is treated as though it was serialized using the same
mechanism as the session module. The message will be unserialized and
then returned to your script. This allows you to easily receive arrays
or complex object structures from other PHP scripts, or if you are using
the WDDX serializer, from any WDDX compatible source.
If <parameter>unserialize</parameter> is &false;, the message will be
returned as a binary-safe string.
</para>
<para>
The optional <parameter>flags</parameter> allows you to pass flags to the
low-level msgrcv system call. It defaults to 0, but you may specify one
or more of the following values (by adding or ORing them together).
<table>
<title>Flag values for msg_receive</title>
<tgroup cols="2">
<tbody>
<row>
<entry>MSG_IPC_NOWAIT</entry>
<entry>If there are no messages of the
<parameter>desiredmsgtype</parameter>, return immediately and do not
wait. The function will fail and return an integer value
corresponding to ENOMSG.
</entry>
</row>
<row>
<entry>MSG_EXCEPT</entry>
<entry>Using this flag in combination with a
<parameter>desiredmsgtype</parameter> greater than 0 will cause the
function to receive the first message that is not equal to
<parameter>desiredmsgtype</parameter>.</entry>
</row>
<row>
<entry>MSG_NOERROR</entry>
<entry>
If the message is longer than <parameter>maxsize</parameter>,
setting this flag will truncate the message to
<parameter>maxsize</parameter> and will not signal an error.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
Upon successful completion the message queue data structure is updated as
follows: <parameter>msg_lrpid</parameter> is set to the process-ID of the
calling process, <parameter>msg_qnum</parameter> is decremented by 1 and
<parameter>msg_rtime</parameter> is set to the current time.
</para>
<para>
<function>msg_receive</function> returns &true; on success or &false; on
failure. If the function fails, the optional
<parameter>errorcode</parameter> will be set to the value of the system
errno variable.
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_send</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Index: phpdoc/en/reference/sem/functions/msg-remove-queue.xml
+++ phpdoc/en/reference/sem/functions/msg-remove-queue.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-remove-queue">
<refnamediv>
<refname>msg_remove_queue</refname>
<refpurpose>
Destroy a message queue
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>msg_remove_queue</methodname>
<methodparam><type>int</type><parameter>queue</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_remove_queue</function> destroys the message queue specified
by the <parameter>queue</parameter>. Only use this function when all
processes have finished working with the message queue and you need to
release the system resources held by it.
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_receive</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Index: phpdoc/en/reference/sem/functions/msg-send.xml
+++ phpdoc/en/reference/sem/functions/msg-send.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-send">
<refnamediv>
<refname>msg_send</refname>
<refpurpose>
Send a message to a message queue
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>msg_send</methodname>
<methodparam><type>int</type><parameter>queue</parameter></methodparam>
<methodparam><type>int</type><parameter>msgtype</parameter></methodparam>
<methodparam><type>mixed</type><parameter>message</parameter></methodparam>
<methodparam
choice="opt"><type>bool</type><parameter>serialize</parameter></methodparam>
<methodparam
choice="opt"><type>bool</type><parameter>blocking</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>errorcode</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_send</function> sends a <parameter>message</parameter> of type
<parameter>msgtype</parameter> (which MUST be greater than 0) to a
the message queue specified by <parameter>queue</parameter>.
</para>
<para>
If the message is too large to fit in the queue, your script will wait
until another process reads messages from the queue and frees enough
space for your message to be sent.
This is called blocking; you can prevent blocking by setting the
optional <parameter>blocking</parameter> parameter to &false;, in which
case <function>msg_send</function> will immediately return &false; if the
message is too big for the queue, and set the optional
<parameter>errorcode</parameter> to EAGAIN, indicating that you should
try to send your message again a little later on.
</para>
<para>
The optional <parameter>serialize</parameter> controls how the
<parameter>message</parameter> is sent. <parameter>serialize</parameter>
defaults to &true; which means that the <parameter>message</parameter> is
serialized using the same mechanism as the session module before being
sent to the queue. This allows complex arrays and objects to be sent to
other PHP scripts, or if you are using the WDDX serializer, to any WDDX
compatible client.
</para>
<para>
Upon successful completion the message queue data structure is updated as
follows: <parameter>msg_lspid</parameter> is set to the process-ID of the
calling process, <parameter>msg_qnum</parameter> is incremented by 1 and
<parameter>msg_stime</parameter> is set to the current time.
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_receive</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Index: phpdoc/en/reference/sem/functions/msg-set-queue.xml
+++ phpdoc/en/reference/sem/functions/msg-set-queue.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-set-queue">
<refnamediv>
<refname>msg_set_queue</refname>
<refpurpose>
Set information in the message queue data structure
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>msg_set_queue</methodname>
<methodparam><type>int</type><parameter>queue</parameter></methodparam>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_set_queue</function> allows you to change the values of the
msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the
underlying message queue data structure.
You specify the values you require by setting the value of the keys that
you require in the <parameter>data</parameter> array.
</para>
<para>
Changing the data structure will require that PHP be running as the same
user that created the the queue, owns the queue (as determined by the
existing msg_perm.xxx fields), or be running with root privileges.
root privileges are required to raise the msg_qbytes values above the
system defined limit.
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_receive</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Index: phpdoc/en/reference/sem/functions/msg-stat-queue.xml
+++ phpdoc/en/reference/sem/functions/msg-stat-queue.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.msg-stat-queue">
<refnamediv>
<refname>msg_stat_queue</refname>
<refpurpose>
Returns information from the message queue data structure
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>msg_stat_queue</methodname>
<methodparam><type>int</type><parameter>queue</parameter></methodparam>
</methodsynopsis>
<para>
<function>msg_stat_queue</function> returns the message queue meta data
for the message queue specified by the <parameter>queue</parameter>.
This is useful, for example, to determine which process sent the message
that was just received.
</para>
<para>
The return value is an array whose keys and values have the following
meanings:
<table>
<title>Array structure for msg_stat_queue</title>
<tgroup cols="2">
<tbody>
<row>
<entry>msg_perm.uid</entry>
<entry>
The uid of the owner of the queue.
</entry>
</row>
<row>
<entry>msg_perm.gid</entry>
<entry>
The gid of the owner of the queue.
</entry>
</row>
<row>
<entry>msg_perm.mode</entry>
<entry>
The file access mode of the queue.
</entry>
</row>
<row>
<entry>msg_stime</entry>
<entry>
The time that the last message was sent to the queue.
</entry>
</row>
<row>
<entry>msg_rtime</entry>
<entry>
The time that the last message was received from the queue.
</entry>
</row>
<row>
<entry>msg_ctime</entry>
<entry>
The time that the queue was last changed.
</entry>
</row>
<row>
<entry>msg_qnum</entry>
<entry>
The number of messages waiting to be read from the queue.
</entry>
</row>
<row>
<entry>msg_qbytes</entry>
<entry>
The number of bytes of space currently available in the queue to
hold sent messages until they are received.
</entry>
</row>
<row>
<entry>msg_lspid</entry>
<entry>
The pid of the process that sent the last message to the queue.
</entry>
</row>
<row>
<entry>msg_lrpid</entry>
<entry>
The pid of the process that received the last message from the queue.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
See also: <function>msg_remove_queue</function>,
<function>msg_receive</function>,
<function>msg_stat_queue</function> and
<function>msg_set_queue</function>.
</para>
<para>
This function was introduced in PHP 4.3.0 (not yet released).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->