38
38
#include <process.h>
39
39
#endif
40
40
41
- #ifndef THREAD_SAFE
42
- static long page_uid = -1 ;
43
- static long page_inode = -1 ;
44
- static long page_mtime = -1 ;
45
- #endif
41
+ #include "ext/standard/basic_functions.h"
46
42
47
43
static void _php3_statpage (void )
48
44
{
49
45
#if !APACHE
50
46
char * path ;
51
47
struct stat sb ;
48
+ BLS_FETCH ();
52
49
#else
53
50
request_rec * r ;
51
+ BLS_FETCH ();
54
52
SLS_FETCH ();
55
53
56
54
r = ((request_rec * ) SG (server_context ));
@@ -62,11 +60,11 @@ static void _php3_statpage(void)
62
60
values. We can afford it, and it means we don't have to
63
61
worry about resetting the static variables after every
64
62
hit. */
65
- page_uid = r -> finfo .st_uid ;
66
- page_inode = r -> finfo .st_ino ;
67
- page_mtime = r -> finfo .st_mtime ;
63
+ BG ( page_uid ) = r -> finfo .st_uid ;
64
+ BG ( page_inode ) = r -> finfo .st_ino ;
65
+ BG ( page_mtime ) = r -> finfo .st_mtime ;
68
66
#else
69
- if (page_uid == -1 ) {
67
+ if (BG ( page_uid ) == -1 ) {
70
68
SLS_FETCH ();
71
69
72
70
path = SG (request_info ).path_translated ;
@@ -75,18 +73,20 @@ static void _php3_statpage(void)
75
73
php_error (E_WARNING , "Unable to find file: '%s'" , path );
76
74
return ;
77
75
}
78
- page_uid = sb .st_uid ;
79
- page_inode = sb .st_ino ;
80
- page_mtime = sb .st_mtime ;
76
+ BG ( page_uid ) = sb .st_uid ;
77
+ BG ( page_inode ) = sb .st_ino ;
78
+ BG ( page_mtime ) = sb .st_mtime ;
81
79
}
82
80
}
83
81
#endif
84
82
}
85
83
86
84
long _php3_getuid (void )
87
85
{
86
+ BLS_FETCH ();
87
+
88
88
_php3_statpage ();
89
- return (page_uid );
89
+ return (BG ( page_uid ) );
90
90
}
91
91
92
92
/* {{{ proto int getmyuid(void)
@@ -123,11 +123,13 @@ PHP_FUNCTION(getmypid)
123
123
Get the inode of the current script being parsed */
124
124
PHP_FUNCTION (getmyinode )
125
125
{
126
+ BLS_FETCH ();
127
+
126
128
_php3_statpage ();
127
- if (page_inode < 0 ) {
129
+ if (BG ( page_inode ) < 0 ) {
128
130
RETURN_FALSE ;
129
131
} else {
130
- RETURN_LONG (page_inode );
132
+ RETURN_LONG (BG ( page_inode ) );
131
133
}
132
134
}
133
135
/* }}} */
@@ -136,11 +138,13 @@ PHP_FUNCTION(getmyinode)
136
138
Get time of last page modification */
137
139
PHP_FUNCTION (getlastmod )
138
140
{
141
+ BLS_FETCH ();
142
+
139
143
_php3_statpage ();
140
- if (page_mtime < 0 ) {
144
+ if (BG ( page_mtime ) < 0 ) {
141
145
RETURN_FALSE ;
142
146
} else {
143
- RETURN_LONG (page_mtime );
147
+ RETURN_LONG (BG ( page_mtime ) );
144
148
}
145
149
}
146
150
/* }}} */
0 commit comments