Symbian3/SDK/Source/GUID-3BC54F46-5F81-5F2D-ACF8-E8E0A0D5A345.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-3BC54F46-5F81-5F2D-ACF8-E8E0A0D5A345"><title>Handles versus File Descriptors</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>STDLIB provides a POSIX-like abstraction of file descriptors which unifies the different types of resource and permits a single API to be used across all of them. This is a significantly different approach from Win32 and Symbian platform, both of which have separate APIs for each distinct type of resource. </p> <p>STDLIB supports files stored in the file system, sockets, a console, and a <codeph>/dev/null</codeph> device. The first time STDLIB initialises its internal file descriptor table it creates an emulated console device and attaches it to descriptors 0, 1 and 2. The emulated console device will appear as a window when it is first used (i.e. when the program writes to or reads from the console). </p> <p>The <codeph>open()</codeph> function recognises the following names: </p> <ul><li id="GUID-6093ADF0-5171-5ECC-910A-7F1CDCEBA54F"><p> <codeph>CON:</codeph> is taken to mean a newly-created console. This will never be the same console as the one automatically associated with 0, 1 and 2. </p> </li> <li id="GUID-F99DC14D-ABD1-5B2C-BD93-966986F974B8"><p> <codeph>NUL:</codeph> is taken to mean a <codeph>/dev/null</codeph> device. </p> </li> <li id="GUID-11DF24CF-BF8C-5DBD-87AA-AF667953D8E6"><p> <codeph>TMP:</codeph> is taken to mean a temporary file, which will use the underlying Symbian platform file system facilities to create a uniquely-named temporary file, and will cause the file to be deleted after it has been closed cleanly. </p> </li> <li id="GUID-9D55E093-D3CA-5FDA-B32D-918675840C4A"><p> <codeph>COMx:</codeph> is the serial port where x is a number from 1 to 9. <codeph>COM1:</codeph> corresponds to serial port zero and so on. </p> </li> <li id="GUID-96E9F3A9-9A90-5A27-8B2B-50151CBA045B"><p> <codeph>IRCOMx:</codeph> is the serial port where x is a number from 1 to 9. </p> </li> </ul> <p>The number of open files in the file has no explicit limit. </p> <p>Symbian platform resources such as <codeph>RFile</codeph> s and <codeph>RSocket</codeph> s are derived from class <codeph>RSubSessionBase</codeph>, so are thread specific. This means they cannot be used by any thread other than the one which opened them. In STDLIB however, the <codeph>CPosixServer</codeph>, if running, controls the master file descriptor table. In this case, all STDLIB threads in a process may share their resources, because the STDLIB implementation forwards all I/o requests to the resources owned by that process's <codeph>CPosixServer</codeph> thread. If no <codeph>CPosixServer</codeph> is running, each thread has a separate file descriptor table and the resources are not shareable. </p> </conbody></concept>