Back to index

php5  5.3.10
php_reentrancy.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Sascha Schumann <sascha@schumann.cx>                         |
00016    +----------------------------------------------------------------------+
00017  */
00018 
00019 /* $Id: php_reentrancy.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_REENTRANCY_H
00022 #define PHP_REENTRANCY_H
00023 
00024 #include "php.h"
00025 
00026 #include <sys/types.h>
00027 #ifdef HAVE_DIRENT_H
00028 #include <dirent.h>
00029 #endif
00030 #include <time.h>
00031 
00032 /* currently, PHP does not check for these functions, but assumes
00033    that they are available on all systems. */
00034 
00035 #define HAVE_LOCALTIME 1
00036 #define HAVE_GMTIME 1
00037 #define HAVE_ASCTIME 1
00038 #define HAVE_CTIME 1
00039 
00040 #if defined(PHP_IRIX_TIME_R)
00041 #undef HAVE_ASCTIME_R
00042 #undef HAVE_CTIME_R
00043 #endif
00044 
00045 #if defined(PHP_HPUX_TIME_R)
00046 #undef HAVE_LOCALTIME_R
00047 #undef HAVE_ASCTIME_R
00048 #undef HAVE_CTIME_R
00049 #undef HAVE_GMTIME_R
00050 #endif
00051 
00052 BEGIN_EXTERN_C()
00053 
00054 #if defined(HAVE_POSIX_READDIR_R)
00055 #define php_readdir_r readdir_r
00056 #else
00057 PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
00058               struct dirent **result);
00059 #endif
00060 
00061 #if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
00062 #define PHP_NEED_REENTRANCY 1
00063 PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm);
00064 #else
00065 #define php_localtime_r localtime_r
00066 #ifdef MISSING_LOCALTIME_R_DECL
00067 struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
00068 #endif
00069 #endif
00070 
00071 
00072 #if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
00073 #define PHP_NEED_REENTRANCY 1
00074 PHPAPI char *php_ctime_r(const time_t *clock, char *buf);
00075 #else
00076 #define php_ctime_r ctime_r
00077 #ifdef MISSING_CTIME_R_DECL
00078 char *ctime_r(const time_t *clock, char *buf);
00079 #endif
00080 #endif
00081 
00082 
00083 #if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
00084 #define PHP_NEED_REENTRANCY 1
00085 PHPAPI char *php_asctime_r(const struct tm *tm, char *buf);
00086 #else
00087 #define php_asctime_r asctime_r
00088 #ifdef MISSING_ASCTIME_R_DECL
00089 char *asctime_r(const struct tm *tm, char *buf);
00090 #endif
00091 #endif
00092 
00093 
00094 #if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) || defined(__BEOS__)
00095 #define PHP_NEED_REENTRANCY 1
00096 PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
00097 #else
00098 #define php_gmtime_r gmtime_r
00099 #ifdef MISSING_GMTIME_R_DECL
00100 struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
00101 #endif
00102 #endif
00103 
00104 #if !defined(HAVE_STRTOK_R)
00105 PHPAPI char *php_strtok_r(char *s, const char *delim, char **last);
00106 #else
00107 #define php_strtok_r strtok_r
00108 #ifdef MISSING_STRTOK_R_DECL
00109 char *strtok_r(char *s, const char *delim, char **last);
00110 #endif
00111 #endif
00112 
00113 #if !defined(HAVE_RAND_R)
00114 PHPAPI int php_rand_r(unsigned int *seed);
00115 #else
00116 #define php_rand_r rand_r
00117 #endif
00118 
00119 END_EXTERN_C()
00120 
00121 #if !defined(ZTS)
00122 #undef PHP_NEED_REENTRANCY
00123 #endif
00124 
00125 #if defined(PHP_NEED_REENTRANCY)
00126 void reentrancy_startup(void);
00127 void reentrancy_shutdown(void);
00128 #else
00129 #define reentrancy_startup()
00130 #define reentrancy_shutdown()
00131 #endif
00132 
00133 #endif