bin: expose new '-s/--coro_stack_size' option
@@ -146,6 +146,8 @@ static void flb_help(int rc, struct flb_config *config)
printf(" -P, --port\t\tset HTTP server TCP port (default: %s)\n",
FLB_CONFIG_HTTP_PORT);
#endif
+ printf(" -s, --coro_stack_size\tSet coroutines stack size in bytes "
+ "(default: %i)\n", config->coro_stack_size);
printf(" -q, --quiet\t\tquiet mode\n");
printf(" -S, --sosreport\tsupport report for Enterprise customers\n");
printf(" -V, --version\t\tshow version number\n");
@@ -607,6 +609,7 @@ int main(int argc, char **argv)
{ "verbose", no_argument , NULL, 'v' },
{ "quiet", no_argument , NULL, 'q' },
{ "help", no_argument , NULL, 'h' },
+ { "coro_stack_size", required_argument, NULL, 's'},
{ "sosreport", no_argument , NULL, 'S' },
#ifdef FLB_HAVE_HTTP_SERVER
{ "http_server", no_argument , NULL, 'H' },
@@ -650,7 +653,9 @@ int main(int argc, char **argv)
#ifndef FLB_HAVE_STATIC_CONF
/* Parse the command line options */
- while ((opt = getopt_long(argc, argv, "b:B:c:df:i:m:o:R:F:p:e:t:l:vqVhL:HP:S",
+ while ((opt = getopt_long(argc, argv,
+ "b:B:c:df:i:m:o:R:F:p:e:"
+ "t:l:vqVhL:HP:s:S",
long_opts, NULL)) != -1) {
switch (opt) {
@@ -776,6 +781,9 @@ int main(int argc, char **argv)
case 'q':
config->verbose = FLB_LOG_OFF;
break;
+ case 's':
+ config->coro_stack_size = (unsigned int) atoi(optarg);
+ break;
case 'S':
config->support_mode = FLB_TRUE;
break;
@@ -810,6 +818,11 @@ int main(int argc, char **argv)
}
#endif
+ /* Check co-routine stack size */
+ if (config->coro_stack_size < getpagesize()) {
+ flb_utils_error(FLB_ERR_CORO_STACK_SIZE);
+ }
+
/* Validate flush time (seconds) */
if (config->flush < 1) {
flb_utils_error(FLB_ERR_CFG_FLUSH);
