File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed
Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -1454,6 +1454,7 @@ END
14541454have=T_NGX_DNS_RESOLVE_BACKUP . auto/have
14551455have=T_NGX_MASTER_ENV . auto/have
14561456have=T_PIPES . auto/have
1457+ have=T_PIPE_SET_SIZE . auto/have
14571458have=T_NGX_INPUT_BODY_FILTER . auto/have
14581459have=T_NGX_GZIP_CLEAR_ETAG . auto/have
14591460have=T_NGX_RESOLVER_FILE . auto/have
Original file line number Diff line number Diff line change @@ -166,6 +166,15 @@ static ngx_command_t ngx_core_commands[] = {
166166
167167#endif
168168
169+ #if (T_PIPE_SET_SIZE )
170+ { ngx_string ("pipe_set_size" ),
171+ NGX_MAIN_CONF |NGX_DIRECT_CONF |NGX_CONF_TAKE1 ,
172+ ngx_conf_set_size_slot ,
173+ 0 ,
174+ offsetof(ngx_core_conf_t , pipe_size ),
175+ NULL },
176+ #endif
177+
169178 ngx_null_command
170179};
171180
@@ -1148,6 +1157,10 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle)
11481157 return NULL ;
11491158 }
11501159
1160+ #ifdef T_PIPE_SET_SIZE
1161+ ccf -> pipe_size = NGX_CONF_UNSET_SIZE ;
1162+ #endif
1163+
11511164 return ccf ;
11521165}
11531166
@@ -1282,6 +1295,16 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
12821295
12831296#endif
12841297
1298+ #ifdef T_PIPE_SET_SIZE
1299+ if (ccf -> pipe_size != NGX_CONF_UNSET_SIZE ) {
1300+ if (ccf -> pipe_size < 64 * 1024 ) {
1301+ ngx_log_error (NGX_LOG_EMERG , cycle -> log , 0 ,
1302+ "\"pipe_size\" must be at least 64K, ignored" );
1303+ return NGX_CONF_ERROR ;
1304+ }
1305+ }
1306+ #endif
1307+
12851308 return NGX_CONF_OK ;
12861309}
12871310
Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ typedef struct {
133133 char * * environment ;
134134
135135 ngx_uint_t transparent ; /* unsigned transparent:1; */
136+
137+ #if (T_PIPE_SET_SIZE )
138+ size_t pipe_size ;
139+ #endif
140+
136141} ngx_core_conf_t ;
137142
138143
Original file line number Diff line number Diff line change @@ -428,7 +428,7 @@ ngx_open_pipe(ngx_cycle_t *cycle, ngx_open_pipe_t *op)
428428 u_char * * argv ;
429429 ngx_pid_t pid ;
430430 sigset_t set ;
431- #ifdef T_PIPE_USE_USER
431+ #if defined( T_PIPE_USE_USER ) || defined( T_PIPE_SET_SIZE )
432432 ngx_core_conf_t * ccf ;
433433
434434 ccf = (ngx_core_conf_t * ) ngx_get_conf (cycle -> conf_ctx , ngx_core_module );
@@ -438,6 +438,16 @@ ngx_open_pipe(ngx_cycle_t *cycle, ngx_open_pipe_t *op)
438438 return NGX_ERROR ;
439439 }
440440
441+ #ifdef T_PIPE_SET_SIZE
442+ if (ccf -> pipe_size != NGX_CONF_UNSET_SIZE && ccf -> pipe_size != 0 ) {
443+ if (fcntl (op -> pfd [1 ], F_SETPIPE_SZ , ccf -> pipe_size ) == -1 ) {
444+ ngx_log_error (NGX_LOG_EMERG , cycle -> log , ngx_errno ,
445+ "set pipe size (%d) failed" , ccf -> pipe_size );
446+ goto err ;
447+ }
448+ }
449+ #endif
450+
441451 argv = op -> argv -> elts ;
442452
443453 if ((pid = fork ()) < 0 ) {
You can’t perform that action at this time.
0 commit comments