From: Ryan Bloom Date: Thu, 2 Dec 1999 18:36:39 +0000 (+0000) Subject: We may not always want to make the pipes between processes non-blocking. X-Git-Tag: 1.3.10~127 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b259c850534cc6df5b3035cefc207ca915d25fff;p=apache We may not always want to make the pipes between processes non-blocking. This patch allows us to set if both sides of the pipes are nonblocking, both sides are blocking, just the parent side blocks, or just the child side blocks for all three of the pipes created during create_process. I have also modified Apache to take advantage of this change. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84215 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 30d709d9ef..df3dfd6b66 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -851,7 +851,8 @@ static int include_cmd(char *s, request_rec *r) } if ((ap_createprocattr_init(&procattr, r->pool) != APR_SUCCESS) || - (ap_setprocattr_io(procattr, 0, 1, 0) != APR_SUCCESS) || + (ap_setprocattr_io(procattr, APR_NO_PIPE, + APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) || (ap_setprocattr_dir(procattr, ap_make_dirstr_parent(r->pool, r->filename)) != APR_SUCCESS) || (ap_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) { /* Something bad happened, tell the world. */ diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 08e7b2fe3f..b0debe113d 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -320,7 +320,10 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr * NB only ISINDEX scripts get decoded arguments. */ if ((ap_createprocattr_init(&procattr, p) != APR_SUCCESS) || - (ap_setprocattr_io(procattr, 1, 1, 1) != APR_SUCCESS) || + (ap_setprocattr_io(procattr, + APR_FULL_BLOCK, + APR_FULL_BLOCK, + APR_FULL_BLOCK) != APR_SUCCESS) || (ap_setprocattr_dir(procattr, ap_make_dirstr_parent(r->pool, r->filename)) != APR_SUCCESS) || (ap_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) { /* Something bad happened, tell the world. */ diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index 6fd9f379a0..30f0743e84 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -2162,7 +2162,8 @@ static int uncompress_child(struct uncompress_parms *parm, ap_context_t *cntxt, env = ap_create_environment(child_context, r->subprocess_env); if ((ap_createprocattr_init(&procattr, child_context) != APR_SUCCESS) || - (ap_setprocattr_io(procattr, 1, 1, 0) != APR_SUCCESS) || + (ap_setprocattr_io(procattr, APR_FULL_BLOCK, + APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) || (ap_setprocattr_dir(procattr, r->filename) != APR_SUCCESS) || (ap_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) { /* Something bad happened, tell the world. */ diff --git a/server/log.c b/server/log.c index aabf62bedd..29ddff4f7c 100644 --- a/server/log.c +++ b/server/log.c @@ -157,8 +157,7 @@ static const TRANS priorities[] = { }; static int log_child(ap_context_t *p, const char *progname, - ap_file_t **fpout, ap_file_t **fpin, - ap_file_t **fperr) + ap_file_t **fpin) { /* Child process code for 'ErrorLog "|..."'; * may want a common framework for this, since I expect it will @@ -179,9 +178,9 @@ static int log_child(ap_context_t *p, const char *progname, if ((ap_createprocattr_init(&procattr, p) != APR_SUCCESS) || (ap_setprocattr_io(procattr, - fpin ? 1 : 0, - fpout ? 1 : 0, - fperr ? 1 : 0) != APR_SUCCESS) || + APR_NO_PIPE, + APR_FULL_BLOCK, + APR_NO_PIPE) != APR_SUCCESS) || (ap_setprocattr_dir(procattr, progname) != APR_SUCCESS)) { /* Something bad happened, give up and go away. */ rc = -1; @@ -198,17 +197,7 @@ static int log_child(ap_context_t *p, const char *progname, ap_get_os_proc(&fred, procnew); ap_note_subprocess(p, fred, kill_after_timeout); #endif - if (fpin) { - ap_get_childin(fpin, procnew); - } - - if (fpout) { - ap_get_childout(fpout, procnew); - } - - if (fperr) { - ap_get_childerr(fperr, procnew); - } + ap_get_childin(fpin, procnew); } } @@ -226,7 +215,7 @@ static void open_error_log(server_rec *s, ap_context_t *p) ap_file_t *dummy; /* This starts a new process... */ - rc = log_child (p, s->error_fname+1, NULL, &dummy, NULL); + rc = log_child (p, s->error_fname+1, &dummy); if (rc != APR_SUCCESS) { perror("ap_spawn_child"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, @@ -767,7 +756,7 @@ API_EXPORT(piped_log *) ap_open_piped_log(ap_context_t *p, const char *program) ap_file_t *dummy; int rc; - rc = log_child(p, program, NULL, &dummy, NULL); + rc = log_child(p, program, &dummy); if (rc != APR_SUCCESS) { perror("ap_spawn_child"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,