Symbian3/SDK/Source/GUID-BE70DCBF-366A-5054-B0F1-7FCEF45FC735.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-BE70DCBF-366A-5054-B0F1-7FCEF45FC735.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept xml:lang="en" id="GUID-BE70DCBF-366A-5054-B0F1-7FCEF45FC735"><title>Creating and Unlinking a File Descriptor from a Shared Memory</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The <xref href="GUID-FF8FD54D-4CD3-3DC7-9A48-56043F26E5DD.dita"><apiname>shm_open()</apiname></xref> function enables you to create shared memory and associate a file descriptor. Use the <xref href="GUID-BF359599-0088-3F3E-BD80-B09C1F5DA380.dita"><apiname>shm_unlink()</apiname></xref> function to remove (unlink a file descriptor from a shared memory) the name of the shared memory object. </p> <p>Example: </p> <codeblock id="GUID-F030E460-536D-53A8-86F1-36E63860677D" xml:space="preserve">#include &lt;stdio.h&gt;
+#include &lt;sys/mman.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;errno.h&gt;
+int main(void)
+    {
+    int fd;// File Descriptor
+    int ret;
+    if((fd = shm_open("page", O_RDWR|O_CREAT, 0666)) &lt; 0)
+        {
+        printf("Shared memory creation failed with errno %d\n", errno);
+        }
+    else
+        {
+        printf("Shared memory creation was successful\n");
+        }
+    close(fd);//closing the file descriptor
+    if((ret = shm_unlink("page")) &lt; 0) 
+        {
+        printf("Shared memory unlinking failed with errno %d\n", errno);
+        }
+    else
+        {
+        printf("Shared memory unlinking was successful\n");
+        }
+    return ret;
+    }</codeblock> </conbody><related-links><link href="GUID-9AC6774A-41E9-5298-8696-0A317A09E1E9.dita"><linktext>Librt Overview</linktext> </link> <link href="GUID-A4ECB450-02DA-5E85-91AC-4C8BDE0B9B58.dita"><linktext>Writing, Reading and Seeking from a
+                Shared Memory</linktext> </link> <link href="GUID-8F6D6934-8FF0-5045-8AB1-74384BE792EA.dita"><linktext>Retrieving Information about a
+                Shared Memory Object</linktext> </link> <link href="GUID-66402932-5C44-556B-A7AC-1C2D245C8B05.dita"><linktext>Clocks and Timers Tutorial</linktext> </link> </related-links></concept>
\ No newline at end of file