@@ -1036,6 +1036,9 @@ int flb_main(int argc, char **argv)
10361036 { "http_port" , required_argument , NULL , 'P' },
10371037#endif
10381038 { "enable-hot-reload" , no_argument , NULL , 'Y' },
1039+ #ifdef FLB_SYSTEM_WINDOWS
1040+ { "maxstdio" , required_argument , NULL , 'M' },
1041+ #endif
10391042#ifdef FLB_HAVE_CHUNK_TRACE
10401043 { "enable-chunk-trace" , no_argument , NULL , 'Z' },
10411044 { "trace" , required_argument , NULL , FLB_LONG_TRACE },
@@ -1073,7 +1076,7 @@ int flb_main(int argc, char **argv)
10731076
10741077 /* Parse the command line options */
10751078 while ((opt = getopt_long (argc , argv ,
1076- "b:c:dDf:C:i:m:o:R:F:p:e:"
1079+ "b:c:dDf:C:i:m:M: o:R:F:p:e:"
10771080 "t:T:l:vw:qVhJL:HP:s:SWYZ" ,
10781081 long_opts , NULL )) != -1 ) {
10791082
@@ -1128,6 +1131,12 @@ int flb_main(int argc, char **argv)
11281131 flb_cf_section_property_add (cf_opts , s -> properties , "match" , 0 , optarg , 0 );
11291132 }
11301133 break ;
1134+ #ifdef FLB_SYSTEM_WINDOWS
1135+ case 'M' :
1136+ flb_cf_section_property_add (cf_opts , service -> properties ,
1137+ "max_stdio" , 0 , optarg , 0 );
1138+ break ;
1139+ #endif
11311140 case 'o' :
11321141 s = flb_cf_section_create (cf_opts , "output" , 0 );
11331142 if (!s ) {
@@ -1350,6 +1359,21 @@ int flb_main(int argc, char **argv)
13501359#endif
13511360
13521361#ifdef FLB_SYSTEM_WINDOWS
1362+ /* Validate specified maxstdio */
1363+ if (config -> maxstdio >= 512 && config -> maxstdio <= 2048 ) {
1364+ _setmaxstdio (config -> maxstdio );
1365+ }
1366+ else if (config -> maxstdio == 0 ) {
1367+ /* nop */
1368+ }
1369+ else {
1370+ fprintf (stderr ,
1371+ "maxstdio is invalid. From 512 to 2048 is vaild but got %d\n" ,
1372+ config -> maxstdio );
1373+ flb_free (cfg_file );
1374+ flb_cf_destroy (cf_opts );
1375+ exit (EXIT_FAILURE );
1376+ }
13531377 win32_started ();
13541378#endif
13551379
0 commit comments