nsprpub/pr/src/memory/prshma.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/src/memory/prshma.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,110 @@
     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 +** prshma.h -- NSPR Anonymous Shared Memory
    1.11 +**
    1.12 +** 
    1.13 +*/
    1.14 +
    1.15 +#include "primpl.h"
    1.16 +
    1.17 +extern PRLogModuleInfo *_pr_shma_lm;
    1.18 +
    1.19 +#if defined(XP_UNIX)
    1.20 +/* defined in pr/src/md/unix/uxshm.c */
    1.21 +#elif defined(WIN32)
    1.22 +/* defined in pr/src/md/windows/w32shm.c */
    1.23 +#else
    1.24 +extern PRFileMap * _PR_MD_OPEN_ANON_FILE_MAP( const char *dirName, PRSize size, PRFileMapProtect prot )
    1.25 +{
    1.26 +    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    1.27 +    return NULL;
    1.28 +}
    1.29 +extern PRStatus _PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap *fm, PRSize bufSize, char *buf)
    1.30 +{
    1.31 +    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    1.32 +    return PR_FAILURE;
    1.33 +}
    1.34 +extern PRFileMap * _PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char *fmstring)
    1.35 +{
    1.36 +    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    1.37 +    return NULL;
    1.38 +}
    1.39 +#endif
    1.40 +
    1.41 +/*
    1.42 +** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory
    1.43 +**
    1.44 +*/
    1.45 +PR_IMPLEMENT(PRFileMap*)
    1.46 +PR_OpenAnonFileMap(
    1.47 +    const char *dirName,
    1.48 +    PRSize      size, 
    1.49 +    PRFileMapProtect prot
    1.50 +)
    1.51 +{
    1.52 +    return(_PR_MD_OPEN_ANON_FILE_MAP( dirName, size, prot ));
    1.53 +} /* end PR_OpenAnonFileMap() */
    1.54 +
    1.55 +/*
    1.56 +** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export  
    1.57 +**   to my children processes via PR_CreateProcess()
    1.58 +**
    1.59 +**
    1.60 +*/
    1.61 +PR_IMPLEMENT( PRStatus) 
    1.62 +PR_ProcessAttrSetInheritableFileMap( 
    1.63 +    PRProcessAttr   *attr,
    1.64 +    PRFileMap       *fm, 
    1.65 +    const char      *shmname
    1.66 +)
    1.67 +{
    1.68 +    PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
    1.69 +    return( PR_FAILURE);
    1.70 +} /* end PR_ProcessAttrSetInheritableFileMap() */ 
    1.71 +
    1.72 +/*
    1.73 +** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported
    1.74 +**   by my parent process via PR_CreateProcess()
    1.75 +**
    1.76 +*/
    1.77 +PR_IMPLEMENT( PRFileMap *)
    1.78 +PR_GetInheritedFileMap( 
    1.79 +    const char *shmname 
    1.80 +)
    1.81 +{
    1.82 +    PRFileMap   *fm = NULL;
    1.83 +    PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
    1.84 +    return( fm );
    1.85 +} /* end PR_GetInhteritedFileMap() */
    1.86 +
    1.87 +/*
    1.88 +** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap
    1.89 +**
    1.90 +*/
    1.91 +PR_IMPLEMENT( PRStatus )
    1.92 +PR_ExportFileMapAsString( 
    1.93 +    PRFileMap *fm,
    1.94 +    PRSize    bufSize,
    1.95 +    char      *buf
    1.96 +)
    1.97 +{
    1.98 +    return( _PR_MD_EXPORT_FILE_MAP_AS_STRING( fm, bufSize, buf ));
    1.99 +} /* end PR_ExportFileMapAsString() */
   1.100 +
   1.101 +/*
   1.102 +** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying string
   1.103 +**
   1.104 +**
   1.105 +*/
   1.106 +PR_IMPLEMENT( PRFileMap * )
   1.107 +PR_ImportFileMapFromString( 
   1.108 +    const char *fmstring
   1.109 +)
   1.110 +{
   1.111 +    return( _PR_MD_IMPORT_FILE_MAP_FROM_STRING(fmstring));
   1.112 +} /* end PR_ImportFileMapFromString() */
   1.113 +/* end prshma.c */

mercurial