@@ -225,10 +225,10 @@ static php_cgi_globals_struct php_cgi_globals;
225
225
226
226
#ifdef PHP_WIN32
227
227
#define WIN32_MAX_SPAWN_CHILDREN 64
228
- HANDLE win32_kid_cgi_ps [WIN32_MAX_SPAWN_CHILDREN ];
229
- int win32_kids ;
230
- HANDLE win32_job = NULL ;
231
- JOBOBJECT_EXTENDED_LIMIT_INFORMATION win32_ji = { 0 };
228
+ HANDLE kid_cgi_ps [WIN32_MAX_SPAWN_CHILDREN ];
229
+ int kids ;
230
+ HANDLE job = NULL ;
231
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = { 0 };
232
232
#endif
233
233
234
234
#ifndef HAVE_ATTRIBUTE_WEAK
@@ -1439,20 +1439,20 @@ void fastcgi_cleanup(int signal)
1439
1439
#else
1440
1440
BOOL fastcgi_cleanup (DWORD sig )
1441
1441
{
1442
- int i = win32_kids ;
1442
+ int i = kids ;
1443
1443
1444
1444
while (0 < i -- ) {
1445
- if (NULL == win32_kid_cgi_ps [i ]) {
1445
+ if (NULL == kid_cgi_ps [i ]) {
1446
1446
continue ;
1447
1447
}
1448
1448
1449
- TerminateProcess (win32_kid_cgi_ps [i ], 0 );
1450
- CloseHandle (win32_kid_cgi_ps [i ]);
1451
- win32_kid_cgi_ps [i ] = NULL ;
1449
+ TerminateProcess (kid_cgi_ps [i ], 0 );
1450
+ CloseHandle (kid_cgi_ps [i ]);
1451
+ kid_cgi_ps [i ] = NULL ;
1452
1452
}
1453
1453
1454
- if (win32_job ) {
1455
- CloseHandle (win32_job );
1454
+ if (job ) {
1455
+ CloseHandle (job );
1456
1456
}
1457
1457
1458
1458
parent = 0 ;
@@ -2116,8 +2116,8 @@ consult the installation file that came with this distribution, or visit \n\
2116
2116
char my_name [MAX_PATH ] = {0 };
2117
2117
int i ;
2118
2118
2119
- ZeroMemory (& win32_kid_cgi_ps , sizeof (win32_kid_cgi_ps ));
2120
- win32_kids = children < WIN32_MAX_SPAWN_CHILDREN ? children : WIN32_MAX_SPAWN_CHILDREN ;
2119
+ ZeroMemory (& kid_cgi_ps , sizeof (kid_cgi_ps ));
2120
+ kids = children < WIN32_MAX_SPAWN_CHILDREN ? children : WIN32_MAX_SPAWN_CHILDREN ;
2121
2121
2122
2122
SetConsoleCtrlHandler (fastcgi_cleanup , TRUE);
2123
2123
@@ -2126,42 +2126,43 @@ consult the installation file that came with this distribution, or visit \n\
2126
2126
GetModuleFileName (NULL , my_name , MAX_PATH );
2127
2127
cmd_line = my_name ;
2128
2128
2129
- win32_job = CreateJobObject (NULL , NULL );
2130
- if (!win32_job ) {
2129
+ job = CreateJobObject (NULL , NULL );
2130
+ if (!job ) {
2131
2131
DWORD err = GetLastError ();
2132
2132
char * err_text = php_win32_error_to_msg (err );
2133
2133
2134
2134
fprintf (stderr , "unable to create job object: [0x%08lx]: %s\n" , err , err_text );
2135
2135
2136
2136
goto parent_out ;
2137
2137
}
2138
- win32_ji .BasicLimitInformation .LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE ;
2139
- if (!SetInformationJobObject (win32_job , JobObjectExtendedLimitInformation , & win32_ji , sizeof (win32_ji ))) {
2138
+
2139
+ job_info .BasicLimitInformation .LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE ;
2140
+ if (!SetInformationJobObject (job , JobObjectExtendedLimitInformation , & job_info , sizeof (job_info ))) {
2140
2141
DWORD err = GetLastError ();
2141
2142
char * err_text = php_win32_error_to_msg (err );
2142
2143
2143
2144
fprintf (stderr , "unable to configure job object: [0x%08lx]: %s\n" , err , err_text );
2144
2145
}
2145
2146
2146
2147
while (parent ) {
2147
- i = win32_kids ;
2148
+ i = kids ;
2148
2149
while (0 < i -- ) {
2149
2150
DWORD status ;
2150
2151
2151
- if (NULL != win32_kid_cgi_ps [i ]) {
2152
- if (!GetExitCodeProcess (win32_kid_cgi_ps [i ], & status ) || status != STILL_ACTIVE ) {
2153
- CloseHandle (win32_kid_cgi_ps [i ]);
2154
- win32_kid_cgi_ps [i ] = NULL ;
2152
+ if (NULL != kid_cgi_ps [i ]) {
2153
+ if (!GetExitCodeProcess (kid_cgi_ps [i ], & status ) || status != STILL_ACTIVE ) {
2154
+ CloseHandle (kid_cgi_ps [i ]);
2155
+ kid_cgi_ps [i ] = NULL ;
2155
2156
}
2156
2157
}
2157
2158
}
2158
2159
2159
- i = win32_kids ;
2160
+ i = kids ;
2160
2161
while (0 < i -- ) {
2161
2162
PROCESS_INFORMATION pi ;
2162
2163
STARTUPINFO si ;
2163
2164
2164
- if (NULL != win32_kid_cgi_ps [i ]) {
2165
+ if (NULL != kid_cgi_ps [i ]) {
2165
2166
continue ;
2166
2167
}
2167
2168
@@ -2175,8 +2176,8 @@ consult the installation file that came with this distribution, or visit \n\
2175
2176
si .hStdError = INVALID_HANDLE_VALUE ;
2176
2177
2177
2178
if (CreateProcess (NULL , cmd_line , NULL , NULL , TRUE, CREATE_NO_WINDOW , NULL , NULL , & si , & pi )) {
2178
- win32_kid_cgi_ps [i ] = pi .hProcess ;
2179
- if (!AssignProcessToJobObject (win32_job , pi .hProcess )) {
2179
+ kid_cgi_ps [i ] = pi .hProcess ;
2180
+ if (!AssignProcessToJobObject (job , pi .hProcess )) {
2180
2181
DWORD err = GetLastError ();
2181
2182
char * err_text = php_win32_error_to_msg (err );
2182
2183
@@ -2187,13 +2188,13 @@ consult the installation file that came with this distribution, or visit \n\
2187
2188
DWORD err = GetLastError ();
2188
2189
char * err_text = php_win32_error_to_msg (err );
2189
2190
2190
- win32_kid_cgi_ps [i ] = NULL ;
2191
+ kid_cgi_ps [i ] = NULL ;
2191
2192
2192
2193
fprintf (stderr , "unable to spawn: [0x%08lx]: %s\n" , err , err_text );
2193
2194
}
2194
2195
}
2195
2196
2196
- WaitForMultipleObjects (win32_kids , win32_kid_cgi_ps , FALSE, INFINITE );
2197
+ WaitForMultipleObjects (kids , kid_cgi_ps , FALSE, INFINITE );
2197
2198
}
2198
2199
2199
2200
snprintf (kid_buf , 16 , "%d" , children );
0 commit comments