Skip to content

Commit 5c550c4

Browse files
committed
Move ini setting to zend.c
Changed setting to use values similar to memory_limit, e.g., fiber.stack_size = 8M
1 parent 1db2667 commit 5c550c4

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

Zend/zend.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@ static ZEND_INI_MH(OnSetExceptionStringParamMaxLen) /* {{{ */
175175
}
176176
/* }}} */
177177

178+
static ZEND_INI_MH(OnUpdateFiberStackSize) /* {{{ */
179+
{
180+
if (new_value) {
181+
EG(fiber_stack_size) = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
182+
} else {
183+
EG(fiber_stack_size) = zend_fiber_page_size() * ZEND_FIBER_DEFAULT_PAGE_COUNT;
184+
}
185+
return SUCCESS;
186+
}
187+
/* }}} */
188+
178189
#if ZEND_DEBUG
179190
# define SIGNAL_CHECK_DEFAULT "1"
180191
#else
@@ -193,6 +204,8 @@ ZEND_INI_BEGIN()
193204
#endif
194205
STD_ZEND_INI_BOOLEAN("zend.exception_ignore_args", "0", ZEND_INI_ALL, OnUpdateBool, exception_ignore_args, zend_executor_globals, executor_globals)
195206
STD_ZEND_INI_ENTRY("zend.exception_string_param_max_len", "15", ZEND_INI_ALL, OnSetExceptionStringParamMaxLen, exception_string_param_max_len, zend_executor_globals, executor_globals)
207+
STD_ZEND_INI_ENTRY("fiber.stack_size", NULL, ZEND_INI_ALL, OnUpdateFiberStackSize, fiber_stack_size, zend_executor_globals, executor_globals)
208+
196209
ZEND_INI_END()
197210

198211
ZEND_API size_t zend_vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */

main/main.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -303,36 +303,6 @@ static PHP_INI_MH(OnSetLogFilter)
303303
}
304304
/* }}} */
305305

306-
/* {{{ PHP_INI_MH */
307-
static PHP_INI_MH(OnUpdateFiberStackSize)
308-
{
309-
zend_long tmp;
310-
const size_t page_size = zend_fiber_page_size();
311-
312-
if (OnUpdateLongGEZero(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage) == FAILURE) {
313-
return FAILURE;
314-
}
315-
316-
if (EG(fiber_stack_size) == 0) {
317-
EG(fiber_stack_size) = page_size * ZEND_FIBER_DEFAULT_PAGE_COUNT;
318-
return SUCCESS;
319-
}
320-
321-
EG(fiber_stack_size) += ZEND_FIBER_GUARD_PAGES;
322-
323-
tmp = page_size * EG(fiber_stack_size);
324-
325-
if (tmp / page_size != EG(fiber_stack_size)) {
326-
EG(fiber_stack_size) = page_size * ZEND_FIBER_DEFAULT_PAGE_COUNT;
327-
return FAILURE;
328-
}
329-
330-
EG(fiber_stack_size) = tmp;
331-
332-
return SUCCESS;
333-
}
334-
/* }}} */
335-
336306
/* {{{ php_disable_classes */
337307
static void php_disable_classes(void)
338308
{
@@ -768,8 +738,6 @@ PHP_INI_BEGIN()
768738
STD_PHP_INI_ENTRY("syslog.facility", "LOG_USER", PHP_INI_SYSTEM, OnSetFacility, syslog_facility, php_core_globals, core_globals)
769739
STD_PHP_INI_ENTRY("syslog.ident", "php", PHP_INI_SYSTEM, OnUpdateString, syslog_ident, php_core_globals, core_globals)
770740
STD_PHP_INI_ENTRY("syslog.filter", "no-ctrl", PHP_INI_ALL, OnSetLogFilter, syslog_filter, php_core_globals, core_globals)
771-
772-
STD_PHP_INI_ENTRY("fiber.stack_size", "0", PHP_INI_ALL, OnUpdateFiberStackSize, fiber_stack_size, zend_executor_globals, executor_globals)
773741
PHP_INI_END()
774742
/* }}} */
775743

0 commit comments

Comments
 (0)