Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

_shm.h

Go to the documentation of this file.
00001 
00002 #ifndef _SHAREDMEM_H
00003 #define _SHAREDMEM_H
00004 
00005 #include "rcs_defs.hh"
00006 #ifdef WIN32
00007 
00008 #if defined(WIN32) && !defined(USE_OLD_WINSOCK)
00009 /* Lame problem if windows.h is included before winsock2.h many redefined
00010  compiler errors result. */
00011 #include <winsock2.h>
00012 #endif
00013 
00014 #include <windows.h>
00015 #endif
00016 
00017 /* Purely local shared memory functions-- converting System V shared
00018    memory to POSIX shared memory required something intermediate in
00019    System V IPC that returned a file descriptor suitable for mmap(),
00020    and that something doesn't exist. */
00021 
00022 #ifndef WIN32
00023 #include <sys/types.h>          /* key_t */
00024 #endif
00025 
00026 #if !defined(VXWORKS) && !defined(DOS_WINDOWS)
00027 #include <sys/ipc.h>
00028 #endif
00029 
00030 #ifndef UNDER_CE
00031 #include <stddef.h>             /* size_t */
00032 #endif
00033 
00034 #ifndef KEY_T_DEFINED
00035 #define KEY_T_DEFINED
00036 #if defined(VXWORKS)
00037 typedef int key_t;              /* key_t is not defined in VxWorks or  Windows -- do
00038                                    it here, and it should be visible
00039                                    throughout all the shared mem code */
00040 #endif
00041 
00042 #if defined(WIN32)
00043 typedef long key_t;
00044 #endif
00045 
00046 #endif /* KEY_T_DEFINED */
00047 
00048 typedef struct
00049 {
00050   int id;
00051   void *addr;
00052   int create_errno;
00053   size_t size;
00054   int count;
00055   int created;
00056   int key;
00057 #ifdef WIN32
00058   HANDLE hFileMap;
00059 #endif
00060 #ifdef qnx
00061   char name[64];
00062 #endif
00063 }
00064 shm_t;
00065 
00066 #ifdef __cplusplus
00067 extern "C"
00068 {
00069 #endif
00070   extern shm_t *rcs_shm_open (key_t key, size_t size, int oflag,
00071                               /* int mode */ ...);
00072   extern int rcs_shm_close (shm_t * shm);
00073   extern int rcs_shm_delete (shm_t * shm);
00074   extern int rcs_shm_nattch (shm_t * shm);
00075 
00076 #ifdef VXWORKS
00077   void rcs_shm_table_print ();
00078 
00079   extern int rcs_shm_table_inited;
00080   extern int task_lock_shm_stuff;
00081   extern int print_rcs_shm_warnings;
00082 
00083 #endif
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #if defined(qnx) && !defined(USE_POSIX_SHAREDMEM)
00090 #define USE_POSIX_SHAREDMEM 1
00091 #include <fcntl.h>
00092 #include <sys/mman.h>
00093 #endif
00094 
00095 
00096 #endif

Generated on Sun Dec 2 15:56:48 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001