1251875Speter/* Licensed to the Apache Software Foundation (ASF) under one or more 2251875Speter * contributor license agreements. See the NOTICE file distributed with 3251875Speter * this work for additional information regarding copyright ownership. 4251875Speter * The ASF licenses this file to You under the Apache License, Version 2.0 5251875Speter * (the "License"); you may not use this file except in compliance with 6251875Speter * the License. You may obtain a copy of the License at 7251875Speter * 8251875Speter * http://www.apache.org/licenses/LICENSE-2.0 9251875Speter * 10251875Speter * Unless required by applicable law or agreed to in writing, software 11251875Speter * distributed under the License is distributed on an "AS IS" BASIS, 12251875Speter * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13251875Speter * See the License for the specific language governing permissions and 14251875Speter * limitations under the License. 15251875Speter */ 16251875Speter 17251875Speter#ifndef SHM_H 18251875Speter#define SHM_H 19251875Speter 20251875Speter#include "apr.h" 21251875Speter#include "apr_private.h" 22251875Speter#include "apr_general.h" 23251875Speter#include "apr_lib.h" 24251875Speter#include "apr_shm.h" 25251875Speter#include "apr_pools.h" 26251875Speter#include "apr_file_io.h" 27251875Speter#include "apr_network_io.h" 28251875Speter#include "apr_portable.h" 29251875Speter 30251875Speter#if APR_HAVE_UNISTD_H 31251875Speter#include <unistd.h> 32251875Speter#endif 33251875Speter#ifdef HAVE_SYS_MMAN_H 34251875Speter#include <sys/mman.h> 35251875Speter#endif 36251875Speter#ifdef HAVE_SYS_IPC_H 37251875Speter#include <sys/ipc.h> 38251875Speter#endif 39251875Speter#ifdef HAVE_SYS_MUTEX_H 40251875Speter#include <sys/mutex.h> 41251875Speter#endif 42251875Speter#ifdef HAVE_SYS_SHM_H 43251875Speter#include <sys/shm.h> 44251875Speter#endif 45251875Speter#if !defined(SHM_R) 46251875Speter#define SHM_R 0400 47251875Speter#endif 48251875Speter#if !defined(SHM_W) 49251875Speter#define SHM_W 0200 50251875Speter#endif 51251875Speter#ifdef HAVE_SYS_FILE_H 52251875Speter#include <sys/file.h> 53251875Speter#endif 54251875Speter 55251875Speter/* Not all systems seem to have MAP_FAILED defined, but it should always 56251875Speter * just be (void *)-1. */ 57251875Speter#ifndef MAP_FAILED 58251875Speter#define MAP_FAILED ((void *)-1) 59251875Speter#endif 60251875Speter 61251875Speterstruct apr_shm_t { 62251875Speter apr_pool_t *pool; 63251875Speter void *base; /* base real address */ 64251875Speter void *usable; /* base usable address */ 65251875Speter apr_size_t reqsize; /* requested segment size */ 66251875Speter apr_size_t realsize; /* actual segment size */ 67251875Speter const char *filename; /* NULL if anonymous */ 68251875Speter#if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON 69251875Speter int shmid; /* shmem ID returned from shmget() */ 70251875Speter#endif 71251875Speter}; 72251875Speter 73251875Speter#endif /* SHM_H */ 74