1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 /*
7 ** prshma.h -- NSPR Anonymous Shared Memory
8 **
9 **
10 */
11 
12 #include "primpl.h"
13 
14 extern PRLogModuleInfo *_pr_shma_lm;
15 
16 #if defined(XP_UNIX)
17 /* defined in pr/src/md/unix/uxshm.c */
18 #elif defined(WIN32)
19 /* defined in pr/src/md/windows/w32shm.c */
20 #else
_PR_MD_OPEN_ANON_FILE_MAP(const char * dirName,PRSize size,PRFileMapProtect prot)21 extern PRFileMap * _PR_MD_OPEN_ANON_FILE_MAP( const char *dirName, PRSize size, PRFileMapProtect prot )
22 {
23     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
24     return NULL;
25 }
_PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap * fm,PRSize bufSize,char * buf)26 extern PRStatus _PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap *fm, PRSize bufSize, char *buf)
27 {
28     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
29     return PR_FAILURE;
30 }
_PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char * fmstring)31 extern PRFileMap * _PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char *fmstring)
32 {
33     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
34     return NULL;
35 }
36 #endif
37 
38 /*
39 ** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory
40 **
41 */
42 PR_IMPLEMENT(PRFileMap*)
PR_OpenAnonFileMap(const char * dirName,PRSize size,PRFileMapProtect prot)43 PR_OpenAnonFileMap(
44     const char *dirName,
45     PRSize      size,
46     PRFileMapProtect prot
47 )
48 {
49     return(_PR_MD_OPEN_ANON_FILE_MAP( dirName, size, prot ));
50 } /* end PR_OpenAnonFileMap() */
51 
52 /*
53 ** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export
54 **   to my children processes via PR_CreateProcess()
55 **
56 **
57 */
58 PR_IMPLEMENT( PRStatus)
PR_ProcessAttrSetInheritableFileMap(PRProcessAttr * attr,PRFileMap * fm,const char * shmname)59 PR_ProcessAttrSetInheritableFileMap(
60     PRProcessAttr   *attr,
61     PRFileMap       *fm,
62     const char      *shmname
63 )
64 {
65     PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
66     return( PR_FAILURE);
67 } /* end PR_ProcessAttrSetInheritableFileMap() */
68 
69 /*
70 ** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported
71 **   by my parent process via PR_CreateProcess()
72 **
73 */
74 PR_IMPLEMENT( PRFileMap *)
PR_GetInheritedFileMap(const char * shmname)75 PR_GetInheritedFileMap(
76     const char *shmname
77 )
78 {
79     PRFileMap   *fm = NULL;
80     PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
81     return( fm );
82 } /* end PR_GetInhteritedFileMap() */
83 
84 /*
85 ** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap
86 **
87 */
88 PR_IMPLEMENT( PRStatus )
PR_ExportFileMapAsString(PRFileMap * fm,PRSize bufSize,char * buf)89 PR_ExportFileMapAsString(
90     PRFileMap *fm,
91     PRSize    bufSize,
92     char      *buf
93 )
94 {
95     return( _PR_MD_EXPORT_FILE_MAP_AS_STRING( fm, bufSize, buf ));
96 } /* end PR_ExportFileMapAsString() */
97 
98 /*
99 ** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying string
100 **
101 **
102 */
103 PR_IMPLEMENT( PRFileMap * )
PR_ImportFileMapFromString(const char * fmstring)104 PR_ImportFileMapFromString(
105     const char *fmstring
106 )
107 {
108     return( _PR_MD_IMPORT_FILE_MAP_FROM_STRING(fmstring));
109 } /* end PR_ImportFileMapFromString() */
110 /* end prshma.c */
111