]> granicus.if.org Git - apache/commitdiff
We may not always want to make the pipes between processes non-blocking.
authorRyan Bloom <rbb@apache.org>
Thu, 2 Dec 1999 18:36:39 +0000 (18:36 +0000)
committerRyan Bloom <rbb@apache.org>
Thu, 2 Dec 1999 18:36:39 +0000 (18:36 +0000)
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

modules/filters/mod_include.c
modules/generators/mod_cgi.c
modules/metadata/mod_mime_magic.c
server/log.c

index 30d709d9ef255df07e81fe70155fcd0aa216bd4a..df3dfd6b66fa1616530589b7e074be65314b48e4 100644 (file)
@@ -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. */
index 08e7b2fe3f2826a3f1520006aa09e92899fd6c92..b0debe113db9d53eb593da9323df6b4db6ef1ee7 100644 (file)
@@ -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. */
index 6fd9f379a092afa3bc4856517bd39e9c32a868b0..30f0743e84ef84c8a882478cfca2891ddb2714ea 100644 (file)
@@ -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. */
index aabf62bedd682580648ae794ad815ace9b77300d..29ddff4f7c130ccda2df19eedcb905769440b300 100644 (file)
@@ -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,