File tree 4 files changed +40
-1
lines changed
4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -1454,6 +1454,7 @@ END
1454
1454
have=T_NGX_DNS_RESOLVE_BACKUP . auto/have
1455
1455
have=T_NGX_MASTER_ENV . auto/have
1456
1456
have=T_PIPES . auto/have
1457
+ have=T_PIPE_SET_SIZE . auto/have
1457
1458
have=T_NGX_INPUT_BODY_FILTER . auto/have
1458
1459
have=T_NGX_GZIP_CLEAR_ETAG . auto/have
1459
1460
have=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[] = {
166
166
167
167
#endif
168
168
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
+
169
178
ngx_null_command
170
179
};
171
180
@@ -1148,6 +1157,10 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle)
1148
1157
return NULL ;
1149
1158
}
1150
1159
1160
+ #ifdef T_PIPE_SET_SIZE
1161
+ ccf -> pipe_size = NGX_CONF_UNSET_SIZE ;
1162
+ #endif
1163
+
1151
1164
return ccf ;
1152
1165
}
1153
1166
@@ -1282,6 +1295,16 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
1282
1295
1283
1296
#endif
1284
1297
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
+
1285
1308
return NGX_CONF_OK ;
1286
1309
}
1287
1310
Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ typedef struct {
133
133
char * * environment ;
134
134
135
135
ngx_uint_t transparent ; /* unsigned transparent:1; */
136
+
137
+ #if (T_PIPE_SET_SIZE )
138
+ size_t pipe_size ;
139
+ #endif
140
+
136
141
} ngx_core_conf_t ;
137
142
138
143
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)
428
428
u_char * * argv ;
429
429
ngx_pid_t pid ;
430
430
sigset_t set ;
431
- #ifdef T_PIPE_USE_USER
431
+ #if defined( T_PIPE_USE_USER ) || defined( T_PIPE_SET_SIZE )
432
432
ngx_core_conf_t * ccf ;
433
433
434
434
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)
438
438
return NGX_ERROR ;
439
439
}
440
440
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
+
441
451
argv = op -> argv -> elts ;
442
452
443
453
if ((pid = fork ()) < 0 ) {
You can’t perform that action at this time.
0 commit comments