Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
69  unsigned int flags;
70  apr_status_t (*create)(apr_proc_mutex_t *, const char *);
75  apr_status_t (*cleanup)(void *);
79  const char *name;
80 };
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)
87 union semun {
88  int val;
89  struct semid_ds *buf;
90  unsigned short *array;
91 };
92 #endif
93 
94 struct 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_os_proc_mutex_t os
Definition: apr_arch_proc_mutex.h:100
Definition: apr_portable.h:130
Definition: apr_arch_file_io.h:107
apr_pool_t * pool
Definition: apr_arch_proc_mutex.h:28
const char * name
Definition: apr_arch_proc_mutex.h:79
Definition: apr_arch_proc_mutex.h:27
const apr_proc_mutex_unix_lock_methods_t * meth
Definition: apr_arch_proc_mutex.h:96
uid_t apr_uid_t
Definition: apr_user.h:45
APR File I/O Handling.
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
APR Miscellaneous library routines.
apr_status_t(* timedacquire)(apr_proc_mutex_t *, apr_interval_time_t)
Definition: apr_arch_proc_mutex.h:73
int pthread_refcounting
Definition: apr_arch_proc_mutex.h:111
apr_status_t(* perms_set)(apr_proc_mutex_t *, apr_fileperms_t, apr_uid_t, apr_gid_t)
Definition: apr_arch_proc_mutex.h:77
APR memory allocation.
apr_int32_t apr_fileperms_t
Definition: apr_file_info.h:125
apr_status_t(* cleanup)(void *)
Definition: apr_arch_proc_mutex.h:75
int val
Definition: apr_arch_proc_mutex.h:88
apr_lockmech_e
Definition: apr_proc_mutex.h:46
APR Platform Definitions.
APR general purpose library routines.
Definition: apr_arch_proc_mutex.h:68
void apr_proc_mutex_unix_setup_lock(void)
APR Process Locking Routines.
int interproc_closing
Definition: apr_arch_proc_mutex.h:104
apr_status_t(* create)(apr_proc_mutex_t *, const char *)
Definition: apr_arch_proc_mutex.h:70
int curr_locked
Definition: apr_arch_proc_mutex.h:97
apr_status_t(* release)(apr_proc_mutex_t *)
Definition: apr_arch_proc_mutex.h:74
apr_status_t(* acquire)(apr_proc_mutex_t *)
Definition: apr_arch_proc_mutex.h:71
Definition: apr_arch_proc_mutex.h:87
gid_t apr_gid_t
Definition: apr_user.h:54
struct semid_ds * buf
Definition: apr_arch_proc_mutex.h:89
char * fname
Definition: apr_arch_proc_mutex.h:98
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_lockmech_e mech
Definition: apr_arch_proc_mutex.h:78
int apr_status_t
Definition: apr_errno.h:44
apr_status_t(* child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *)
Definition: apr_arch_proc_mutex.h:76
APR Time Library.
apr_status_t(* tryacquire)(apr_proc_mutex_t *)
Definition: apr_arch_proc_mutex.h:72
apr_file_t * interproc
Definition: apr_arch_proc_mutex.h:103
unsigned short * array
Definition: apr_arch_proc_mutex.h:90
APR Portability Routines.
unsigned int flags
Definition: apr_arch_proc_mutex.h:69