📄 apr_portable.h
字号:
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* This header file is where you should put ANY platform specific information. * This should be the only header file that programs need to include that * actually has platform dependant code which refers to the . */#ifndef APR_PORTABLE_H#define APR_PORTABLE_H/** * @file apr_portable.h * @brief APR Portability Routines */#include "apr.h"#include "apr_pools.h"#include "apr_thread_proc.h"#include "apr_file_io.h"#include "apr_network_io.h"#include "apr_errno.h"#include "apr_global_mutex.h"#include "apr_proc_mutex.h"#include "apr_time.h"#include "apr_dso.h"#include "apr_shm.h"#if APR_HAVE_DIRENT_H#include <dirent.h>#endif#if APR_HAVE_FCNTL_H#include <fcntl.h>#endif#if APR_HAVE_PTHREAD_H#include <pthread.h>#endif#ifdef __cplusplusextern "C" {#endif /* __cplusplus *//** * @defgroup apr_portabile Portability Routines * @ingroup APR * @{ */#ifdef WIN32/* The primitives for Windows types */typedef HANDLE apr_os_file_t;typedef HANDLE apr_os_dir_t;typedef SOCKET apr_os_sock_t;typedef HANDLE apr_os_proc_mutex_t;typedef HANDLE apr_os_thread_t;typedef HANDLE apr_os_proc_t;typedef DWORD apr_os_threadkey_t; typedef FILETIME apr_os_imp_time_t;typedef SYSTEMTIME apr_os_exp_time_t;typedef HANDLE apr_os_dso_handle_t;typedef HANDLE apr_os_shm_t;#elif defined(OS2)typedef HFILE apr_os_file_t;typedef HDIR apr_os_dir_t;typedef int apr_os_sock_t;typedef HMTX apr_os_proc_mutex_t;typedef TID apr_os_thread_t;typedef PID apr_os_proc_t;typedef PULONG apr_os_threadkey_t; typedef struct timeval apr_os_imp_time_t;typedef struct tm apr_os_exp_time_t;typedef HMODULE apr_os_dso_handle_t;typedef void* apr_os_shm_t;#elif defined(__BEOS__)#include <kernel/OS.h>#include <kernel/image.h>struct apr_os_proc_mutex_t { sem_id sem; int32 ben;};typedef int apr_os_file_t;typedef DIR apr_os_dir_t;typedef int apr_os_sock_t;typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;typedef thread_id apr_os_thread_t;typedef thread_id apr_os_proc_t;typedef int apr_os_threadkey_t;typedef struct timeval apr_os_imp_time_t;typedef struct tm apr_os_exp_time_t;typedef image_id apr_os_dso_handle_t;typedef void* apr_os_shm_t;#elif defined(NETWARE)typedef int apr_os_file_t;typedef DIR apr_os_dir_t;typedef int apr_os_sock_t;typedef NXMutex_t apr_os_proc_mutex_t;typedef NXThreadId_t apr_os_thread_t;typedef long apr_os_proc_t;typedef NXKey_t apr_os_threadkey_t; typedef struct timeval apr_os_imp_time_t;typedef struct tm apr_os_exp_time_t;typedef void * apr_os_dso_handle_t;typedef void* apr_os_shm_t;#else/* Any other OS should go above this one. This is the lowest common * denominator typedefs for all UNIX-like systems. :) *//** Basic OS process mutex structure. */struct apr_os_proc_mutex_t {#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE int crossproc;#endif#if APR_HAS_PROC_PTHREAD_SERIALIZE pthread_mutex_t *pthread_interproc;#endif#if APR_HAS_THREADS /* If no threads, no need for thread locks */#if APR_USE_PTHREAD_SERIALIZE pthread_mutex_t *intraproc;#endif#endif};typedef int apr_os_file_t; /**< native file */typedef DIR apr_os_dir_t; /**< native dir */typedef int apr_os_sock_t; /**< native dir */typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; /**< native proces * mutex */#if APR_HAS_THREADS && APR_HAVE_PTHREAD_H typedef pthread_t apr_os_thread_t; /**< native thread */typedef pthread_key_t apr_os_threadkey_t; /**< native thread address * space */#endiftypedef pid_t apr_os_proc_t; /**< native pid */typedef struct timeval apr_os_imp_time_t; /**< native timeval */typedef struct tm apr_os_exp_time_t; /**< native tm *//** @var apr_os_dso_handle_t * native dso types */#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)#include <dl.h>typedef shl_t apr_os_dso_handle_t;#elif defined(DARWIN)#include <mach-o/dyld.h>typedef NSModule apr_os_dso_handle_t;#elsetypedef void * apr_os_dso_handle_t;#endiftypedef void* apr_os_shm_t; /**< native SHM */#endif/** * @typedef apr_os_sock_info_t * @brief alias for local OS socket *//** * everything APR needs to know about an active socket to construct * an APR socket from it; currently, this is platform-independent */struct apr_os_sock_info_t { apr_os_sock_t *os_sock; /**< always required */ struct sockaddr *local; /**< NULL if not yet bound */ struct sockaddr *remote; /**< NULL if not connected */ int family; /**< always required (APR_INET, APR_INET6, etc.) */ int type; /**< always required (SOCK_STREAM, SOCK_DGRAM, etc.) */#ifdef APR_ENABLE_FOR_1_0 /**< enable with APR 1.0 */ int protocol; /**< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) */#endif};typedef struct apr_os_sock_info_t apr_os_sock_info_t;#if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)/** Opaque global mutex type */#define apr_os_global_mutex_t apr_os_proc_mutex_t/** @return apr_os_global_mutex */#define apr_os_global_mutex_get apr_os_proc_mutex_get#else /** Thread and process mutex for those platforms where process mutexes * are not held in threads. */ struct apr_os_global_mutex_t { apr_pool_t *pool; apr_proc_mutex_t *proc_mutex;#if APR_HAS_THREADS apr_thread_mutex_t *thread_mutex;#endif /* APR_HAS_THREADS */ }; typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex, apr_global_mutex_t *pmutex);#endif/** * convert the file from apr type to os specific type. * @param thefile The os specific file we are converting to * @param file The apr file to convert. * @remark On Unix, it is only possible to get a file descriptor from * an apr file type. */APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, apr_file_t *file);/** * convert the dir from apr type to os specific type. * @param thedir The os specific dir we are converting to * @param dir The apr dir to convert. */ APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir);/** * Convert the socket from an apr type to an OS specific socket * @param thesock The socket to convert. * @param sock The os specifc equivelant of the apr socket.. */APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock);/** * Convert the proc mutex from os specific type to apr type * @param ospmutex The os specific proc mutex we are converting to. * @param pmutex The apr proc mutex to convert. */APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, apr_proc_mutex_t *pmutex);/** * Get the exploded time in the platforms native format. * @param ostime the native time format * @param aprtime the time to convert
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -