]> granicus.if.org Git - apache/commitdiff
Convert ap_proc_t to a complete type. This lets us access the pid directly.
authorRyan Bloom <rbb@apache.org>
Tue, 23 May 2000 21:04:03 +0000 (21:04 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 23 May 2000 21:04:03 +0000 (21:04 +0000)
Only the prefork MPM has been ported so far, the rest of the Unix MPM's are
coming later today.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85279 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_include.c
modules/generators/mod_cgi.c
server/log.c
server/mpm/prefork/prefork.c
server/mpm_common.c

index b70c21fde98e5a31f859e21acde76e9141aca1a9..adc298d66d0d7911ec184f7bdd44629919afe8cd 100644 (file)
@@ -822,7 +822,7 @@ static int include_cmd(char *s, request_rec *r)
     include_cmd_arg arg;
     BUFF *script_in;
     ap_procattr_t *procattr;
-    ap_proc_t *procnew;
+    ap_proc_t procnew;
     ap_status_t rc;
     ap_table_t *env = r->subprocess_env;
     char **argv;
@@ -880,9 +880,9 @@ static int include_cmd(char *s, request_rec *r)
                         "couldn't create child process: %d: %s", rc, s);
         }
         else {
-            ap_note_subprocess(r->pool, procnew, kill_after_timeout);
+            ap_note_subprocess(r->pool, &procnew, kill_after_timeout);
             /* Fill in BUFF structure for parents pipe to child's stdout */
-            ap_get_childout(&file, procnew);
+            file = procnew.stdout;
             iol = ap_create_file_iol(file);
             if (!iol)
                 return APR_EBADF;
index 2ff36d36e81c252e504383c5c80114d2c840e496..8bc39979b4ddb2affb1e79af1f2381db32d6efec 100644 (file)
@@ -295,7 +295,7 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
 {
     char **env;
     ap_procattr_t *procattr;
-    ap_proc_t *procnew;
+    ap_proc_t procnew;
     ap_status_t rc = APR_SUCCESS;
     ap_file_t *file = NULL;
     ap_iol *iol;
@@ -349,10 +349,10 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
                         "couldn't create child process: %d: %s", rc, r->filename);
         }
         else {
-            ap_note_subprocess(p, procnew, kill_after_timeout);
+            ap_note_subprocess(p, &procnew, kill_after_timeout);
 
             /* Fill in BUFF structure for parents pipe to child's stdout */
-            ap_get_childout(&file, procnew);
+            file = procnew.stdout;
             iol = ap_create_file_iol(file);
             if (!iol)
                 return APR_EBADF;
@@ -361,7 +361,7 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
             ap_bsetopt(*script_in, BO_TIMEOUT, &r->server->timeout);
 
             /* Fill in BUFF structure for parents pipe to child's stdin */
-            ap_get_childin(&file, procnew);
+            file = procnew.stdin;
             iol = ap_create_file_iol(file);
             if (!iol)
                 return APR_EBADF;
@@ -370,7 +370,7 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
             ap_bsetopt(*script_out, BO_TIMEOUT, &r->server->timeout);
 
             /* Fill in BUFF structure for parents pipe to child's stderr */
-            ap_get_childerr(&file, procnew);
+            file = procnew.stderr;
             iol = ap_create_file_iol(file);
             if (!iol)
                 return APR_EBADF;
index d63bcc5efefad597392b6527a7234165702d20db..89d52981b978ec566ec028cf9d57da5aa3df234d 100644 (file)
@@ -168,7 +168,7 @@ static int log_child(ap_pool_t *p, const char *progname,
      */
     int rc = -1;
     ap_procattr_t *procattr;
-    ap_proc_t *procnew;
+    ap_proc_t procnew;
 
 #ifdef SIGHUP
     /* No concept of a child process on Win32 */
@@ -192,8 +192,8 @@ static int log_child(ap_pool_t *p, const char *progname,
         rc = ap_create_process(&procnew, pname, args, NULL, procattr, p);
     
         if (rc == APR_SUCCESS) {
-            ap_note_subprocess(p, procnew, kill_after_timeout);
-            ap_get_childin(fpin, procnew);
+            ap_note_subprocess(p, &procnew, kill_after_timeout);
+            (*fpin) = procnew.stdin;
         }
     }
 
@@ -589,7 +589,7 @@ static int piped_log_spawn(piped_log *pl)
 {
     int rc;
     ap_procattr_t *procattr;
-    ap_proc_t *procnew;
+    ap_proc_t procnew;
 
 #ifdef SIGHUP
     ap_signal(SIGHUP, SIG_IGN);
@@ -617,8 +617,8 @@ static int piped_log_spawn(piped_log *pl)
             /*   I am assuming that if ap_create_process was  */
             /*   successful that the child is running.        */
             RAISE_SIGSTOP(PIPED_LOG_SPAWN); 
-            pl->pid = procnew;
-            ap_register_other_child(procnew, piped_log_maintenance, pl, 
+            pl->pid = &procnew;
+            ap_register_other_child(&procnew, piped_log_maintenance, pl, 
                                     ap_piped_log_write_fd(pl), pl->p);
         }
     }
index ec38b3dedd21683d7a36630a26412305d76ae88b..3da49bf35519dfa51885dbc83b68e7efb26c8a6b 100644 (file)
@@ -1019,11 +1019,9 @@ static void increment_counts(int child_num, request_rec *r)
 static int find_child_by_pid(ap_proc_t *pid)
 {
     int i;
-    int actual_pid;
 
-    ap_get_os_proc(&actual_pid, pid);
     for (i = 0; i < ap_max_daemons_limit; ++i)
-       if (ap_scoreboard_image->parent[i].pid == actual_pid)
+       if (ap_scoreboard_image->parent[i].pid == pid->pid)
            return i;
 
     return -1;
@@ -1798,10 +1796,8 @@ static void perform_idle_server_maintenance(void)
 }
 
 
-static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
+static void process_child_status(ap_proc_t *pid, ap_wait_t status)
 {
-    int pid;
-    ap_get_os_proc(&pid, abs_pid);
     /* Child died... if it died due to a fatal error,
        * we should simply bail out.
        */
@@ -1810,7 +1806,7 @@ static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
                        "Child %d returned a Fatal error... \n"
                        "Apache is exiting!",
-                       pid);
+                       pid->pid);
        exit(APEXIT_CHILDFATAL);
     }
     if (WIFSIGNALED(status)) {
@@ -1828,7 +1824,7 @@ static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
                             0, ap_server_conf,
                             "child pid %d exit signal %s (%d), "
                             "possible coredump in %s",
-                            pid, (WTERMSIG(status) >= NumSIG) ? "" : 
+                            pid->pid, (WTERMSIG(status) >= NumSIG) ? "" : 
                             SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
                             ap_coredump_dir);
            }
