shmop: switch to new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@227190 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2007-01-14 04:14:17 +00:00
parent 682b9d89ed
commit 812c94c824
6 changed files with 308 additions and 95 deletions

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.shmop-close">
<refnamediv>
<refname>shmop_close</refname>
<refpurpose>Close shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>shmop_close</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
@ -15,9 +15,33 @@
<function>shmop_close</function> is used to close a shared memory block.
</para>
<para>
<function>shmop_close</function> takes the shmid, which is the shared memory
block identifier created by <function>shmop_open</function>.
<function>shmop_close</function> takes the shmid, which is
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>shmid</parameter></term>
<listitem>
<para>
The shared memory block identifier created by
<function>shmop_open</function>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Closing shared memory block</title>
@ -34,6 +58,14 @@ shmop_close($shm_id);
This example will close shared memory block identified by <literal>$shm_id</literal>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>shmop_open</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.shmop-delete">
<refnamediv>
<refname>shmop_delete</refname>
<refpurpose>Delete shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>shmop_delete</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
@ -14,11 +14,31 @@
<para>
<function>shmop_delete</function> is used to delete a shared memory block.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<function>shmop_delete</function> takes the shmid, which is the shared memory
block identifier created by <function>shmop_open</function>. On success 1 is
returned, on failure 0 is returned.
<variablelist>
<varlistentry>
<term><parameter>shmid</parameter></term>
<listitem>
<para>
The shared memory block identifier created by
<function>shmop_open</function>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Deleting shared memory block</title>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.shmop-open">
<refnamediv>
<refname>shmop_open</refname>
<refpurpose>Create or open shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>shmop_open</methodname>
<methodparam><type>int</type><parameter>key</parameter></methodparam>
@ -17,55 +17,98 @@
<para>
<function>shmop_open</function> can create or open a shared memory block.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<function>shmop_open</function> takes 4 parameters: key, which is the
system's id for the shared memory block, this parameter can be passed
as a decimal or hex. The second parameter are the flags that you can use:
<itemizedlist>
<listitem>
<simpara>
"a" for access (sets SHM_RDONLY for shmat)
use this flag when you need to open an existing shared memory
segment for read only
</simpara>
</listitem>
<listitem>
<simpara>
"c" for create (sets IPC_CREATE)
use this flag when you need to create a new shared memory segment
or if a segment with the same key exists, try to open it for read
and write
</simpara>
</listitem>
<listitem>
<simpara>
"w" for read &amp; write access
use this flag when you need to read and write to a shared memory
segment, use this flag in most cases.
</simpara>
</listitem>
<listitem>
<simpara>
"n" create a new memory segment (sets IPC_CREATE|IPC_EXCL)
use this flag when you want to create a new shared memory segment
but if one already exists with the same flag, fail. This is useful
for security purposes, using this you can prevent race condition
exploits.
</simpara>
</listitem>
</itemizedlist>
The third parameter is the mode, which are the permissions that you
wish to assign to your memory segment, those are the same as permission
for a file. Permissions need to be passed in octal form ex. 0644.
The last parameter is size of the shared memory block you wish to create
in bytes.
<note><simpara>
Note: the 3rd and 4th should be entered as 0 if you are opening an
existing memory segment. On success <function>shmop_open</function> will
return an id that you can use to access the shared memory segment
you've created.
</simpara></note>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
System's id for the shared memory block.
Can be passed as a decimal or hex.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
The flags that you can use:
<itemizedlist>
<listitem>
<simpara>
"a" for access (sets SHM_RDONLY for shmat)
use this flag when you need to open an existing shared memory
segment for read only
</simpara>
</listitem>
<listitem>
<simpara>
"c" for create (sets IPC_CREATE)
use this flag when you need to create a new shared memory segment
or if a segment with the same key exists, try to open it for read
and write
</simpara>
</listitem>
<listitem>
<simpara>
"w" for read &amp; write access
use this flag when you need to read and write to a shared memory
segment, use this flag in most cases.
</simpara>
</listitem>
<listitem>
<simpara>
"n" create a new memory segment (sets IPC_CREATE|IPC_EXCL)
use this flag when you want to create a new shared memory segment
but if one already exists with the same flag, fail. This is useful
for security purposes, using this you can prevent race condition
exploits.
</simpara>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
The permissions that you wish to assign to your memory segment, those
are the same as permission for a file. Permissions need to be passed
in octal form, like for example <literal>0644</literal>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>size</parameter></term>
<listitem>
<para>
The size of the shared memory block you wish to create in bytes
</para>
</listitem>
</varlistentry>
</variablelist>
<note>
<para>
Note: the 3rd and 4th should be entered as 0 if you are opening an
existing memory segment.
</para>
</note>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
On success <function>shmop_open</function> will return an id that you can
use to access the shared memory segment you've created. &false; is
returned on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Create a new shared memory block</title>
@ -84,6 +127,15 @@ $shm_id = shmop_open($shm_key, "c", 0644, 100);
<function>ftok</function>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>shmop_close</function></member>
<member><function>shmop_delete</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.shmop-read">
<refnamediv>
<refname>shmop_read</refname>
<refpurpose>Read data from shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>shmop_read</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
@ -16,11 +16,47 @@
<para>
<function>shmop_read</function> will read a string from shared memory block.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<function>shmop_read</function> takes 3 parameters: shmid, which is the shared
memory block identifier created by <function>shmop_open</function>, offset from
which to start reading and count on the number of bytes to read.
<variablelist>
<varlistentry>
<term><parameter>shmid</parameter></term>
<listitem>
<para>
The shared memory block identifier created by
<function>shmop_open</function>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>start</parameter></term>
<listitem>
<para>
Offset from which to start reading
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>count</parameter></term>
<listitem>
<para>
The number of bytes to read
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the data or &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Reading shared memory block</title>
@ -38,6 +74,14 @@ $shm_data = shmop_read($shm_id, 0, 50);
inside <literal>$shm_data</literal>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>shmop_write</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.shmop-size">
<refnamediv>
<refname>shmop_size</refname>
<refpurpose>Get size of shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>shmop_size</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
@ -15,12 +15,32 @@
<function>shmop_size</function> is used to get the size, in bytes of the
shared memory block.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<function>shmop_size</function> takes the shmid, which is the shared memory
block identifier created by <function>shmop_open</function>, the function
will return and int, which represents the number of bytes the shared memory
<variablelist>
<varlistentry>
<term><parameter>shmid</parameter></term>
<listitem>
<para>
The shared memory block identifier created by
<function>shmop_open</function>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an int, which represents the number of bytes the shared memory
block occupies.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Getting the size of the shared memory block</title>

View file

@ -1,29 +1,66 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.shmop-write">
<refnamediv>
<refname>shmop_write</refname>
<refpurpose>Write data into shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>shmop_write</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>shmop_write</function> will write a string into shared memory block.
</para>
<para>
<function>shmop_write</function> takes 3 parameters: shmid, which is the
shared memory block identifier created by <function>shmop_open</function>,
data, a string that you want to write into shared memory block and offset,
which specifies where to start writing data inside the shared memory segment.
</para>
<para>
<example>
<refpurpose>Write data into shared memory block</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>shmop_write</methodname>
<methodparam><type>int</type><parameter>shmid</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>shmop_write</function> will write a string into shared memory block.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>shmid</parameter></term>
<listitem>
<para>
The shared memory block identifier created by
<function>shmop_open</function>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
A string to write into shared memory block
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Specifies where to start writing data inside the shared memory
segment.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The size of the written <parameter>data</parameter>, or &false; on
failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Writing to shared memory block</title>
<programlisting role="php">
<![CDATA[
@ -40,6 +77,14 @@ $shm_bytes_written = shmop_write($shm_id, $my_string, 0);
the number of bytes written.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>shmop_read</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file