Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | ** prshm.c -- NSPR Named Shared Memory |
michael@0 | 8 | ** |
michael@0 | 9 | ** lth. Jul-1999. |
michael@0 | 10 | */ |
michael@0 | 11 | #include <string.h> |
michael@0 | 12 | #include "primpl.h" |
michael@0 | 13 | |
michael@0 | 14 | extern PRLogModuleInfo *_pr_shm_lm; |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | #if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY |
michael@0 | 18 | /* SysV implementation is in pr/src/md/unix/uxshm.c */ |
michael@0 | 19 | #elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY |
michael@0 | 20 | /* Posix implementation is in pr/src/md/unix/uxshm.c */ |
michael@0 | 21 | #elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY |
michael@0 | 22 | /* Win32 implementation is in pr/src/md/windows/w32shm.c */ |
michael@0 | 23 | #else |
michael@0 | 24 | /* |
michael@0 | 25 | ** there is no named_shared_memory |
michael@0 | 26 | */ |
michael@0 | 27 | extern PRSharedMemory* _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, PRIntn mode ) |
michael@0 | 28 | { |
michael@0 | 29 | PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
michael@0 | 30 | return NULL; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) |
michael@0 | 34 | { |
michael@0 | 35 | PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
michael@0 | 36 | return NULL; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) |
michael@0 | 40 | { |
michael@0 | 41 | PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
michael@0 | 42 | return PR_FAILURE; |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) |
michael@0 | 46 | { |
michael@0 | 47 | PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
michael@0 | 48 | return PR_FAILURE; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | extern PRStatus _MD_DeleteSharedMemory( const char *name ) |
michael@0 | 52 | { |
michael@0 | 53 | PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
michael@0 | 54 | return PR_FAILURE; |
michael@0 | 55 | } |
michael@0 | 56 | #endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */ |
michael@0 | 57 | |
michael@0 | 58 | /* |
michael@0 | 59 | ** FUNCTION: PR_OpenSharedMemory() |
michael@0 | 60 | ** |
michael@0 | 61 | */ |
michael@0 | 62 | PR_IMPLEMENT( PRSharedMemory * ) |
michael@0 | 63 | PR_OpenSharedMemory( |
michael@0 | 64 | const char *name, |
michael@0 | 65 | PRSize size, |
michael@0 | 66 | PRIntn flags, |
michael@0 | 67 | PRIntn mode |
michael@0 | 68 | ) |
michael@0 | 69 | { |
michael@0 | 70 | if (!_pr_initialized) _PR_ImplicitInitialization(); |
michael@0 | 71 | return( _PR_MD_OPEN_SHARED_MEMORY( name, size, flags, mode )); |
michael@0 | 72 | } /* end PR_OpenSharedMemory() */ |
michael@0 | 73 | |
michael@0 | 74 | /* |
michael@0 | 75 | ** FUNCTION: PR_AttachSharedMemory() |
michael@0 | 76 | ** |
michael@0 | 77 | */ |
michael@0 | 78 | PR_IMPLEMENT( void * ) |
michael@0 | 79 | PR_AttachSharedMemory( |
michael@0 | 80 | PRSharedMemory *shm, |
michael@0 | 81 | PRIntn flags |
michael@0 | 82 | ) |
michael@0 | 83 | { |
michael@0 | 84 | return( _PR_MD_ATTACH_SHARED_MEMORY( shm, flags )); |
michael@0 | 85 | } /* end PR_AttachSharedMemory() */ |
michael@0 | 86 | |
michael@0 | 87 | /* |
michael@0 | 88 | ** FUNCTION: PR_DetachSharedMemory() |
michael@0 | 89 | ** |
michael@0 | 90 | */ |
michael@0 | 91 | PR_IMPLEMENT( PRStatus ) |
michael@0 | 92 | PR_DetachSharedMemory( |
michael@0 | 93 | PRSharedMemory *shm, |
michael@0 | 94 | void *addr |
michael@0 | 95 | ) |
michael@0 | 96 | { |
michael@0 | 97 | return( _PR_MD_DETACH_SHARED_MEMORY( shm, addr )); |
michael@0 | 98 | } /* end PR_DetachSharedMemory() */ |
michael@0 | 99 | |
michael@0 | 100 | /* |
michael@0 | 101 | ** FUNCTION: PR_CloseSharedMemory() |
michael@0 | 102 | ** |
michael@0 | 103 | */ |
michael@0 | 104 | PR_IMPLEMENT( PRStatus ) |
michael@0 | 105 | PR_CloseSharedMemory( |
michael@0 | 106 | PRSharedMemory *shm |
michael@0 | 107 | ) |
michael@0 | 108 | { |
michael@0 | 109 | return( _PR_MD_CLOSE_SHARED_MEMORY( shm )); |
michael@0 | 110 | } /* end PR_CloseSharedMemory() */ |
michael@0 | 111 | |
michael@0 | 112 | /* |
michael@0 | 113 | ** FUNCTION: PR_DeleteSharedMemory() |
michael@0 | 114 | ** |
michael@0 | 115 | */ |
michael@0 | 116 | PR_EXTERN( PRStatus ) |
michael@0 | 117 | PR_DeleteSharedMemory( |
michael@0 | 118 | const char *name |
michael@0 | 119 | ) |
michael@0 | 120 | { |
michael@0 | 121 | if (!_pr_initialized) _PR_ImplicitInitialization(); |
michael@0 | 122 | return(_PR_MD_DELETE_SHARED_MEMORY( name )); |
michael@0 | 123 | } /* end PR_DestroySharedMemory() */ |
michael@0 | 124 | /* end prshm.c */ |