15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The contents of this file are subject to the Mozilla Public 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * License Version 1.1 (the "License"); you may not use this file 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * except in compliance with the License. You may obtain a copy of 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the License at http://www.mozilla.org/MPL/ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Software distributed under the License is distributed on an "AS 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * implied. See the License for the specific language governing 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * rights and limitations under the License. 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Original Code is the Netscape Portable Runtime (NSPR). 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Initial Developer of the Original Code is Netscape 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Communications Corporation. Portions created by Netscape are 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Copyright (C) 1999-2000 Netscape Communications Corporation. All 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Rights Reserved. 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Contributor(s): 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Alternatively, the contents of this file may be used under the 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * terms of the GNU General Public License Version 2 or later (the 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * "GPL"), in which case the provisions of the GPL are applicable 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * instead of those above. If you wish to allow use of your 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * version of this file only under the terms of the GPL and not to 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allow others to use your version of this file under the MPL, 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * indicate your decision by deleting the provisions above and 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * replace them with the notice and other provisions required by 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the GPL. If you do not delete the provisions above, a recipient 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * may use your version of this file under either the MPL or the 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GPL. 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** prshma.h -- NSPR Anonymous Shared Memory 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** NSPR provides an anonymous shared memory based on NSPR's PRFileMap 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** type. The anonymous file-mapped shared memory provides an inheritable 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** shared memory, as in: the child process inherits the shared memory. 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Compare the file-mapped anonymous shared memory to to a named shared 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** memory described in prshm.h. The intent is to provide a shared 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** memory that is accessable only by parent and child processes. ... 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** It's a security thing. 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Depending on the underlying platform, the file-mapped shared memory 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** may be backed by a file. ... surprise! ... On some platforms, no 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** real file backs the shared memory. On platforms where the shared 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** memory is backed by a file, the file's name in the filesystem is 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** visible to other processes for only the duration of the creation of 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** the file, hopefully a very short time. This restricts processess 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** that do not inherit the shared memory from opening the file and 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** reading or writing its contents. Further, when all processes 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** using an anonymous shared memory terminate, the backing file is 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** deleted. ... If you are not paranoid, you're not paying attention. 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** The file-mapped shared memory requires a protocol for the parent 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** process and child process to share the memory. NSPR provides two 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** protocols. Use one or the other; don't mix and match. 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** In the first protocol, the job of passing the inheritable shared 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** memory is done via helper-functions with PR_CreateProcess(). In the 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** second protocol, the parent process is responsible for creating the 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** child process; the parent and child are mutually responsible for 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** passing a FileMap string. NSPR provides helper functions for 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** extracting data from the PRFileMap object. ... See the examples 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** below. 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Both sides should adhere strictly to the protocol for proper 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** operation. The pseudo-code below shows the use of a file-mapped 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** shared memory by a parent and child processes. In the examples, the 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** server creates the file-mapped shared memory, the client attaches to 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** it. 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** First protocol. 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Server: 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm = PR_OpenAnonFileMap(dirName, size, FilemapProt); 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** addr = PR_MemMap(fm); 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** attr = PR_NewProcessAttr(); 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ProcessAttrSetInheritableFileMap( attr, fm, shmname ); 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_CreateProcess(Client); 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_DestroyProcessAttr(attr); 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... yadda ... 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_MemUnmap( addr ); 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_CloseFileMap(fm); 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Client: 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... started by server via PR_CreateProcess() 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm = PR_GetInheritedFileMap( shmname ); 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** addr = PR_MemMap(fm); 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... yadda ... 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_MemUnmap(addr); 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_CloseFileMap(fm); 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Second Protocol: 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Server: 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm = PR_OpenAnonFileMap(dirName, size, FilemapProt); 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fmstring = PR_ExportFileMapAsString( fm ); 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** addr = PR_MemMap(fm); 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... application specific technique to pass fmstring to child 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... yadda ... Server uses his own magic to create child 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_MemUnmap( addr ); 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_CloseFileMap(fm); 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Client: 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... started by server via his own magic 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... application specific technique to find fmstring from parent 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm = PR_ImportFileMapFromString( fmstring ) 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** addr = PR_MemMap(fm); 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** ... yadda ... 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_MemUnmap(addr); 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_CloseFileMap(fm); 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** lth. 2-Jul-1999. 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Note: The second protocol was requested by NelsonB (7/1999); this is 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** to accomodate servers which already create their own child processes 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** using platform native methods. 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef prshma_h___ 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define prshma_h___ 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "prtypes.h" 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "prio.h" 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "prproces.h" 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_BEGIN_EXTERN_C 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Description: 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_OpenAnonFileMap() creates an anonymous shared memory. If the 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** shared memory already exists, a handle is returned to that shared 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** memory object. 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** On Unix platforms, PR_OpenAnonFileMap() uses 'dirName' as a 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** directory name, without the trailing '/', to contain the anonymous 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** file. A filename is generated for the name. 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** On Windows platforms, dirName is ignored. 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inputs: 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** dirName -- A directory name to contain the anonymous file. 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** size -- The size of the shared memory 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** prot -- How the shared memory is mapped. See prio.h 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Outputs: 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRFileMap * 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Returns: 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Pointer to PRFileMap or NULL on error. 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NSPR_API( PRFileMap *) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_OpenAnonFileMap( 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *dirName, 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRSize size, 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRFileMapProtect prot 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** to my children processes via PR_CreateProcess() 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Description: 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ProcessAttrSetInheritableFileMap() connects the PRFileMap to 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRProcessAttr with shmname. A subsequent call to PR_CreateProcess() 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** makes the PRFileMap importable by the child process. 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inputs: 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** attr -- PRProcessAttr, used to pass data to PR_CreateProcess() 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm -- PRFileMap structure to be passed to the child process 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** shmname -- The name for the PRFileMap; used by child. 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Outputs: 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRFileMap * 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Returns: 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRStatus 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NSPR_API(PRStatus) 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_ProcessAttrSetInheritableFileMap( 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRProcessAttr *attr, 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRFileMap *fm, 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *shmname 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** by my parent process via PR_CreateProcess() 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Description: 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_GetInheritedFileMap() retrieves a PRFileMap object exported from 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** its parent process via PR_CreateProcess(). 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inputs: 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** shmname -- The name provided to PR_ProcessAttrSetInheritableFileMap() 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Outputs: 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRFileMap * 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Returns: 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRFileMap pointer or NULL. 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NSPR_API( PRFileMap *) 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_GetInheritedFileMap( 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *shmname 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Description: 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Creates an identifier, as a string, from a PRFileMap object 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** previously created with PR_OpenAnonFileMap(). 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inputs: 2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fm -- PRFileMap pointer to be represented as a string. 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** bufsize -- sizeof(buf) 2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** buf -- a buffer of length PR_FILEMAP_STRING_BUFSIZE 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Outputs: 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** buf contains the stringized PRFileMap identifier 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Returns: 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRStatus 2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NSPR_API( PRStatus ) 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_ExportFileMapAsString( 2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRFileMap *fm, 2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PRSize bufsize, 2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) char *buf 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PR_FILEMAP_STRING_BUFSIZE 128 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying string 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Description: 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PR_ImportFileMapFromString() creates a PRFileMap object from a 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** string previously created by PR_ExportFileMapAsString(). 2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inputs: 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** fmstring -- string created by PR_ExportFileMapAsString() 2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Returns: 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PRFileMap pointer or NULL. 2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NSPR_API( PRFileMap * ) 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_ImportFileMapFromString( 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *fmstring 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PR_END_EXTERN_C 2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif /* prshma_h___ */ 269