|
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 |
|
17 #if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY |
|
18 /* SysV implementation is in pr/src/md/unix/uxshm.c */ |
|
19 #elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY |
|
20 /* Posix implementation is in pr/src/md/unix/uxshm.c */ |
|
21 #elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY |
|
22 /* Win32 implementation is in pr/src/md/windows/w32shm.c */ |
|
23 #else |
|
24 /* |
|
25 ** there is no named_shared_memory |
|
26 */ |
|
27 extern PRSharedMemory* _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, PRIntn mode ) |
|
28 { |
|
29 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
|
30 return NULL; |
|
31 } |
|
32 |
|
33 extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) |
|
34 { |
|
35 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
|
36 return NULL; |
|
37 } |
|
38 |
|
39 extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) |
|
40 { |
|
41 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
|
42 return PR_FAILURE; |
|
43 } |
|
44 |
|
45 extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) |
|
46 { |
|
47 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
|
48 return PR_FAILURE; |
|
49 } |
|
50 |
|
51 extern PRStatus _MD_DeleteSharedMemory( const char *name ) |
|
52 { |
|
53 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
|
54 return PR_FAILURE; |
|
55 } |
|
56 #endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */ |
|
57 |
|
58 /* |
|
59 ** FUNCTION: PR_OpenSharedMemory() |
|
60 ** |
|
61 */ |
|
62 PR_IMPLEMENT( PRSharedMemory * ) |
|
63 PR_OpenSharedMemory( |
|
64 const char *name, |
|
65 PRSize size, |
|
66 PRIntn flags, |
|
67 PRIntn mode |
|
68 ) |
|
69 { |
|
70 if (!_pr_initialized) _PR_ImplicitInitialization(); |
|
71 return( _PR_MD_OPEN_SHARED_MEMORY( name, size, flags, mode )); |
|
72 } /* end PR_OpenSharedMemory() */ |
|
73 |
|
74 /* |
|
75 ** FUNCTION: PR_AttachSharedMemory() |
|
76 ** |
|
77 */ |
|
78 PR_IMPLEMENT( void * ) |
|
79 PR_AttachSharedMemory( |
|
80 PRSharedMemory *shm, |
|
81 PRIntn flags |
|
82 ) |
|
83 { |
|
84 return( _PR_MD_ATTACH_SHARED_MEMORY( shm, flags )); |
|
85 } /* end PR_AttachSharedMemory() */ |
|
86 |
|
87 /* |
|
88 ** FUNCTION: PR_DetachSharedMemory() |
|
89 ** |
|
90 */ |
|
91 PR_IMPLEMENT( PRStatus ) |
|
92 PR_DetachSharedMemory( |
|
93 PRSharedMemory *shm, |
|
94 void *addr |
|
95 ) |
|
96 { |
|
97 return( _PR_MD_DETACH_SHARED_MEMORY( shm, addr )); |
|
98 } /* end PR_DetachSharedMemory() */ |
|
99 |
|
100 /* |
|
101 ** FUNCTION: PR_CloseSharedMemory() |
|
102 ** |
|
103 */ |
|
104 PR_IMPLEMENT( PRStatus ) |
|
105 PR_CloseSharedMemory( |
|
106 PRSharedMemory *shm |
|
107 ) |
|
108 { |
|
109 return( _PR_MD_CLOSE_SHARED_MEMORY( shm )); |
|
110 } /* end PR_CloseSharedMemory() */ |
|
111 |
|
112 /* |
|
113 ** FUNCTION: PR_DeleteSharedMemory() |
|
114 ** |
|
115 */ |
|
116 PR_EXTERN( PRStatus ) |
|
117 PR_DeleteSharedMemory( |
|
118 const char *name |
|
119 ) |
|
120 { |
|
121 if (!_pr_initialized) _PR_ImplicitInitialization(); |
|
122 return(_PR_MD_DELETE_SHARED_MEMORY( name )); |
|
123 } /* end PR_DestroySharedMemory() */ |
|
124 /* end prshm.c */ |