fspr_arch_shm.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef SHM_H
  17. #define SHM_H
  18. #include "fspr.h"
  19. #include "fspr_private.h"
  20. #include "fspr_general.h"
  21. #include "fspr_lib.h"
  22. #include "fspr_shm.h"
  23. #include "fspr_pools.h"
  24. #include "fspr_file_io.h"
  25. #include "fspr_network_io.h"
  26. #include "fspr_portable.h"
  27. #ifdef HAVE_SYS_MMAN_H
  28. #include <sys/mman.h>
  29. #endif
  30. #ifdef HAVE_SYS_IPC_H
  31. #include <sys/ipc.h>
  32. #endif
  33. #ifdef HAVE_SYS_MUTEX_H
  34. #include <sys/mutex.h>
  35. #endif
  36. #ifdef HAVE_SYS_SHM_H
  37. #include <sys/shm.h>
  38. #endif
  39. #if !defined(SHM_R)
  40. #define SHM_R 0400
  41. #endif
  42. #if !defined(SHM_W)
  43. #define SHM_W 0200
  44. #endif
  45. #ifdef HAVE_SYS_FILE_H
  46. #include <sys/file.h>
  47. #endif
  48. /* Not all systems seem to have MAP_FAILED defined, but it should always
  49. * just be (void *)-1. */
  50. #ifndef MAP_FAILED
  51. #define MAP_FAILED ((void *)-1)
  52. #endif
  53. struct fspr_shm_t {
  54. fspr_pool_t *pool;
  55. void *base; /* base real address */
  56. void *usable; /* base usable address */
  57. fspr_size_t reqsize; /* requested segment size */
  58. fspr_size_t realsize; /* actual segment size */
  59. const char *filename; /* NULL if anonymous */
  60. #if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON
  61. int shmid; /* shmem ID returned from shmget() */
  62. #endif
  63. };
  64. #endif /* SHM_H */