@@ -1836,7 +1832,7 @@ static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
 #endif
                ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
                             0, ap_server_conf,
-                            "child pid %d exit signal %s (%d)", pid,
+                            "child pid %d exit signal %s (%d)", pid->pid,
                             SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
 #ifdef WCOREDUMP
            }
@@ -1845,7 +1841,7 @@ static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
                         ap_server_conf,
                         "child pid %d exit signal %d",
-                        pid, WTERMSIG(status));
+                        pid->pid, WTERMSIG(status));
 #endif
        }
     }
@@ -1994,12 +1990,9 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s)
                    * scoreboard.  Somehow we don't know about this
                    * child.
                    */
-                ap_os_proc_t os_pid;
-
-                ap_get_os_proc(&os_pid, pid);
                ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 
                             0, ap_server_conf,
-                           "long lost child came home! (pid %d)", os_pid);
+                           "long lost child came home! (pid %d)", pid->pid);
            }
            /* Don't perform idle maintenance when a child dies,
                * only do it when there's a timeout.  Remember only a
index b4efc03585271da739ec0c17d8d7706786006bf2..cba30a701fbd971c7f4aaac9f7aa54c2e16ac24d 100644 (file)
@@ -180,7 +180,7 @@ ap_proc_t *ap_wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
 {
     struct timeval tv;
     ap_status_t rv;
-    ap_proc_t *ret = NULL;
+    ap_proc_t *ret;
 
     ++wait_or_timeout_counter;
     if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
@@ -189,7 +189,7 @@ ap_proc_t *ap_wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
         ap_probe_writable_fds();
 #endif
     }
-    rv = ap_wait_all_procs(&ret, status, APR_NOWAIT, p);
+    rv = ap_wait_all_procs(ret, status, APR_NOWAIT, p);
     if (ap_canonical_error(rv) == APR_EINTR) {
         return NULL;
     }