Apache HTTPD
apr_arch_proc_mutex.h
Go to the documentation of this file.
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
17#ifndef PROC_MUTEX_H
18#define PROC_MUTEX_H
19
20#include "apr.h"
21#include "apr_private.h"
22#include "apr_general.h"
23#include "apr_lib.h"
24#include "apr_proc_mutex.h"
25#include "apr_pools.h"
26#include "apr_portable.h"
27#include "apr_file_io.h"
28#include "apr_arch_file_io.h"
29#include "apr_time.h"
30
31/* System headers required by Locks library */
32#if APR_HAVE_SYS_TYPES_H
33#include <sys/types.h>
34#endif
35#if APR_HAVE_STDIO_H
36#include <stdio.h>
37#endif
38#if APR_HAVE_FCNTL_H
39#include <fcntl.h>
40#endif
41
42#ifdef HAVE_SYS_IPC_H
43#include <sys/ipc.h>
44#endif
45#ifdef HAVE_SYS_SEM_H
46#include <sys/sem.h>
47#endif
48#ifdef HAVE_SYS_FILE_H
49#include <sys/file.h>
50#endif
51#if APR_HAVE_STDLIB_H
52#include <stdlib.h>
53#endif
54#if APR_HAVE_UNISTD_H
55#include <unistd.h>
56#endif
57#if APR_HAVE_STRING_H
58#include <string.h>
59#endif
60#ifdef HAVE_SYS_MMAN_H
61#include <sys/mman.h>
62#endif
63#if APR_HAVE_PTHREAD_H
64#include <pthread.h>
65#endif
66/* End System Headers */
67
82
83/* bit values for flags field in apr_unix_lock_methods_t */
84#define APR_PROCESS_LOCK_MECH_IS_GLOBAL 1
85
86#if !APR_HAVE_UNION_SEMUN && defined(APR_HAS_SYSVSEM_SERIALIZE)
87union semun {
88 int val;
89 struct semid_ds *buf;
90 unsigned short *array;
91};
92#endif
93
94struct apr_proc_mutex_t {
98 char *fname;
99
100 apr_os_proc_mutex_t os; /* Native mutex holder. */
101
102#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
103 apr_file_t *interproc; /* For apr_file_ calls on native fd. */
104 int interproc_closing; /* whether the native fd is opened/closed with
105 * 'interproc' or apr_os_file_put()ed (hence
106 * needing an an explicit close for consistency
107 * with other methods).
108 */
109#endif
110#if APR_HAS_PROC_PTHREAD_SERIALIZE
111 int pthread_refcounting; /* Whether the native mutex is refcounted or
112 * apr_os_proc_mutex_put()ed, which makes
113 * refcounting impossible/undesirable.
114 */
115#endif
116};
117
119
120#endif /* PROC_MUTEX_H */
121
APR File I/O Handling.
APR Miscellaneous library routines.
APR general purpose library routines.
APR memory allocation.
APR Portability Routines.
APR Process Locking Routines.
APR Time Library.
const unsigned char * buf
Definition util_md5.h:50
apr_size_t size
apr_uint32_t val
Definition apr_atomic.h:66
int apr_status_t
Definition apr_errno.h:44
apr_int32_t apr_fileperms_t
apr_lockmech_e
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
gid_t apr_gid_t
Definition apr_user.h:54
uid_t apr_uid_t
Definition apr_user.h:45
apr_os_proc_mutex_t os
const apr_proc_mutex_unix_lock_methods_t * meth
apr_status_t(* perms_set)(apr_proc_mutex_t *, apr_fileperms_t, apr_uid_t, apr_gid_t)
apr_status_t(* release)(apr_proc_mutex_t *)
apr_status_t(* timedacquire)(apr_proc_mutex_t *, apr_interval_time_t)
apr_status_t(* child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *)
apr_status_t(* tryacquire)(apr_proc_mutex_t *)
apr_status_t(* create)(apr_proc_mutex_t *, const char *)
apr_status_t(* acquire)(apr_proc_mutex_t *)
void apr_proc_mutex_unix_setup_lock(void)