GME  13
apr_arch_shm.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef SHM_H
00018 #define SHM_H
00019 
00020 #include "apr.h"
00021 #include "apr_private.h"
00022 #include "apr_general.h"
00023 #include "apr_lib.h"
00024 #include "apr_shm.h"
00025 #include "apr_pools.h"
00026 #include "apr_file_io.h"
00027 #include "apr_network_io.h"
00028 #include "apr_portable.h"
00029 
00030 #if APR_HAVE_UNISTD_H
00031 #include <unistd.h>
00032 #endif
00033 #ifdef HAVE_SYS_MMAN_H
00034 #include <sys/mman.h>
00035 #endif
00036 #ifdef HAVE_SYS_IPC_H
00037 #include <sys/ipc.h>
00038 #endif
00039 #ifdef HAVE_SYS_MUTEX_H
00040 #include <sys/mutex.h>
00041 #endif
00042 #ifdef HAVE_SYS_SHM_H
00043 #include <sys/shm.h>
00044 #endif
00045 #if !defined(SHM_R)
00046 #define SHM_R 0400
00047 #endif
00048 #if !defined(SHM_W)
00049 #define SHM_W 0200
00050 #endif
00051 #ifdef HAVE_SYS_FILE_H
00052 #include <sys/file.h>
00053 #endif
00054 
00055 /* Not all systems seem to have MAP_FAILED defined, but it should always
00056  * just be (void *)-1. */
00057 #ifndef MAP_FAILED
00058 #define MAP_FAILED ((void *)-1)
00059 #endif
00060 
00061 struct apr_shm_t {
00062     apr_pool_t *pool;
00063     void *base;          /* base real address */
00064     void *usable;        /* base usable address */
00065     apr_size_t reqsize;  /* requested segment size */
00066     apr_size_t realsize; /* actual segment size */
00067     const char *filename;      /* NULL if anonymous */
00068 #if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON
00069     int shmid;          /* shmem ID returned from shmget() */
00070 #endif
00071 };
00072 
00073 #endif /* SHM_H */