Back to index

lightning-sunbird  0.9+nobinonly
prshma.c
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /*
00039 ** prshma.h -- NSPR Anonymous Shared Memory
00040 **
00041 ** 
00042 */
00043 
00044 #include "primpl.h"
00045 
00046 extern PRLogModuleInfo *_pr_shma_lm;
00047 
00048 #if defined(XP_UNIX)
00049 /* defined in pr/src/md/unix/uxshm.c */
00050 #elif defined(WIN32)
00051 /* defined in pr/src/md/windows/w32shm.c */
00052 #else
00053 extern PRFileMap * _PR_MD_OPEN_ANON_FILE_MAP( const char *dirName, PRSize size, PRFileMapProtect prot )
00054 {
00055     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00056     return NULL;
00057 }
00058 extern PRStatus _PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap *fm, PRSize bufSize, char *buf)
00059 {
00060     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00061     return PR_FAILURE;
00062 }
00063 extern PRFileMap * _PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char *fmstring)
00064 {
00065     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00066     return NULL;
00067 }
00068 #endif
00069 
00070 /*
00071 ** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory
00072 **
00073 */
00074 PR_IMPLEMENT(PRFileMap*)
00075 PR_OpenAnonFileMap(
00076     const char *dirName,
00077     PRSize      size, 
00078     PRFileMapProtect prot
00079 )
00080 {
00081     return(_PR_MD_OPEN_ANON_FILE_MAP( dirName, size, prot ));
00082 } /* end PR_OpenAnonFileMap() */
00083 
00084 /*
00085 ** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export  
00086 **   to my children processes via PR_CreateProcess()
00087 **
00088 **
00089 */
00090 PR_IMPLEMENT( PRStatus) 
00091 PR_ProcessAttrSetInheritableFileMap( 
00092     PRProcessAttr   *attr,
00093     PRFileMap       *fm, 
00094     const char      *shmname
00095 )
00096 {
00097     PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
00098     return( PR_FAILURE);
00099 } /* end PR_ProcessAttrSetInheritableFileMap() */ 
00100 
00101 /*
00102 ** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported
00103 **   by my parent process via PR_CreateProcess()
00104 **
00105 */
00106 PR_IMPLEMENT( PRFileMap *)
00107 PR_GetInheritedFileMap( 
00108     const char *shmname 
00109 )
00110 {
00111     PRFileMap   *fm = NULL;
00112     PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
00113     return( fm );
00114 } /* end PR_GetInhteritedFileMap() */
00115 
00116 /*
00117 ** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap
00118 **
00119 */
00120 PR_IMPLEMENT( PRStatus )
00121 PR_ExportFileMapAsString( 
00122     PRFileMap *fm,
00123     PRSize    bufSize,
00124     char      *buf
00125 )
00126 {
00127     return( _PR_MD_EXPORT_FILE_MAP_AS_STRING( fm, bufSize, buf ));
00128 } /* end PR_ExportFileMapAsString() */
00129 
00130 /*
00131 ** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying string
00132 **
00133 **
00134 */
00135 PR_IMPLEMENT( PRFileMap * )
00136 PR_ImportFileMapFromString( 
00137     const char *fmstring
00138 )
00139 {
00140     return( _PR_MD_IMPORT_FILE_MAP_FROM_STRING(fmstring));
00141 } /* end PR_ImportFileMapFromString() */
00142 /* end prshma.c */