@@ -1067,6 +1067,9 @@ int flb_main(int argc, char **argv)
10671067 { "http_port" , required_argument , NULL , 'P' },
10681068#endif
10691069 { "enable-hot-reload" , no_argument , NULL , 'Y' },
1070+ #ifdef FLB_SYSTEM_WINDOWS
1071+ { "maxstdio" , required_argument , NULL , 'M' },
1072+ #endif
10701073#ifdef FLB_HAVE_CHUNK_TRACE
10711074 { "enable-chunk-trace" , no_argument , NULL , 'Z' },
10721075 { "trace" , required_argument , NULL , FLB_LONG_TRACE },
@@ -1104,7 +1107,7 @@ int flb_main(int argc, char **argv)
11041107
11051108 /* Parse the command line options */
11061109 while ((opt = getopt_long (argc , argv ,
1107- "b:c:dDf:C:i:m:o:R:r:F:p:e:"
1110+ "b:c:dDf:C:i:m:M: o:R:r:F:p:e:"
11081111 "t:T:l:vw:qVhJL:HP:s:SWYZ" ,
11091112 long_opts , NULL )) != -1 ) {
11101113
@@ -1159,6 +1162,12 @@ int flb_main(int argc, char **argv)
11591162 flb_cf_section_property_add (cf_opts , s -> properties , "match" , 0 , optarg , 0 );
11601163 }
11611164 break ;
1165+ #ifdef FLB_SYSTEM_WINDOWS
1166+ case 'M' :
1167+ flb_cf_section_property_add (cf_opts , service -> properties ,
1168+ "max_stdio" , 0 , optarg , 0 );
1169+ break ;
1170+ #endif
11621171 case 'o' :
11631172 s = flb_cf_section_create (cf_opts , "output" , 0 );
11641173 if (!s ) {
@@ -1391,6 +1400,18 @@ int flb_main(int argc, char **argv)
13911400#endif
13921401
13931402#ifdef FLB_SYSTEM_WINDOWS
1403+ /* Validate specified maxstdio */
1404+ if (config -> maxstdio >= 512 && config -> maxstdio <= 2048 ) {
1405+ _setmaxstdio (config -> maxstdio );
1406+ }
1407+ else {
1408+ fprintf (stderr ,
1409+ "maxstdio is invalid. From 512 to 2048 is vaild but got %d\n" ,
1410+ config -> maxstdio );
1411+ flb_free (cfg_file );
1412+ flb_cf_destroy (cf_opts );
1413+ exit (EXIT_FAILURE );
1414+ }
13941415 win32_started ();
13951416#endif
13961417
0 commit comments