- Updated docs to reflect the new function names

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@34178 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2000-10-19 22:55:58 +00:00
parent 08b3165978
commit 21d95d8abf

View file

@ -17,33 +17,33 @@
<?php
// Create 100 byte shared memory block with system id if 0xff3
$shm_id = shm_open(0xff3, "c", 0644, 100);
$shm_id = shmop_open(0xff3, "c", 0644, 100);
if(!$shm_id) {
echo "Couldn't create shared memory segment\n";
}
// Get shared memory block's size
$shm_size = shm_size($shm_id);
$shm_size = shmop_size($shm_id);
echo "SHM Block Size: ".$shm_size. " has been created.\n";
// Lets write a test string into shared memory
$shm_bytes_written = shm_write($shm_id, "my shared memory block", 0);
$shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0);
if($shm_bytes_written != strlen("my shared memory block")) {
echo "Couldn't write the entire length of data\n";
}
// Now lets read the string back
$my_string = shm_read($shm_id, 0, $shm_size);
$my_string = shmop_read($shm_id, 0, $shm_size);
if(!$my_string) {
echo "Couldn't read from shared memory block\n";
}
echo "The data inside shared memory was: ".$my_string."\n";
//Now lets delete the block and close the shared memory segment
if(!shm_delete($shm_id)) {
if(!shmop_delete($shm_id)) {
echo "Couldn't mark shared memory block for deletion.
}
shm_close($shm_id);
shmop_close($shm_id);
?>
</programlisting>
@ -51,16 +51,16 @@ shm_close($shm_id);
</para>
</partintro>
<refentry id="function.shm_open">
<refentry id="function.shmop_open">
<refnamediv>
<refname>shm_open</refname>
<refname>shmop_open</refname>
<refpurpose>Create or open shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>shm_open</function></funcdef>
<funcdef>int <function>shmop_open</function></funcdef>
<paramdef>int <parameter>key</parameter></paramdef>
<paramdef>string <parameter>flags</parameter></paramdef>
<paramdef>int <parameter>mode</parameter></paramdef>
@ -68,10 +68,10 @@ shm_close($shm_id);
</funcprototype>
</funcsynopsis>
<para>
<function>shm_open</function> can create or open a shared memory block.
<function>shmop_open</function> can create or open a shared memory block.
</para>
<para>
<function>shm_open</function> takes 4 parameters: key, which is the
<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>
@ -95,7 +95,7 @@ shm_close($shm_id);
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>shm_open</function> will
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>
@ -105,7 +105,7 @@ shm_close($shm_id);
<title>Create a new shared memory block</title>
<programlisting role="php">
&lt;?php
$shm_id = shm_open(0x0fff, "c", 0644, 100);
$shm_id = shmop_open(0x0fff, "c", 0644, 100);
?&gt;
</programlisting>
</example>
@ -116,27 +116,27 @@ $shm_id = shm_open(0x0fff, "c", 0644, 100);
</refsect1>
</refentry>
<refentry id="function.shm_read">
<refentry id="function.shmop_read">
<refnamediv>
<refname>shm_read</refname>
<refname>shmop_read</refname>
<refpurpose>Read data from shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>shm_read</function></funcdef>
<funcdef>string <function>shmop_read</function></funcdef>
<paramdef>int <parameter>shmid</parameter></paramdef>
<paramdef>int <parameter>start</parameter></paramdef>
<paramdef>int <parameter>count</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>shm_read</function> will read a string from shared memory block.
<function>shmop_read</function> will read a string from shared memory block.
</para>
<para>
<function>shm_read</function> takes 3 parameters: shmid, which is the shared
memory block identifier created by <function>shm_open</function>, offset from
<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.
</para>
<para>
@ -144,7 +144,7 @@ $shm_id = shm_open(0x0fff, "c", 0644, 100);
<title>Reading shared memory block</title>
<programlisting role="php">
&lt;?php
$shm_data = shm_read($shm_id, 0, 50);
$shm_data = shmop_read($shm_id, 0, 50);
?&gt;
</programlisting>
</example>
@ -156,27 +156,27 @@ $shm_data = shm_read($shm_id, 0, 50);
</refsect1>
</refentry>
<refentry id="function.shm_write">
<refentry id="function.shmop_write">
<refnamediv>
<refname>shm_write</refname>
<refname>shmop_write</refname>
<refpurpose>Write data into shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>shm_write</function></funcdef>
<funcdef>int <function>shmop_write</function></funcdef>
<paramdef>int <parameter>shmid</parameter></paramdef>
<paramdef>string <parameter>data</parameter></paramdef>
<paramdef>int <parameter>offset</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>shm_write</function> will write a string into shared memory block.
<function>shmop_write</function> will write a string into shared memory block.
</para>
<para>
<function>shm_write</function> takes 3 parameters: shmid, which is the
shared memory block identifier created by <function>shm_open</function>,
<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>
@ -185,7 +185,7 @@ $shm_data = shm_read($shm_id, 0, 50);
<title>Writing to shared memory block</title>
<programlisting role="php">
&lt;?php
$shm_bytes_written = shm_write($shm_id, $my_string, 0);
$shm_bytes_written = shmop_write($shm_id, $my_string, 0);
?&gt;
</programlisting>
</example>
@ -200,24 +200,24 @@ $shm_bytes_written = shm_write($shm_id, $my_string, 0);
<refentry id="function.size">
<refnamediv>
<refname>shm_size</refname>
<refname>shmop_size</refname>
<refpurpose>Get size of shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>shm_size</function></funcdef>
<funcdef>int <function>shmop_size</function></funcdef>
<paramdef>int <parameter>shmid</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>shm_size</function> is used to get the size, in bytes of the
<function>shmop_size</function> is used to get the size, in bytes of the
shared memory block.
</para>
<para>
<function>shm_size</function> takes the shmid, which is the shared memory
block identifier created by <function>shm_open</function>, the function
<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
block occupies.
</para>
@ -226,7 +226,7 @@ $shm_bytes_written = shm_write($shm_id, $my_string, 0);
<title>Getting the size of the shared memory block</title>
<programlisting role="php">
&lt;?php
$shm_size = shm_size($shm_id);
$shm_size = shmop_size($shm_id);
?&gt;
</programlisting>
</example>
@ -238,25 +238,25 @@ $shm_size = shm_size($shm_id);
</refsect1>
</refentry>
<refentry id="function.shm_delete">
<refentry id="function.shmop_delete">
<refnamediv>
<refname>shm_delete</refname>
<refname>shmop_delete</refname>
<refpurpose>Delete shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>shm_delete</function></funcdef>
<funcdef>int <function>shmop_delete</function></funcdef>
<paramdef>int <parameter>shmid</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>shm_delete</function> is used to delete a shared memory block.
<function>shmop_delete</function> is used to delete a shared memory block.
</para>
<para>
<function>shm_delete</function> takes the shmid, which is the shared memory
block identifier created by <function>shm_open</function>. On success 1 is
<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.
</para>
<para>
@ -264,7 +264,7 @@ $shm_size = shm_size($shm_id);
<title>Deleting shared memory block</title>
<programlisting role="php">
&lt;?php
shm_delete($shm_id);
shmop_delete($shm_id);
?&gt;
</programlisting>
</example>
@ -276,32 +276,32 @@ shm_delete($shm_id);
</refsect1>
</refentry>
<refentry id="function.shm_close">
<refentry id="function.shmop_close">
<refnamediv>
<refname>shm_close</refname>
<refname>shmop_close</refname>
<refpurpose>Close shared memory block</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>shm_close</function></funcdef>
<funcdef>int <function>shmop_close</function></funcdef>
<paramdef>int <parameter>shmid</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>shm_close</function> is used to close a shared memory block.
<function>shmop_close</function> is used to close a shared memory block.
</para>
<para>
<function>shm_close</function> takes the shmid, which is the shared memory
block identifier created by <function>shm_open</function>.
<function>shmop_close</function> takes the shmid, which is the shared memory
block identifier created by <function>shmop_open</function>.
</para>
<para>
<example>
<title>Closing shared memory block</title>
<programlisting role="php">
&lt;?php
shm_close($shm_id);
shmop_close($shm_id);
?&gt;
</programlisting>
</example>