ben 98/05/18 13:41:33
Modified: src/include alloc.h buff.h src/main alloc.c http_log.c src/modules/standard mod_include.c Log: Fix spawning stuff for Unix. Revision Changes Path 1.58 +7 -4 apache-1.3/src/include/alloc.h Index: alloc.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/alloc.h,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- alloc.h 1998/05/16 16:34:46 1.57 +++ alloc.h 1998/05/18 20:41:30 1.58 @@ -301,10 +301,13 @@ kill_only_once /* send SIGTERM and then wait */ }; -API_EXPORT(void) ap_note_subprocess(pool *a, int pid, enum kill_conditions how); -API_EXPORT(int) ap_spawn_child_err(pool *, int (*)(void *), void *, - enum kill_conditions, FILE **pipe_in, FILE **pipe_out, - FILE **pipe_err); +typedef struct child_info child_info; +API_EXPORT(void) ap_note_subprocess(pool *a, int pid, + enum kill_conditions how); +API_EXPORT(int) ap_spawn_child_err(pool *, int (*)(void *, child_info *), + void *, enum kill_conditions, + FILE **pipe_in, FILE **pipe_out, + FILE **pipe_err); #define spawn_child(p,f,v,k,in,out) ap_spawn_child_err(p,f,v,k,in,out,NULL) /* magic numbers --- min free bytes to consider a free pool block useable, 1.41 +2 -2 apache-1.3/src/include/buff.h Index: buff.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/buff.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- buff.h 1998/05/16 16:34:46 1.40 +++ buff.h 1998/05/18 20:41:30 1.41 @@ -197,7 +197,7 @@ ?os_toascii[(unsigned char)c]:(c), 0)) #endif /*CHARSET_EBCDIC*/ -typedef struct { +struct _child_info { #ifdef WIN32 /* * These handles are used by ap_call_exec to call @@ -207,7 +207,7 @@ HANDLE hPipeOutputWrite; HANDLE hPipeErrorWrite; #endif -} child_info; +}; API_EXPORT(int) ap_spawn_child_err_buff(pool *, int (*)(void *, child_info *), void *, enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err); 1.93 +8 -7 apache-1.3/src/main/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/alloc.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- alloc.c 1998/05/16 16:34:47 1.92 +++ alloc.c 1998/05/18 20:41:31 1.93 @@ -1806,8 +1806,8 @@ #define BINMODE #endif -static int spawn_child_err_core(pool *p, int (*func) (void *), void *data, - enum kill_conditions kill_how, +static int spawn_child_err_core(pool *p, int (*func) (void *, child_info *), + void *data,enum kill_conditions kill_how, int *pipe_in, int *pipe_out, int *pipe_err) { int pid; @@ -1876,7 +1876,7 @@ close(err_fds[1]); } - pid = (*func) (data); + pid = (*func) (data, NULL); if (pid == -1) pid = 0; /* map Win32 error code onto Unix default */ if (!pid) { @@ -1965,7 +1965,7 @@ /* HP-UX SIGCHLD fix goes here, if someone will remind me what it is... */ signal(SIGCHLD, SIG_DFL); /* Was that it? */ - func(data); + func(data, NULL); exit(1); /* Should only get here if the exec in func() failed */ } @@ -1993,9 +1993,10 @@ } -API_EXPORT(int) ap_spawn_child_err(pool *p, int (*func) (void *), void *data, - enum kill_conditions kill_how, - FILE **pipe_in, FILE **pipe_out, FILE **pipe_err) +API_EXPORT(int) ap_spawn_child_err(pool *p, int (*func) (void *, child_info *), + void *data, enum kill_conditions kill_how, + FILE **pipe_in, FILE **pipe_out, + FILE **pipe_err) { int fd_in, fd_out, fd_err; int pid, save_errno; 1.58 +1 -1 apache-1.3/src/main/http_log.c Index: http_log.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_log.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- http_log.c 1998/05/16 16:34:48 1.57 +++ http_log.c 1998/05/18 20:41:32 1.58 @@ -154,7 +154,7 @@ {NULL, -1}, }; -static int error_log_child (void *cmd) +static int error_log_child (void *cmd, child_info *pinfo) { /* Child process code for 'ErrorLog "|..."'; * may want a common framework for this, since I expect it will 1.87 +4 -3 apache-1.3/src/modules/standard/mod_include.c Index: mod_include.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_include.c,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- mod_include.c 1998/05/16 16:34:50 1.86 +++ mod_include.c 1998/05/18 20:41:33 1.87 @@ -1,4 +1,4 @@ -/* ==================================================================== + /* ==================================================================== * Copyright (c) 1995-1998 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -735,7 +735,7 @@ char *s; } include_cmd_arg; -static int include_cmd_child(void *arg) +static int include_cmd_child(void *arg, child_info *pinfo) { request_rec *r = ((include_cmd_arg *) arg)->r; char *s = ((include_cmd_arg *) arg)->s; @@ -786,7 +786,8 @@ #endif ap_cleanup_for_exec(); /* set shellcmd flag to pass arg to SHELL_PATH */ - child_pid = ap_call_exec(r, s, ap_create_environment(r->pool, env), 1); + child_pid = ap_call_exec(r, NULL, s, ap_create_environment(r->pool, env), + 1); #ifdef WIN32 return (child_pid); #else