Back to index

lightning-sunbird  0.9+nobinonly
prshm.c
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /*
00039 ** prshm.c -- NSPR Named Shared Memory
00040 **
00041 ** lth. Jul-1999.
00042 */
00043 #include <string.h>
00044 #include "primpl.h"
00045 
00046 extern PRLogModuleInfo *_pr_shm_lm;
00047 
00048 
00049 #if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY
00050 /* SysV implementation is in pr/src/md/unix/uxshm.c */
00051 #elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY
00052 /* Posix implementation is in pr/src/md/unix/uxshm.c */
00053 #elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY
00054 /* Win32 implementation is in pr/src/md/windows/w32shm.c */
00055 #else 
00056 /* 
00057 **  there is no named_shared_memory 
00058 */
00059 extern PRSharedMemory*  _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, PRIntn mode )
00060 {
00061     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00062     return NULL;
00063 }    
00064 
00065 extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags )
00066 {
00067     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00068     return NULL;
00069 }    
00070 
00071 extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr )
00072 {
00073     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00074     return PR_FAILURE;
00075 }    
00076 
00077 extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm )
00078 {
00079     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00080     return PR_FAILURE;
00081 }    
00082 
00083 extern PRStatus _MD_DeleteSharedMemory( const char *name )
00084 {
00085     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
00086     return PR_FAILURE;
00087 }    
00088 #endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */
00089 
00090 /*
00091 ** FUNCTION: PR_OpenSharedMemory()
00092 **
00093 */
00094 PR_IMPLEMENT( PRSharedMemory * )
00095     PR_OpenSharedMemory(
00096         const char *name,
00097         PRSize      size,
00098         PRIntn      flags,
00099         PRIntn      mode
00100 )
00101 {
00102     if (!_pr_initialized) _PR_ImplicitInitialization();
00103     return( _PR_MD_OPEN_SHARED_MEMORY( name, size, flags, mode ));
00104 } /* end PR_OpenSharedMemory() */
00105 
00106 /*
00107 ** FUNCTION: PR_AttachSharedMemory()
00108 **
00109 */
00110 PR_IMPLEMENT( void * )
00111     PR_AttachSharedMemory(
00112         PRSharedMemory *shm,
00113         PRIntn          flags
00114 )
00115 {
00116     return( _PR_MD_ATTACH_SHARED_MEMORY( shm, flags ));
00117 } /* end PR_AttachSharedMemory() */
00118 
00119 /*
00120 ** FUNCTION: PR_DetachSharedMemory()
00121 **
00122 */
00123 PR_IMPLEMENT( PRStatus )
00124     PR_DetachSharedMemory(
00125         PRSharedMemory *shm,
00126         void *addr
00127 )
00128 {
00129     return( _PR_MD_DETACH_SHARED_MEMORY( shm, addr ));
00130 } /* end PR_DetachSharedMemory() */
00131 
00132 /*
00133 ** FUNCTION: PR_CloseSharedMemory()
00134 **
00135 */
00136 PR_IMPLEMENT( PRStatus )
00137     PR_CloseSharedMemory(
00138         PRSharedMemory *shm
00139 )
00140 {
00141     return( _PR_MD_CLOSE_SHARED_MEMORY( shm ));
00142 } /* end PR_CloseSharedMemory() */
00143 
00144 /*
00145 ** FUNCTION: PR_DeleteSharedMemory()
00146 **
00147 */
00148 PR_EXTERN( PRStatus )
00149     PR_DeleteSharedMemory(
00150         const char *name
00151 )
00152 {
00153     if (!_pr_initialized) _PR_ImplicitInitialization();
00154     return(_PR_MD_DELETE_SHARED_MEMORY( name ));
00155 } /* end PR_DestroySharedMemory() */
00156 /* end prshm.c */