Debian Codegraph @

nsprpub/pr/src/memory/prshma.c

raw
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
21 extern PRFileMap* _PR_MD_OPEN_ANON_FILE_MAP(const char* dirName, PRSize size,
22 PRFileMapProtect prot) {
23 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
24 return NULL;
25 }
26 extern PRStatus _PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap* fm, PRSize bufSize,
27 char* buf) {
28 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
29 return PR_FAILURE;
30 }
31 extern PRFileMap* _PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char* fmstring) {
32 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
33 return NULL;
34 }
35 #endif
36
37 /*
38 ** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory
39 **
40 */
41 PR_IMPLEMENT(PRFileMap*)
42 PR_OpenAnonFileMap(const char* dirName, PRSize size, PRFileMapProtect prot) {
43 return (_PR_MD_OPEN_ANON_FILE_MAP(dirName, size, prot));
44 } /* end PR_OpenAnonFileMap() */
45
46 /*
47 ** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export
48 ** to my children processes via PR_CreateProcess()
49 **
50 **
51 */
52 PR_IMPLEMENT(PRStatus)
53 PR_ProcessAttrSetInheritableFileMap(PRProcessAttr* attr, PRFileMap* fm,
54 const char* shmname) {
55 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
56 return (PR_FAILURE);
57 } /* end PR_ProcessAttrSetInheritableFileMap() */
58
59 /*
60 ** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported
61 ** by my parent process via PR_CreateProcess()
62 **
63 */
64 PR_IMPLEMENT(PRFileMap*)
65 PR_GetInheritedFileMap(const char* shmname) {
66 PRFileMap* fm = NULL;
67 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
68 return (fm);
69 } /* end PR_GetInhteritedFileMap() */
70
71 /*
72 ** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap
73 **
74 */
75 PR_IMPLEMENT(PRStatus)
76 PR_ExportFileMapAsString(PRFileMap* fm, PRSize bufSize, char* buf) {
77 return (_PR_MD_EXPORT_FILE_MAP_AS_STRING(fm, bufSize, buf));
78 } /* end PR_ExportFileMapAsString() */
79
80 /*
81 ** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying
82 *string
83 **
84 **
85 */
86 PR_IMPLEMENT(PRFileMap*)
87 PR_ImportFileMapFromString(const char* fmstring) {
88 return (_PR_MD_IMPORT_FILE_MAP_FROM_STRING(fmstring));
89 } /* end PR_ImportFileMapFromString() */
90 /* end prshma.c */