Debian Codegraph @

nsprpub/pr/src/memory/prshm.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 ** prshm.c -- NSPR Named Shared Memory
8 **
9 ** lth. Jul-1999.
10 */
11 #include <string.h>
12 #include "primpl.h"
13
14 extern PRLogModuleInfo* _pr_shm_lm;
15
16 #if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY
17 /* SysV implementation is in pr/src/md/unix/uxshm.c */
18 #elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY
19 /* Posix implementation is in pr/src/md/unix/uxshm.c */
20 #elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY
21 /* Win32 implementation is in pr/src/md/windows/w32shm.c */
22 #else
23 /*
24 ** there is no named_shared_memory
25 */
26 extern PRSharedMemory* _MD_OpenSharedMemory(const char* name, PRSize size,
27 PRIntn flags, PRIntn mode) {
28 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
29 return NULL;
30 }
31
32 extern void* _MD_AttachSharedMemory(PRSharedMemory* shm, PRIntn flags) {
33 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
34 return NULL;
35 }
36
37 extern PRStatus _MD_DetachSharedMemory(PRSharedMemory* shm, void* addr) {
38 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
39 return PR_FAILURE;
40 }
41
42 extern PRStatus _MD_CloseSharedMemory(PRSharedMemory* shm) {
43 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
44 return PR_FAILURE;
45 }
46
47 extern PRStatus _MD_DeleteSharedMemory(const char* name) {
48 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
49 return PR_FAILURE;
50 }
51 #endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */
52
53 /*
54 ** FUNCTION: PR_OpenSharedMemory()
55 **
56 */
57 PR_IMPLEMENT(PRSharedMemory*)
58 PR_OpenSharedMemory(const char* name, PRSize size, PRIntn flags, PRIntn mode) {
59 if (!_pr_initialized) {
60 _PR_ImplicitInitialization();
61 }
62 return (_PR_MD_OPEN_SHARED_MEMORY(name, size, flags, mode));
63 } /* end PR_OpenSharedMemory() */
64
65 /*
66 ** FUNCTION: PR_AttachSharedMemory()
67 **
68 */
69 PR_IMPLEMENT(void*)
70 PR_AttachSharedMemory(PRSharedMemory* shm, PRIntn flags) {
71 return (_PR_MD_ATTACH_SHARED_MEMORY(shm, flags));
72 } /* end PR_AttachSharedMemory() */
73
74 /*
75 ** FUNCTION: PR_DetachSharedMemory()
76 **
77 */
78 PR_IMPLEMENT(PRStatus)
79 PR_DetachSharedMemory(PRSharedMemory* shm, void* addr) {
80 return (_PR_MD_DETACH_SHARED_MEMORY(shm, addr));
81 } /* end PR_DetachSharedMemory() */
82
83 /*
84 ** FUNCTION: PR_CloseSharedMemory()
85 **
86 */
87 PR_IMPLEMENT(PRStatus)
88 PR_CloseSharedMemory(PRSharedMemory* shm) {
89 return (_PR_MD_CLOSE_SHARED_MEMORY(shm));
90 } /* end PR_CloseSharedMemory() */
91
92 /*
93 ** FUNCTION: PR_DeleteSharedMemory()
94 **
95 */
96 PR_EXTERN(PRStatus)
97 PR_DeleteSharedMemory(const char* name) {
98 if (!_pr_initialized) {
99 _PR_ImplicitInitialization();
100 }
101 return (_PR_MD_DELETE_SHARED_MEMORY(name));
102 } /* end PR_DestroySharedMemory() */
103 /* end prshm.c */