changed example so that it uses ftok() instead of a static key

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@129269 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Davey Shafik 2003-05-29 23:22:51 +00:00
parent 26528df485
commit 590ccd8810

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/shmop.xml, last change in rev 1.12 -->
<refentry id="function.shmop-open">
<refnamediv>
@ -33,22 +33,22 @@
<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
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.
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.
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>
@ -70,14 +70,16 @@
<programlisting role="php">
<![CDATA[
<?php
$shm_id = shmop_open(0x0fff, "c", 0644, 100);
$shm_key = ftok(__FILE__,'t');
$shm_id = shmop_open($shm_key, "c", 0644, 100);
?>
]]>
</programlisting>
</example>
</para>
<para>
This example opened a shared memory block with a system id of 0x0fff.
This example opened a shared memory block with a system id returned by
<function>ftok</function>.
</para>
</refsect1>
</refentry>