You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@hyperreal.org on 1998/05/29 00:10:01 UTC
cvs commit: apache-1.3/src/modules/standard mod_cgi.c mod_include.c mod_mime_magic.c mod_rewrite.c
brian 98/05/28 15:10:00
Modified: htdocs/manual new_features_1_3.html
src/include alloc.h buff.h compat.h
src/main alloc.c http_log.c
src/modules/standard mod_cgi.c mod_include.c
mod_mime_magic.c mod_rewrite.c
Log:
In the interests of some API cleanup:
I converted all occurances of spawn_child to ap_spawn_child_err, and
removed the spawn_child macro (actually moved it to compat.h)
I then changed ap_spawn_child_err to simply ap_spawn_child, and
ap_spawn_child_err_buff to ap_bspawn_child.
These are all cosmetic and should not change functionality, but I think
this will be of assistance to module authors trying to learn by examples we
set in our code (lord help them!).
Approved in concept by dgaudet & rse.
Revision Changes Path
1.65 +8 -3 apache-1.3/htdocs/manual/new_features_1_3.html
Index: new_features_1_3.html
===================================================================
RCS file: /export/home/cvs/apache-1.3/htdocs/manual/new_features_1_3.html,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- new_features_1_3.html 1998/05/20 23:08:35 1.64
+++ new_features_1_3.html 1998/05/28 22:09:41 1.65
@@ -419,7 +419,7 @@
coming from the client).
<DT><STRONG><CODE>kill_only_once</CODE></STRONG>
-<DD>An option to <CODE>spawn_child</CODE> functions which prevents Apache
+<DD>An option to <CODE>ap_spawn_child</CODE> functions which prevents Apache
from aggressively trying to kill off the child.
<DT><STRONG><CODE>alloc debugging code</CODE></STRONG>
@@ -453,11 +453,16 @@
<A HREF="mod/core.html#usecanonicalname">UseCanonicalName</A> directive
when retrieving the server name and port for a request.
-<DT><STRONG>Change to prototype for <CODE>ap_spawn_child_err_buff</CODE> and
+<DT><STRONG>Change to prototype for <CODE>ap_bspawn_child</CODE> and
<CODE>ap_call_exec</CODE></STRONG>
<DD>Added a <CODE>child_info *</CODE> to <CODE>spawn</CODE> function
- (as passed to <CODE>ap_spawn_child_err_buff</CODE>) and to
+ (as passed to <CODE>ap_bspawn_child</CODE>) and to
<CODE>ap_call_exec</CODE> to allow children to work correctly on Win32.
+ We also cleaned up the nomenclature a bit, replacing
+ <CODE>spawn_child_err</CODE> with simply
+ <CODE>ap_spawn_child</CODE> and <CODE>spawn_child_err_buff</CODE>
+ with simply <CODE>ap_bspawn_child</CODE>.
+
</DL>
<P><HR>
1.59 +2 -3 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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- alloc.h 1998/05/18 20:41:30 1.58
+++ alloc.h 1998/05/28 22:09:45 1.59
@@ -286,7 +286,7 @@
/* ... even child processes (which we may want to wait for,
* or to kill outright, on unexpected termination).
*
- * spawn_child is a utility routine which handles an awful lot of
+ * ap_spawn_child is a utility routine which handles an awful lot of
* the rigamarole associated with spawning a child --- it arranges
* for pipes to the child's stdin and stdout, if desired (if not,
* set the associated args to NULL). It takes as args a function
@@ -304,11 +304,10 @@
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 *),
+API_EXPORT(int) ap_spawn_child(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,
* and the min amount to allocate if we have to go to malloc() */
1.44 +1 -1 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.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- buff.h 1998/05/19 19:29:00 1.43
+++ buff.h 1998/05/28 22:09:46 1.44
@@ -217,7 +217,7 @@
int dummy;
#endif
};
-API_EXPORT(int) ap_spawn_child_err_buff(pool *, int (*)(void *, child_info *), void *,
+API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *), void *,
enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out,
BUFF **pipe_err);
1.10 +7 -2 apache-1.3/src/include/compat.h
Index: compat.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/compat.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- compat.h 1998/05/27 22:55:59 1.9
+++ compat.h 1998/05/28 22:09:46 1.10
@@ -363,8 +363,8 @@
#define show_modules ap_show_modules
#define soft_timeout ap_soft_timeout
#define some_auth_required ap_some_auth_required
-#define spawn_child_err ap_spawn_child_err
-#define spawn_child_err_buff ap_spawn_child_err_buff
+#define spawn_child_err ap_spawn_child
+#define spawn_child_err_buff ap_bspawn_child
#define srm_command_loop ap_srm_command_loop
#define standalone ap_standalone
#define start_restart ap_start_restart
@@ -404,6 +404,11 @@
#define util_uri_init ap_util_uri_init
#define uudecode ap_uudecode
#define vbprintf ap_vbprintf
+
+/*
+ * Macros for routines whose arguments have changed over time.
+ */
+#define spawn_child(p,f,v,k,in,out) ap_spawn_child(p,f,v,k,in,out,NULL)
#ifdef __cplusplus
}
1.94 +18 -18 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.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- alloc.c 1998/05/18 20:41:31 1.93
+++ alloc.c 1998/05/28 22:09:50 1.94
@@ -1806,9 +1806,9 @@
#define BINMODE
#endif
-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)
+static int spawn_child_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;
int in_fds[2];
@@ -1993,20 +1993,20 @@
}
-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)
+API_EXPORT(int) ap_spawn_child(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;
ap_block_alarms();
- pid = spawn_child_err_core(p, func, data, kill_how,
- pipe_in ? &fd_in : NULL,
- pipe_out ? &fd_out : NULL,
- pipe_err ? &fd_err : NULL);
+ pid = spawn_child_core(p, func, data, kill_how,
+ pipe_in ? &fd_in : NULL,
+ pipe_out ? &fd_out : NULL,
+ pipe_err ? &fd_err : NULL);
if (pid == 0) {
save_errno = errno;
@@ -2043,9 +2043,9 @@
return pid;
}
-API_EXPORT(int) ap_spawn_child_err_buff(pool *p, int (*func) (void *, child_info *), void *data,
- enum kill_conditions kill_how,
- BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err)
+API_EXPORT(int) ap_bspawn_child(pool *p, int (*func) (void *, child_info *), void *data,
+ enum kill_conditions kill_how,
+ BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err)
{
#ifdef WIN32
SECURITY_ATTRIBUTES sa = {0};
@@ -2180,10 +2180,10 @@
ap_block_alarms();
- pid = spawn_child_err_core(p, func, data, kill_how,
- pipe_in ? &fd_in : NULL,
- pipe_out ? &fd_out : NULL,
- pipe_err ? &fd_err : NULL);
+ pid = spawn_child_core(p, func, data, kill_how,
+ pipe_in ? &fd_in : NULL,
+ pipe_out ? &fd_out : NULL,
+ pipe_err ? &fd_err : NULL);
if (pid == 0) {
save_errno = errno;
1.59 +6 -6 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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- http_log.c 1998/05/18 20:41:32 1.58
+++ http_log.c 1998/05/28 22:09:50 1.59
@@ -188,9 +188,9 @@
if (*s->error_fname == '|') {
FILE *dummy;
- if (!spawn_child (p, error_log_child, (void *)(s->error_fname+1),
- kill_after_timeout, &dummy, NULL)) {
- perror ("spawn_child");
+ if (!ap_spawn_child(p, error_log_child, (void *)(s->error_fname+1),
+ kill_after_timeout, &dummy, NULL, NULL)) {
+ perror ("ap_spawn_child");
fprintf (stderr, "Couldn't fork child for ErrorLog process\n");
exit (1);
}
@@ -652,9 +652,9 @@
piped_log *pl;
FILE *dummy;
- if (!spawn_child (p, piped_log_child, (void *)program,
- kill_after_timeout, &dummy, NULL)) {
- perror ("spawn_child");
+ if (!ap_spawn_child(p, piped_log_child, (void *)program,
+ kill_after_timeout, &dummy, NULL, NULL)) {
+ perror ("ap_spawn_child");
fprintf (stderr, "Couldn't fork child for piped log process\n");
exit (1);
}
1.80 +3 -4 apache-1.3/src/modules/standard/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- mod_cgi.c 1998/05/20 12:18:05 1.79
+++ mod_cgi.c 1998/05/28 22:09:56 1.80
@@ -428,10 +428,9 @@
* waiting for free_proc_chain to cleanup in the middle of an
* SSI request -djg
*/
- if (!ap_spawn_child_err_buff(r->main ? r->main->pool : r->pool, cgi_child,
- (void *) &cld,
- kill_after_timeout,
- &script_out, &script_in, &script_err)) {
+ if (!ap_bspawn_child(r->main ? r->main->pool : r->pool, cgi_child,
+ (void *) &cld, kill_after_timeout,
+ &script_out, &script_in, &script_err)) {
ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
"couldn't spawn child process: %s", r->filename);
return SERVER_ERROR;
1.93 +2 -2 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.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- mod_include.c 1998/05/26 00:54:07 1.92
+++ mod_include.c 1998/05/28 22:09:56 1.93
@@ -821,8 +821,8 @@
arg.r = r;
arg.s = s;
- if (!ap_spawn_child_err_buff(r->pool, include_cmd_child, &arg,
- kill_after_timeout, NULL, &script_in, NULL)) {
+ if (!ap_bspawn_child(r->pool, include_cmd_child, &arg,
+ kill_after_timeout, NULL, &script_in, NULL)) {
ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
"couldn't spawn include command");
return -1;
1.33 +2 -2 apache-1.3/src/modules/standard/mod_mime_magic.c
Index: mod_mime_magic.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- mod_mime_magic.c 1998/05/19 22:49:03 1.32
+++ mod_mime_magic.c 1998/05/28 22:09:57 1.33
@@ -2183,8 +2183,8 @@
*/
sub_pool = ap_make_sub_pool(r->pool);
- if (!ap_spawn_child_err_buff(sub_pool, uncompress_child, &parm, kill_always,
- &bin, &bout, NULL)) {
+ if (!ap_bspawn_child(sub_pool, uncompress_child, &parm, kill_always,
+ &bin, &bout, NULL)) {
ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
MODNAME ": couldn't spawn uncompress process: %s", r->uri);
return -1;
1.110 +3 -3 apache-1.3/src/modules/standard/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- mod_rewrite.c 1998/05/28 11:39:25 1.109
+++ mod_rewrite.c 1998/05/28 22:09:58 1.110
@@ -3155,9 +3155,9 @@
continue;
fpin = NULL;
fpout = NULL;
- rc = ap_spawn_child_err(p, rewritemap_program_child,
- (void *)map->datafile, kill_after_timeout,
- &fpin, &fpout, &fperr);
+ rc = ap_spawn_child(p, rewritemap_program_child,
+ (void *)map->datafile, kill_after_timeout,
+ &fpin, &fpout, &fperr);
if (rc == 0 || fpin == NULL || fpout == NULL) {
perror("ap_spawn_child");
fprintf(stderr, "mod_rewrite: "