/ src / libnml / os_intf / shm.hh
shm.hh
 1  /********************************************************************
 2  * Description: shm.hh
 3  *
 4  *   Derived from a work by Fred Proctor & Will Shackleford
 5  *
 6  * Author:
 7  * License: LGPL Version 2
 8  * System: Linux
 9  *    
10  * Copyright (c) 2004 All rights reserved.
11  *
12  * Last change: 
13  ********************************************************************/
14  
15  #ifndef SHAREDMEM_HH
16  #define SHAREDMEM_HH
17  
18  extern "C" {
19  #include <sys/types.h>		/* key_t */
20  #include <stddef.h>		/* size_t */
21  #include "_shm.h"		/* shm_t */
22  }
23  #define RCS_SHAREDMEM_NOCREATE 0x00	/* just attach to existing sharedmem */
24  #define RCS_SHAREDMEM_CREATE 0x01	/* create sharedmem */
25  class RCS_SHAREDMEM {
26    public:
27      RCS_SHAREDMEM(key_t key, size_t size, int oflag, int mode = 0);
28       ~RCS_SHAREDMEM();
29      int nattch();		/* how many processes are attached */
30      int create_errno;		/* 0 or stored errno after shmget failed */
31      void *addr;			/* pointer to shared memory */
32      int delete_totally;		/* Flag to clean the sharedmem completely */
33  
34    private:
35        shm_t * shm;
36    public:
37      int created;
38  
39    private:
40        RCS_SHAREDMEM(RCS_SHAREDMEM & shm);	// Don't copy me.
41  };
42  
43  #endif