Changeset 209
- Timestamp:
- 05/08/06 15:17:02 (2 years ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/eaccelerator.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r208 r209 3 3 * Make the disassembler do openbasedir checks before showing a file, 4 4 this fixes bug #59 5 * Changed the filter logic a bit, this fixes bug #72 5 6 6 7 2006-05-07 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> eaccelerator/trunk/eaccelerator.c
r207 r209 960 960 char p,k; 961 961 int ok, neg; 962 962 963 963 while (1) { 964 964 p = *pat++; … … 1029 1029 mm_cond_entry *p; 1030 1030 int ok; 1031 1031 fprintf(stderr, "Going to inspect %s\n", realname);fflush(stderr); 1032 1032 if (EAG(cond_list) == NULL) { 1033 1033 return 1; … … 1252 1252 struct timeval tv_start; 1253 1253 #endif 1254 int ok_to_cache = 0; 1254 1255 1255 1256 #ifdef EACCELERATOR_USE_INODE … … 1269 1270 ea_debug_log("EACCELERATOR: Warning: \"%s\" is cached but it's mtime is in the future.\n", file_handle->filename); 1270 1271 } 1271 1272 if (!EAG(enabled) || (eaccelerator_mm_instance == NULL) || 1272 1273 ok_to_cache = eaccelerator_ok_to_cache(file_handle->filename TSRMLS_CC); 1274 1275 // eAccelerator isn't working, so just compile the file 1276 if (!EAG(enabled) || (eaccelerator_mm_instance == NULL) || 1273 1277 !eaccelerator_mm_instance->enabled || file_handle == NULL || 1274 file_handle->filename == NULL || stat_result != 0 || 1275 #ifdef EACCELERATOR_USE_INODE 1276 0) { 1277 #else 1278 !eaccelerator_ok_to_cache(realname TSRMLS_CC)) { 1279 #endif 1278 file_handle->filename == NULL || stat_result != 0 || !ok_to_cache) { 1280 1279 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: compiling\n", getpid())); 1281 1280 t = mm_saved_zend_compile_file(file_handle, type TSRMLS_CC); … … 1307 1306 zend_is_auto_global("_FILES", sizeof("_FILES")-1 TSRMLS_CC); 1308 1307 #endif 1309 if (t != NULL) { 1308 1309 if (t != NULL) { // restore from cache 1310 1310 #ifdef DEBUG 1311 1311 ea_debug_log("[%d] EACCELERATOR hit: \"%s\"\n", getpid(), t->filename); … … 1313 1313 ea_debug_log("EACCELERATOR hit: \"%s\"\n", t->filename); 1314 1314 #endif 1315 /* restored from cache */1316 1315 1317 1316 zend_llist_add_element(&CG(open_files), file_handle); … … 1338 1337 DBG(ea_debug_printf, (EA_DEBUG, "[%d] Leave COMPILE\n", getpid())); 1339 1338 return t; 1340 } else { 1341 /* not in cache or must be recompiled */ 1339 } else { // not in cache or must be recompiled 1342 1340 Bucket *function_table_tail; 1343 1341 Bucket *class_table_tail; … … 1352 1350 1353 1351 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: marking\n", getpid())); 1354 if (CG(class_table) != EG(class_table)) 1355 {1356 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] oops, CG(class_table)[%08x] != EG(class_table)[%08x]\n",getpid(), CG(class_table), EG(class_table)));1352 if (CG(class_table) != EG(class_table)) { 1353 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] oops, CG(class_table)[%08x] != EG(class_table)[%08x]\n", 1354 getpid(), CG(class_table), EG(class_table))); 1357 1355 DBG(ea_debug_log_hashkeys, ("CG(class_table)\n", CG(class_table))); 1358 1356 DBG(ea_debug_log_hashkeys, ("EG(class_table)\n", EG(class_table))); 1359 } 1360 else {1361 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] OKAY. That what I thought, CG(class_table)[%08x] == EG(class_table)[%08x]\n",getpid(), CG(class_table), EG(class_table)));1357 } else { 1358 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] OKAY. That what I thought, CG(class_table)[%08x] == EG(class_table)[%08x]\n", 1359 getpid(), CG(class_table), EG(class_table))); 1362 1360 DBG(ea_debug_log_hashkeys, ("CG(class_table)\n", CG(class_table))); 1363 1361 } … … 1384 1382 DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: compiling (%ld)\n",getpid(),ea_debug_elapsed_time(&tv_start))); 1385 1383 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: compiling tmp_class_table=%d class_table=%d\n", 1386 getpid(), tmp_class_table.nNumOfElements, orig_class_table->nNumOfElements));1384 getpid(), tmp_class_table.nNumOfElements, orig_class_table->nNumOfElements)); 1387 1385 if (EAG(optimizer_enabled) && eaccelerator_mm_instance->optimizer_enabled) { 1388 1386 EAG(compiler) = 1; … … 1411 1409 */ 1412 1410 EAG(compiler) = 0; 1413 if (t != NULL && file_handle->opened_path != NULL && 1414 #ifdef EACCELERATOR_USE_INODE 1415 eaccelerator_ok_to_cache(file_handle->opened_path TSRMLS_CC)) { 1416 #else 1417 (eaccelerator_check_mtime || 1411 if (t != NULL && file_handle->opened_path != NULL && (eaccelerator_check_mtime || 1418 1412 ((stat(file_handle->opened_path, &buf) == 0) && S_ISREG(buf.st_mode)))) { 1419 #endif1420 1413 DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: storing in cache (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 1421 1414 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: storing in cache\n", getpid())); … … 1466 1459 } 1467 1460 #endif 1468 function_table_tail = function_table_tail?function_table_tail->pListNext: 1469 CG(function_table)->pListHead; 1470 class_table_tail = class_table_tail?class_table_tail->pListNext: 1471 CG(class_table)->pListHead; 1472 if (eaccelerator_store(file_handle->opened_path, &buf, nreloads, t, 1473 function_table_tail, class_table_tail TSRMLS_CC)) { 1461 function_table_tail = function_table_tail?function_table_tail->pListNext:CG(function_table)->pListHead; 1462 class_table_tail = class_table_tail?class_table_tail->pListNext:CG(class_table)->pListHead; 1463 if (eaccelerator_store(file_handle->opened_path, &buf, nreloads, t, function_table_tail, class_table_tail TSRMLS_CC)) { 1474 1464 #ifdef DEBUG 1475 ea_debug_log("[%d] EACCELERATOR %s: \"%s\"\n", getpid(), 1476 (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 1477 #else 1478 ea_debug_log("EACCELERATOR %s: \"%s\"\n", 1479 (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 1465 ea_debug_log("[%d] EACCELERATOR %s: \"%s\"\n", getpid(), (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 1466 #else 1467 ea_debug_log("EACCELERATOR %s: \"%s\"\n", (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 1480 1468 #endif 1481 1469 } else { … … 1487 1475 } 1488 1476 } else { 1489 function_table_tail = function_table_tail?function_table_tail->pListNext: 1490 CG(function_table)->pListHead; 1491 class_table_tail = class_table_tail?class_table_tail->pListNext: 1492 CG(class_table)->pListHead; 1477 function_table_tail = function_table_tail?function_table_tail->pListNext:CG(function_table)->pListHead; 1478 class_table_tail = class_table_tail?class_table_tail->pListNext:CG(class_table)->pListHead; 1493 1479 } 1494 1480 CG(function_table) = orig_function_table; … … 1496 1482 #ifdef ZEND_ENGINE_2 1497 1483 EG(class_table) = orig_eg_class_table; 1498 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] restoring CG(class_table)[%08x] != EG(class_table)[%08x]\n", getpid(), CG(class_table), EG(class_table))); 1484 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] restoring CG(class_table)[%08x] != EG(class_table)[%08x]\n", 1485 getpid(), CG(class_table), EG(class_table))); 1499 1486 #endif 1500 1487 while (function_table_tail != NULL) { 1501 1488 zend_op_array *op_array = (zend_op_array*)function_table_tail->pData; 1502 1489 if (op_array->type == ZEND_USER_FUNCTION) { 1503 if (zend_hash_add(CG(function_table), 1504 function_table_tail->arKey, 1505 function_table_tail->nKeyLength, 1506 op_array, sizeof(zend_op_array), NULL) == FAILURE && 1507 function_table_tail->arKey[0] != '\000') { 1490 if (zend_hash_add(CG(function_table), function_table_tail->arKey, function_table_tail->nKeyLength, op_array, 1491 sizeof(zend_op_array), NULL) == FAILURE && function_table_tail->arKey[0] != '\000') { 1508 1492 CG(in_compilation) = 1; 1509 1493 CG(compiled_filename) = file_handle->opened_path; … … 1522 1506 zend_class_entry **ce = (zend_class_entry**)class_table_tail->pData; 1523 1507 if ((*ce)->type == ZEND_USER_CLASS) { 1524 if (zend_hash_add(CG(class_table), 1525 class_table_tail->arKey, 1526 class_table_tail->nKeyLength, 1527 ce, sizeof(zend_class_entry*), NULL) == FAILURE && 1528 class_table_tail->arKey[0] != '\000') { 1508 if (zend_hash_add(CG(class_table), class_table_tail->arKey, class_table_tail->nKeyLength, 1509 ce, sizeof(zend_class_entry*), NULL) == FAILURE && class_table_tail->arKey[0] != '\000') { 1529 1510 CG(in_compilation) = 1; 1530 1511 CG(compiled_filename) = file_handle->opened_path; … … 1534 1515 if (ce->type == ZEND_USER_CLASS) { 1535 1516 if (ce->parent != NULL) { 1536 if (zend_hash_find(CG(class_table), (void*)ce->parent->name, ce->parent->name_length+1, (void **)&ce->parent) != SUCCESS) 1537 { 1517 if (zend_hash_find(CG(class_table), (void*)ce->parent->name, ce->parent->name_length+1, (void **)&ce->parent) != SUCCESS) { 1538 1518 ce->parent = NULL; 1539 1519 } 1540 1520 } 1541 if (zend_hash_add(CG(class_table), 1542 class_table_tail->arKey, 1543 class_table_tail->nKeyLength, 1544 ce, sizeof(zend_class_entry), NULL) == FAILURE && 1545 class_table_tail->arKey[0] != '\000') { 1521 if (zend_hash_add(CG(class_table), class_table_tail->arKey, class_table_tail->nKeyLength, ce, 1522 sizeof(zend_class_entry), NULL) == FAILURE && class_table_tail->arKey[0] != '\000') { 1546 1523 CG(in_compilation) = 1; 1547 1524 CG(compiled_filename) = file_handle->opened_path; … … 2665 2642 2666 2643 #endif /* #ifdef HAVE_EACCELERATOR */ 2644 2645 /* 2646 * Local variables: 2647 * tab-width: 2 2648 * c-basic-offset: 2 2649 * End: 2650 * vim600: noet sw=2 ts=2 fdm=marker 2651 * vim<600: noet sw=2 ts=2 2652 */