Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_portable.h

Go to the documentation of this file.
00001 /* ==================================================================== 00002 * The Apache Software License, Version 1.1 00003 * 00004 * Copyright (c) 2000-2003 The Apache Software Foundation. All rights 00005 * reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in 00016 * the documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * 3. The end-user documentation included with the redistribution, 00020 * if any, must include the following acknowledgment: 00021 * "This product includes software developed by the 00022 * Apache Software Foundation (http://www.apache.org/)." 00023 * Alternately, this acknowledgment may appear in the software itself, 00024 * if and wherever such third-party acknowledgments normally appear. 00025 * 00026 * 4. The names "Apache" and "Apache Software Foundation" must 00027 * not be used to endorse or promote products derived from this 00028 * software without prior written permission. For written 00029 * permission, please contact apache@apache.org. 00030 * 00031 * 5. Products derived from this software may not be called "Apache", 00032 * nor may "Apache" appear in their name, without prior written 00033 * permission of the Apache Software Foundation. 00034 * 00035 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00037 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00038 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00039 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00040 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00041 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00042 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00043 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00044 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00045 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00046 * SUCH DAMAGE. 00047 * ==================================================================== 00048 * 00049 * This software consists of voluntary contributions made by many 00050 * individuals on behalf of the Apache Software Foundation. For more 00051 * information on the Apache Software Foundation, please see 00052 * <http://www.apache.org/>. 00053 */ 00054 00055 /* This header file is where you should put ANY platform specific information. 00056 * This should be the only header file that programs need to include that 00057 * actually has platform dependant code which refers to the . 00058 */ 00059 #ifndef APR_PORTABLE_H 00060 #define APR_PORTABLE_H 00061 00066 #include "apr.h" 00067 #include "apr_pools.h" 00068 #include "apr_thread_proc.h" 00069 #include "apr_file_io.h" 00070 #include "apr_network_io.h" 00071 #include "apr_errno.h" 00072 #include "apr_global_mutex.h" 00073 #include "apr_proc_mutex.h" 00074 #include "apr_time.h" 00075 #include "apr_dso.h" 00076 #include "apr_shm.h" 00077 00078 #if APR_HAVE_DIRENT_H 00079 #include <dirent.h> 00080 #endif 00081 #if APR_HAVE_FCNTL_H 00082 #include <fcntl.h> 00083 #endif 00084 #if APR_HAVE_PTHREAD_H 00085 #include <pthread.h> 00086 #endif 00087 00088 #ifdef __cplusplus 00089 extern "C" { 00090 #endif /* __cplusplus */ 00091 00098 #ifdef WIN32 00099 /* The primitives for Windows types */ 00100 typedef HANDLE apr_os_file_t; 00101 typedef HANDLE apr_os_dir_t; 00102 typedef SOCKET apr_os_sock_t; 00103 typedef HANDLE apr_os_proc_mutex_t; 00104 typedef HANDLE apr_os_thread_t; 00105 typedef HANDLE apr_os_proc_t; 00106 typedef DWORD apr_os_threadkey_t; 00107 typedef FILETIME apr_os_imp_time_t; 00108 typedef SYSTEMTIME apr_os_exp_time_t; 00109 typedef HANDLE apr_os_dso_handle_t; 00110 typedef HANDLE apr_os_shm_t; 00111 00112 #elif defined(OS2) 00113 typedef HFILE apr_os_file_t; 00114 typedef HDIR apr_os_dir_t; 00115 typedef int apr_os_sock_t; 00116 typedef HMTX apr_os_proc_mutex_t; 00117 typedef TID apr_os_thread_t; 00118 typedef PID apr_os_proc_t; 00119 typedef PULONG apr_os_threadkey_t; 00120 typedef struct timeval apr_os_imp_time_t; 00121 typedef struct tm apr_os_exp_time_t; 00122 typedef HMODULE apr_os_dso_handle_t; 00123 typedef void* apr_os_shm_t; 00124 00125 #elif defined(__BEOS__) 00126 #include <kernel/OS.h> 00127 #include <kernel/image.h> 00128 00129 struct apr_os_proc_mutex_t { 00130 sem_id sem; 00131 int32 ben; 00132 }; 00133 00134 typedef int apr_os_file_t; 00135 typedef DIR apr_os_dir_t; 00136 typedef int apr_os_sock_t; 00137 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; 00138 typedef thread_id apr_os_thread_t; 00139 typedef thread_id apr_os_proc_t; 00140 typedef int apr_os_threadkey_t; 00141 typedef struct timeval apr_os_imp_time_t; 00142 typedef struct tm apr_os_exp_time_t; 00143 typedef image_id apr_os_dso_handle_t; 00144 typedef void* apr_os_shm_t; 00145 00146 #elif defined(NETWARE) 00147 typedef int apr_os_file_t; 00148 typedef DIR apr_os_dir_t; 00149 typedef int apr_os_sock_t; 00150 typedef NXMutex_t apr_os_proc_mutex_t; 00151 typedef NXThreadId_t apr_os_thread_t; 00152 typedef long apr_os_proc_t; 00153 typedef NXKey_t apr_os_threadkey_t; 00154 typedef struct timeval apr_os_imp_time_t; 00155 typedef struct tm apr_os_exp_time_t; 00156 typedef void * apr_os_dso_handle_t; 00157 typedef void* apr_os_shm_t; 00158 00159 #else 00160 /* Any other OS should go above this one. This is the lowest common 00161 * denominator typedefs for all UNIX-like systems. :) 00162 */ 00163 00165 struct apr_os_proc_mutex_t { 00166 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE 00167 int crossproc; 00168 #endif 00169 #if APR_HAS_PROC_PTHREAD_SERIALIZE 00170 pthread_mutex_t *pthread_interproc; 00171 #endif 00172 #if APR_HAS_THREADS 00173 /* If no threads, no need for thread locks */ 00174 #if APR_USE_PTHREAD_SERIALIZE 00175 pthread_mutex_t *intraproc; 00176 #endif 00177 #endif 00178 }; 00179 00180 typedef int apr_os_file_t; 00181 typedef DIR apr_os_dir_t; 00182 typedef int apr_os_sock_t; 00183 typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; 00186 #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H 00187 typedef pthread_t apr_os_thread_t; 00188 typedef pthread_key_t apr_os_threadkey_t; 00190 #endif 00191 typedef pid_t apr_os_proc_t; 00192 typedef struct timeval apr_os_imp_time_t; 00193 typedef struct tm apr_os_exp_time_t; 00197 #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) 00198 #include <dl.h> 00199 typedef shl_t apr_os_dso_handle_t; 00200 #elif defined(DARWIN) 00201 #include <mach-o/dyld.h> 00202 typedef NSModule apr_os_dso_handle_t; 00203 #else 00204 typedef void * apr_os_dso_handle_t; 00205 #endif 00206 typedef void* apr_os_shm_t; 00208 #endif 00209 00218 struct apr_os_sock_info_t { 00219 apr_os_sock_t *os_sock; 00220 struct sockaddr *local; 00221 struct sockaddr *remote; 00222 int family; 00223 int type; 00224 #ifdef APR_ENABLE_FOR_1_0 00225 int protocol; 00226 #endif 00227 }; 00228 00229 typedef struct apr_os_sock_info_t apr_os_sock_info_t; 00230 00231 #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN) 00232 00233 #define apr_os_global_mutex_t apr_os_proc_mutex_t 00234 00235 #define apr_os_global_mutex_get apr_os_proc_mutex_get 00236 #else 00237 00240 struct apr_os_global_mutex_t { 00241 apr_pool_t *pool; 00242 apr_proc_mutex_t *proc_mutex; 00243 #if APR_HAS_THREADS 00244 apr_thread_mutex_t *thread_mutex; 00245 #endif /* APR_HAS_THREADS */ 00246 }; 00247 typedef struct apr_os_global_mutex_t apr_os_global_mutex_t; 00248 00249 APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex, 00250 apr_global_mutex_t *pmutex); 00251 #endif 00252 00253 00261 APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, 00262 apr_file_t *file); 00263 00269 APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, 00270 apr_dir_t *dir); 00271 00277 APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, 00278 apr_socket_t *sock); 00279 00285 APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, 00286 apr_proc_mutex_t *pmutex); 00287 00293 APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, 00294 apr_time_exp_t *aprtime); 00295 00301 APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime, 00302 apr_time_t *aprtime); 00303 00309 APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, 00310 apr_shm_t *shm); 00311 00312 #if APR_HAS_THREADS || defined(DOXYGEN) 00322 APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, 00323 apr_thread_t *thd); 00324 00330 APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, 00331 apr_threadkey_t *key); 00332 00339 APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, 00340 apr_os_thread_t *thethd, 00341 apr_pool_t *cont); 00342 00349 APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, 00350 apr_os_threadkey_t *thekey, 00351 apr_pool_t *cont); 00355 APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void); 00356 00362 APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, 00363 apr_os_thread_t tid2); 00364 00366 #endif /* APR_HAS_THREADS */ 00367 00377 APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, 00378 apr_os_file_t *thefile, 00379 apr_int32_t flags, apr_pool_t *cont); 00380 00389 APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, 00390 apr_os_file_t *thefile, 00391 apr_pool_t *cont); 00392 00399 APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir, 00400 apr_os_dir_t *thedir, 00401 apr_pool_t *cont); 00402 00411 APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, 00412 apr_os_sock_t *thesock, 00413 apr_pool_t *cont); 00414 00425 APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, 00426 apr_os_sock_info_t *os_sock_info, 00427 apr_pool_t *cont); 00428 00435 APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, 00436 apr_os_proc_mutex_t *ospmutex, 00437 apr_pool_t *cont); 00438 00445 APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, 00446 apr_os_imp_time_t **ostime, 00447 apr_pool_t *cont); 00448 00455 APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, 00456 apr_os_exp_time_t **ostime, 00457 apr_pool_t *cont); 00458 00468 APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm, 00469 apr_os_shm_t *osshm, 00470 apr_pool_t *cont); 00471 00472 00473 #if APR_HAS_DSO || defined(DOXYGEN) 00484 APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso, 00485 apr_os_dso_handle_t thedso, 00486 apr_pool_t *pool); 00487 00493 APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso, 00494 apr_dso_handle_t *aprdso); 00495 00496 #if APR_HAS_OS_UUID 00500 APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data); 00501 #endif 00502 00504 #endif /* APR_HAS_DSO */ 00505 00506 00511 APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool); 00512 00513 00520 APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool); 00521 00524 #ifdef __cplusplus 00525 } 00526 #endif 00527 00528 #endif /* ! APR_PORTABLE_H */

Generated on Wed Sep 1 05:16:36 2004 for Apache Portable Runtime by doxygen 1.3.8