Apache2
apr_portable.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 /* This header file is where you should put ANY platform specific information.
18  * This should be the only header file that programs need to include that
19  * actually has platform dependent code which refers to the .
20  */
21 #ifndef APR_PORTABLE_H
22 #define APR_PORTABLE_H
28 #include "apr.h"
29 #include "apr_pools.h"
30 #include "apr_thread_proc.h"
31 #include "apr_file_io.h"
32 #include "apr_network_io.h"
33 #include "apr_errno.h"
34 #include "apr_global_mutex.h"
35 #include "apr_proc_mutex.h"
36 #include "apr_time.h"
37 #include "apr_dso.h"
38 #include "apr_shm.h"
39 
40 #if APR_HAVE_DIRENT_H
41 #include <dirent.h>
42 #endif
43 #if APR_HAVE_FCNTL_H
44 #include <fcntl.h>
45 #endif
46 #if APR_HAVE_PTHREAD_H
47 #include <pthread.h>
48 #endif
49 #if APR_HAVE_SEMAPHORE_H
50 #include <semaphore.h>
51 #endif
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif /* __cplusplus */
56 
63 #ifdef WIN32
64 /* The primitives for Windows types */
65 typedef HANDLE apr_os_file_t;
66 typedef HANDLE apr_os_dir_t;
67 typedef SOCKET apr_os_sock_t;
68 typedef HANDLE apr_os_proc_mutex_t;
69 typedef HANDLE apr_os_thread_t;
70 typedef HANDLE apr_os_proc_t;
71 typedef DWORD apr_os_threadkey_t;
72 typedef FILETIME apr_os_imp_time_t;
73 typedef SYSTEMTIME apr_os_exp_time_t;
74 typedef HANDLE apr_os_dso_handle_t;
75 typedef HANDLE apr_os_shm_t;
76 
77 #elif defined(OS2)
78 typedef HFILE apr_os_file_t;
79 typedef HDIR apr_os_dir_t;
80 typedef int apr_os_sock_t;
81 typedef HMTX apr_os_proc_mutex_t;
82 typedef TID apr_os_thread_t;
83 typedef PID apr_os_proc_t;
84 typedef PULONG apr_os_threadkey_t;
85 typedef struct timeval apr_os_imp_time_t;
86 typedef struct tm apr_os_exp_time_t;
87 typedef HMODULE apr_os_dso_handle_t;
88 typedef void* apr_os_shm_t;
89 
90 #elif defined(__BEOS__)
91 #include <kernel/OS.h>
92 #include <kernel/image.h>
93 
94 struct apr_os_proc_mutex_t {
95  sem_id sem;
96  int32 ben;
97 };
98 
99 typedef int apr_os_file_t;
100 typedef DIR apr_os_dir_t;
101 typedef int apr_os_sock_t;
103 typedef thread_id apr_os_thread_t;
104 typedef thread_id apr_os_proc_t;
105 typedef int apr_os_threadkey_t;
106 typedef struct timeval apr_os_imp_time_t;
107 typedef struct tm apr_os_exp_time_t;
108 typedef image_id apr_os_dso_handle_t;
109 typedef void* apr_os_shm_t;
110 
111 #elif defined(NETWARE)
112 typedef int apr_os_file_t;
113 typedef DIR apr_os_dir_t;
114 typedef int apr_os_sock_t;
115 typedef NXMutex_t * apr_os_proc_mutex_t;
116 typedef NXThreadId_t apr_os_thread_t;
117 typedef long apr_os_proc_t;
118 typedef NXKey_t apr_os_threadkey_t;
119 typedef struct timeval apr_os_imp_time_t;
120 typedef struct tm apr_os_exp_time_t;
121 typedef void * apr_os_dso_handle_t;
122 typedef void* apr_os_shm_t;
123 
124 #else
125 /* Any other OS should go above this one. This is the lowest common
126  * denominator typedefs for all UNIX-like systems. :)
127  */
128 
131 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
134 #endif
135 #if APR_HAS_PROC_PTHREAD_SERIALIZE
137  pthread_mutex_t *pthread_interproc;
138 #endif
139 #if APR_HAS_POSIXSEM_SERIALIZE
142 #endif
143 };
144 
145 typedef int apr_os_file_t;
146 typedef DIR apr_os_dir_t;
147 typedef int apr_os_sock_t;
151 #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
152 typedef pthread_t apr_os_thread_t;
153 typedef pthread_key_t apr_os_threadkey_t;
155 #endif
156 typedef pid_t apr_os_proc_t;
157 typedef struct timeval apr_os_imp_time_t;
158 typedef struct tm apr_os_exp_time_t;
162 #if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
163 #include <dl.h>
164 typedef shl_t apr_os_dso_handle_t;
165 #elif defined(DARWIN)
166 #include <mach-o/dyld.h>
167 typedef NSModule apr_os_dso_handle_t;
168 #else
169 typedef void * apr_os_dso_handle_t;
170 #endif
171 typedef void* apr_os_shm_t;
173 #endif
174 
185  struct sockaddr *local;
186  struct sockaddr *remote;
187  int family;
188  int type;
189  int protocol;
190 };
191 
193 
194 #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
196 #define apr_os_global_mutex_t apr_os_proc_mutex_t
198 #define apr_os_global_mutex_get apr_os_proc_mutex_get
199 #else
203  struct apr_os_global_mutex_t {
204  apr_pool_t *pool;
205  apr_proc_mutex_t *proc_mutex;
206 #if APR_HAS_THREADS
207  apr_thread_mutex_t *thread_mutex;
208 #endif /* APR_HAS_THREADS */
209  };
211 
213  apr_global_mutex_t *pmutex);
214 #endif
215 
216 
225  apr_file_t *file);
226 
233  apr_dir_t *dir);
234 
241  apr_socket_t *sock);
242 
249  apr_proc_mutex_t *pmutex);
250 
261  apr_proc_mutex_t *pmutex,
262  apr_lockmech_e *mech);
263 
270  apr_time_exp_t *aprtime);
271 
278  apr_time_t *aprtime);
279 
286  apr_shm_t *shm);
287 
288 #if APR_HAS_THREADS || defined(DOXYGEN)
299  apr_thread_t *thd);
300 
307  apr_threadkey_t *key);
308 
316  apr_os_thread_t *thethd,
317  apr_pool_t *cont);
318 
326  apr_os_threadkey_t *thekey,
327  apr_pool_t *cont);
332 
340  apr_os_thread_t tid2);
341 
343 #endif /* APR_HAS_THREADS */
344 
355  apr_os_file_t *thefile,
356  apr_int32_t flags, apr_pool_t *cont);
357 
367  apr_os_file_t *thefile,
368  apr_pool_t *cont);
369 
381  apr_os_file_t *thefile,
382  int register_cleanup,
383  apr_pool_t *cont);
384 
392  apr_os_dir_t *thedir,
393  apr_pool_t *cont);
394 
407  apr_os_sock_t *thesock,
408  apr_pool_t *cont);
409 
421  apr_os_sock_info_t *os_sock_info,
422  apr_pool_t *cont);
423 
431  apr_os_proc_mutex_t *ospmutex,
432  apr_pool_t *cont);
433 
447  apr_os_proc_mutex_t *ospmutex,
448  apr_lockmech_e mech,
449  int register_cleanup,
450  apr_pool_t *cont);
451 
459  apr_os_imp_time_t **ostime,
460  apr_pool_t *cont);
461 
469  apr_os_exp_time_t **ostime,
470  apr_pool_t *cont);
471 
482  apr_os_shm_t *osshm,
483  apr_pool_t *cont);
484 
485 
486 #if APR_HAS_DSO || defined(DOXYGEN)
498  apr_os_dso_handle_t thedso,
499  apr_pool_t *pool);
500 
507  apr_dso_handle_t *aprdso);
508 
510 #endif /* APR_HAS_DSO */
511 
512 
513 #if APR_HAS_OS_UUID
517 APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
518 #endif
519 
520 
526 
527 
535 
538 #ifdef __cplusplus
539 }
540 #endif
541 
542 #endif /* ! APR_PORTABLE_H */
APR Platform Definitions.
APR Dynamic Object Handling Routines.
APR Error Codes.
APR File I/O Handling.
APR Global Locking Routines.
APR Network library.
APR memory allocation.
APR Process Locking Routines.
APR Shared Memory Routines.
APR Thread and Process Library.
APR Time Library.
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1458
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
int apr_status_t
Definition: apr_errno.h:44
apr_status_t apr_os_dso_handle_get(apr_os_dso_handle_t *dso, apr_dso_handle_t *aprdso)
apr_status_t apr_os_dso_handle_put(apr_dso_handle_t **dso, apr_os_dso_handle_t thedso, apr_pool_t *pool)
apr_status_t apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key)
apr_status_t apr_os_threadkey_put(apr_threadkey_t **key, apr_os_threadkey_t *thekey, apr_pool_t *cont)
apr_os_thread_t apr_os_thread_current(void)
apr_status_t apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, apr_pool_t *cont)
int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
apr_status_t apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd)
int apr_int32_t
Definition: apr.h:347
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock)
pthread_key_t apr_os_threadkey_t
Definition: apr_portable.h:153
struct tm apr_os_exp_time_t
Definition: apr_portable.h:158
struct apr_os_proc_mutex_t apr_os_proc_mutex_t
Definition: apr_portable.h:148
apr_status_t apr_os_file_put(apr_file_t **file, apr_os_file_t *thefile, apr_int32_t flags, apr_pool_t *cont)
apr_status_t apr_os_file_get(apr_os_file_t *thefile, apr_file_t *file)
apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, apr_proc_mutex_t *pmutex)
int apr_os_sock_t
Definition: apr_portable.h:147
pid_t apr_os_proc_t
Definition: apr_portable.h:156
apr_status_t apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex, apr_os_proc_mutex_t *ospmutex, apr_lockmech_e mech, int register_cleanup, apr_pool_t *cont)
apr_status_t apr_os_imp_time_get(apr_os_imp_time_t **ostime, apr_time_t *aprtime)
pthread_t apr_os_thread_t
Definition: apr_portable.h:152
apr_status_t apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir, apr_pool_t *cont)
void * apr_os_dso_handle_t
Definition: apr_portable.h:169
apr_status_t apr_os_exp_time_put(apr_time_exp_t *aprtime, apr_os_exp_time_t **ostime, apr_pool_t *cont)
apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, apr_os_sock_info_t *os_sock_info, apr_pool_t *cont)
struct timeval apr_os_imp_time_t
Definition: apr_portable.h:157
const char * apr_os_default_encoding(apr_pool_t *pool)
apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, apr_pool_t *cont)
apr_status_t apr_os_uuid_get(unsigned char *uuid_data)
void * apr_os_shm_t
Definition: apr_portable.h:171
apr_status_t apr_os_shm_get(apr_os_shm_t *osshm, apr_shm_t *shm)
int apr_os_file_t
Definition: apr_portable.h:145
apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, apr_os_proc_mutex_t *ospmutex, apr_pool_t *cont)
apr_status_t apr_os_pipe_put(apr_file_t **file, apr_os_file_t *thefile, apr_pool_t *cont)
apr_status_t apr_os_imp_time_put(apr_time_t *aprtime, apr_os_imp_time_t **ostime, apr_pool_t *cont)
apr_status_t apr_os_exp_time_get(apr_os_exp_time_t **ostime, apr_time_exp_t *aprtime)
apr_status_t apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir)
apr_status_t apr_os_pipe_put_ex(apr_file_t **file, apr_os_file_t *thefile, int register_cleanup, apr_pool_t *cont)
apr_status_t apr_os_shm_put(apr_shm_t **shm, apr_os_shm_t *osshm, apr_pool_t *cont)
apr_status_t apr_os_proc_mutex_get_ex(apr_os_proc_mutex_t *ospmutex, apr_proc_mutex_t *pmutex, apr_lockmech_e *mech)
DIR apr_os_dir_t
Definition: apr_portable.h:146
#define apr_os_global_mutex_t
Definition: apr_portable.h:196
#define apr_os_global_mutex_get
Definition: apr_portable.h:198
const char * apr_os_locale_encoding(apr_pool_t *pool)
apr_lockmech_e
Definition: apr_proc_mutex.h:46
apr_int64_t apr_time_t
Definition: apr_time.h:45
#define APR_DECLARE(x)
Definition: macros.h:6
Definition: apr_arch_file_io.h:135
Definition: apr_arch_dso.h:33
Definition: apr_arch_file_io.h:107
Definition: apr_arch_global_mutex.h:23
Definition: apr_portable.h:130
int crossproc
Definition: apr_portable.h:133
sem_t * psem_interproc
Definition: apr_portable.h:141
pthread_mutex_t * pthread_interproc
Definition: apr_portable.h:137
Definition: apr_portable.h:183
int protocol
Definition: apr_portable.h:189
int type
Definition: apr_portable.h:188
apr_os_sock_t * os_sock
Definition: apr_portable.h:184
int family
Definition: apr_portable.h:187
struct sockaddr * remote
Definition: apr_portable.h:186
struct sockaddr * local
Definition: apr_portable.h:185
Definition: apr_arch_proc_mutex.h:27
Definition: apr_arch_shm.h:61
Definition: apr_arch_networkio.h:37
Definition: apr_arch_thread_mutex.h:28
Definition: apr_arch_threadproc.h:42
Definition: apr_arch_threadproc.h:59
Definition: apr_time.h:97