php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_reentrancy.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: Sascha Schumann <sascha@schumann.cx> |
14 +----------------------------------------------------------------------+
15 */
16
17#ifndef PHP_REENTRANCY_H
18#define PHP_REENTRANCY_H
19
20#include "php.h"
21
22#include <sys/types.h>
23#ifdef HAVE_DIRENT_H
24#include <dirent.h>
25#endif
26#include <time.h>
27
28/* currently, PHP does not check for these functions, but assumes
29 that they are available on all systems. */
30
31#define HAVE_LOCALTIME 1
32#define HAVE_GMTIME 1
33#define HAVE_ASCTIME 1
34#define HAVE_CTIME 1
35
36#if defined(PHP_IRIX_TIME_R)
37#undef HAVE_ASCTIME_R
38#undef HAVE_CTIME_R
39#endif
40
41#if defined(PHP_HPUX_TIME_R)
42#undef HAVE_LOCALTIME_R
43#undef HAVE_ASCTIME_R
44#undef HAVE_CTIME_R
45#undef HAVE_GMTIME_R
46#endif
47
49
50#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
51#define PHP_NEED_REENTRANCY 1
52PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm);
53#else
54#define php_localtime_r localtime_r
55#ifdef MISSING_LOCALTIME_R_DECL
56struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
57#endif
58#endif
59
60
61#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
62#define PHP_NEED_REENTRANCY 1
63PHPAPI char *php_ctime_r(const time_t *clock, char *buf);
64#else
65#define php_ctime_r ctime_r
66#ifdef MISSING_CTIME_R_DECL
67char *ctime_r(const time_t *clock, char *buf);
68#endif
69#endif
70
71
72#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
73#define PHP_NEED_REENTRANCY 1
74PHPAPI char *php_asctime_r(const struct tm *tm, char *buf);
75#else
76#define php_asctime_r asctime_r
77#ifdef MISSING_ASCTIME_R_DECL
78char *asctime_r(const struct tm *tm, char *buf);
79#endif
80#endif
81
82
83#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
84#define PHP_NEED_REENTRANCY 1
85PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
86#else
87#define php_gmtime_r gmtime_r
88#ifdef MISSING_GMTIME_R_DECL
89struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
90#endif
91#endif
92
93#if !defined(HAVE_STRTOK_R)
94PHPAPI char *php_strtok_r(char *s, const char *delim, char **last);
95#else
96#define php_strtok_r strtok_r
97#ifdef MISSING_STRTOK_R_DECL
98char *strtok_r(char *s, const char *delim, char **last);
99#endif
100#endif
101
103
104#if !defined(ZTS)
105#undef PHP_NEED_REENTRANCY
106#endif
107
108#if defined(PHP_NEED_REENTRANCY)
109void reentrancy_startup(void);
110void reentrancy_shutdown(void);
111#else
112#define reentrancy_startup()
113#define reentrancy_shutdown()
114#endif
115
116#endif
char s[4]
Definition cdf.c:77
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
char * asctime_r(const struct tm *, char *)
char * ctime_r(const time_t *, char *)
char * strtok_r(char *s, const char *delim, char **last)
#define PHPAPI
Definition php.h:71
#define reentrancy_shutdown()
#define reentrancy_startup()
PHPAPI struct tm * php_localtime_r(const time_t *const timep, struct tm *p_tm)
Definition reentrancy.c:110
PHPAPI struct tm * php_gmtime_r(const time_t *const timep, struct tm *p_tm)
Definition reentrancy.c:173
PHPAPI char * php_strtok_r(char *s, const char *delim, char **last)
Definition reentrancy.c:263
PHPAPI char * php_ctime_r(const time_t *clock, char *buf)
Definition reentrancy.c:131
PHPAPI char * php_asctime_r(const struct tm *tm, char *buf)
Definition reentrancy.c:152
int last
#define END_EXTERN_C()
#define BEGIN_EXTERN_C()