1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/src/memory/prshm.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,124 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 +** prshm.c -- NSPR Named Shared Memory 1.11 +** 1.12 +** lth. Jul-1999. 1.13 +*/ 1.14 +#include <string.h> 1.15 +#include "primpl.h" 1.16 + 1.17 +extern PRLogModuleInfo *_pr_shm_lm; 1.18 + 1.19 + 1.20 +#if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY 1.21 +/* SysV implementation is in pr/src/md/unix/uxshm.c */ 1.22 +#elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY 1.23 +/* Posix implementation is in pr/src/md/unix/uxshm.c */ 1.24 +#elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY 1.25 +/* Win32 implementation is in pr/src/md/windows/w32shm.c */ 1.26 +#else 1.27 +/* 1.28 +** there is no named_shared_memory 1.29 +*/ 1.30 +extern PRSharedMemory* _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, PRIntn mode ) 1.31 +{ 1.32 + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); 1.33 + return NULL; 1.34 +} 1.35 + 1.36 +extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) 1.37 +{ 1.38 + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); 1.39 + return NULL; 1.40 +} 1.41 + 1.42 +extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) 1.43 +{ 1.44 + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); 1.45 + return PR_FAILURE; 1.46 +} 1.47 + 1.48 +extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) 1.49 +{ 1.50 + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); 1.51 + return PR_FAILURE; 1.52 +} 1.53 + 1.54 +extern PRStatus _MD_DeleteSharedMemory( const char *name ) 1.55 +{ 1.56 + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); 1.57 + return PR_FAILURE; 1.58 +} 1.59 +#endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */ 1.60 + 1.61 +/* 1.62 +** FUNCTION: PR_OpenSharedMemory() 1.63 +** 1.64 +*/ 1.65 +PR_IMPLEMENT( PRSharedMemory * ) 1.66 + PR_OpenSharedMemory( 1.67 + const char *name, 1.68 + PRSize size, 1.69 + PRIntn flags, 1.70 + PRIntn mode 1.71 +) 1.72 +{ 1.73 + if (!_pr_initialized) _PR_ImplicitInitialization(); 1.74 + return( _PR_MD_OPEN_SHARED_MEMORY( name, size, flags, mode )); 1.75 +} /* end PR_OpenSharedMemory() */ 1.76 + 1.77 +/* 1.78 +** FUNCTION: PR_AttachSharedMemory() 1.79 +** 1.80 +*/ 1.81 +PR_IMPLEMENT( void * ) 1.82 + PR_AttachSharedMemory( 1.83 + PRSharedMemory *shm, 1.84 + PRIntn flags 1.85 +) 1.86 +{ 1.87 + return( _PR_MD_ATTACH_SHARED_MEMORY( shm, flags )); 1.88 +} /* end PR_AttachSharedMemory() */ 1.89 + 1.90 +/* 1.91 +** FUNCTION: PR_DetachSharedMemory() 1.92 +** 1.93 +*/ 1.94 +PR_IMPLEMENT( PRStatus ) 1.95 + PR_DetachSharedMemory( 1.96 + PRSharedMemory *shm, 1.97 + void *addr 1.98 +) 1.99 +{ 1.100 + return( _PR_MD_DETACH_SHARED_MEMORY( shm, addr )); 1.101 +} /* end PR_DetachSharedMemory() */ 1.102 + 1.103 +/* 1.104 +** FUNCTION: PR_CloseSharedMemory() 1.105 +** 1.106 +*/ 1.107 +PR_IMPLEMENT( PRStatus ) 1.108 + PR_CloseSharedMemory( 1.109 + PRSharedMemory *shm 1.110 +) 1.111 +{ 1.112 + return( _PR_MD_CLOSE_SHARED_MEMORY( shm )); 1.113 +} /* end PR_CloseSharedMemory() */ 1.114 + 1.115 +/* 1.116 +** FUNCTION: PR_DeleteSharedMemory() 1.117 +** 1.118 +*/ 1.119 +PR_EXTERN( PRStatus ) 1.120 + PR_DeleteSharedMemory( 1.121 + const char *name 1.122 +) 1.123 +{ 1.124 + if (!_pr_initialized) _PR_ImplicitInitialization(); 1.125 + return(_PR_MD_DELETE_SHARED_MEMORY( name )); 1.126 +} /* end PR_DestroySharedMemory() */ 1.127 +/* end prshm.c */