brian 96/08/08 00:21:18
Modified: src alloc.c alloc.h mod_cgi.c Log: Reviewed by: Brian Behlendorf Submitted by: Garey Smiley Removal of more special-cased EMX (OS/2) code, since those sections now work fine with OS/2. Revision Changes Path 1.10 +0 -95 apache/src/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C3 -r1.9 -r1.10 *** alloc.c 1996/08/06 19:31:04 1.9 --- alloc.c 1996/08/08 07:21:14 1.10 *************** *** 1032,1129 **** } } - #ifdef __EMX__ - int spawn_child_os2 (pool *p, void (*func)(void *), void *data, - enum kill_conditions kill_how, - FILE **pipe_in, FILE **pipe_out, char *buffer, int lenp) - { - int pid; - int in_fds[2]; - int out_fds[2]; - - block_alarms(); - - if (pipe_in && pipe (in_fds) < 0) - { - unblock_alarms(); - return 0; - } - - if (pipe_out && pipe (out_fds) < 0) { - if (pipe_in) { - close (in_fds[0]); close (in_fds[1]); - } - unblock_alarms(); - return 0; - } - - if ((pid = fork()) < 0) { - if (pipe_in) { - close (in_fds[0]); close (in_fds[1]); - } - if (pipe_out) { - close (out_fds[0]); close (out_fds[1]); - } - unblock_alarms(); - return 0; - } - - if (!pid) { - int stdinpipe[2]; - /* Due to a limitation of EMX, inheriting socket handles is not - allowed so we need to read the input and place it in a pipe and - then pass that handle instead of the socket. */ - - if (lenp > 0) { - pipe(stdinpipe); - write(stdinpipe[1], buffer, lenp); - close(stdinpipe[1]); - in_fds[0] = dup(stdinpipe[0]); - close(stdinpipe[0]); - } - - /* Child process */ - - if (pipe_out) { - close (out_fds[0]); - dup2 (out_fds[1], STDOUT_FILENO); - close (out_fds[1]); - } - - if (pipe_in) { - close (in_fds[1]); - dup2 (in_fds[0], STDIN_FILENO); - close (in_fds[0]); - } - - /* HP-UX SIGCHLD fix goes here, if someone will remind me what it is... */ - signal (SIGCHLD, SIG_DFL); /* Was that it? */ - - func (data); - exit (0); /* Should never get here... */ - } - - /* Parent process */ - - note_subprocess (p, pid, kill_how); - - if (pipe_out) { - close (out_fds[1]); - /* Need binary mode set for OS/2. */ - *pipe_out = fdopen (out_fds[0], "rb"); - - if (*pipe_out) note_cleanups_for_file (p, *pipe_out); - } - - if (pipe_in) { - close (in_fds[0]); - /* Need binary mode set for OS/2. */ - *pipe_in = fdopen (in_fds[1], "wb"); - - if (*pipe_in) note_cleanups_for_file (p, *pipe_in); - } - - unblock_alarms(); - return pid; - } - #endif --- 1032,1034 ---- 1.9 +0 -5 apache/src/alloc.h Index: alloc.h =================================================================== RCS file: /export/home/cvs/apache/src/alloc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C3 -r1.8 -r1.9 *** alloc.h 1996/08/06 19:31:05 1.8 --- alloc.h 1996/08/08 07:21:15 1.9 *************** *** 233,243 **** FILE **pipe_err); #define spawn_child(p,f,v,k,in,out) spawn_child_err(p,f,v,k,in,out,NULL) - #ifdef __EMX__ - int spawn_child_os2 (pool *, void (*)(void *), void *, - enum kill_conditions, FILE **pipe_in, FILE **pipe_out, char *buffer, int lenp); - #endif - /* magic numbers --- only one so far, min free bytes in a new pool block */ #define BLOCK_MINFREE 8192 --- 233,238 ---- 1.14 +6 -26 apache/src/mod_cgi.c Index: mod_cgi.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_cgi.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C3 -r1.13 -r1.14 *** mod_cgi.c 1996/08/06 19:31:06 1.13 --- mod_cgi.c 1996/08/08 07:21:15 1.14 *************** *** 388,422 **** cld.argv0 = argv0; cld.r = r; cld.nph = nph; cld.debug = conf->logname ? 1 : 0; #ifdef __EMX__ ! if (should_client_block (r)) { ! ! read_client_block (r, argsbuffer, HUGE_STRING_LEN); ! ! if (!spawn_child_os2 (r->connection->pool, cgi_child, (void *)&cld, ! nph ? just_wait : kill_after_timeout, ! &script_out, &script_in, argsbuffer, atoi(lenp))) { ! log_reason ("couldn't spawn child process", r->filename, r); ! return SERVER_ERROR; ! } ! } else { ! if (!spawn_child (r->connection->pool, cgi_child, (void *)&cld, ! nph ? just_wait : kill_after_timeout, ! &script_out, &script_in)) { ! log_reason ("couldn't spawn child process", r->filename, r); ! return SERVER_ERROR; ! } ! } ! #else ! if (!spawn_child_err (r->connection->pool, cgi_child, (void *)&cld, ! nph ? just_wait : kill_after_timeout, ! &script_out, nph ? NULL : &script_in, ! &script_err)) { log_reason ("couldn't spawn child process", r->filename, r); return SERVER_ERROR; } - #endif /* Transfer any put/post args, CERN style... * Note that if a buggy script fails to read everything we throw --- 388,404 ---- cld.argv0 = argv0; cld.r = r; cld.nph = nph; cld.debug = conf->logname ? 1 : 0; + if (!spawn_child (r->connection->pool, cgi_child, (void *)&cld, + nph ? just_wait : kill_after_timeout, #ifdef __EMX__ ! &script_out, &script_in, &script_err)) { #else ! &script_out, nph ? NULL : &script_in, ! &script_err)) { ! #endif log_reason ("couldn't spawn child process", r->filename, r); return SERVER_ERROR; } /* Transfer any put/post args, CERN style... * Note that if a buggy script fails to read everything we throw *************** *** 427,433 **** * spurious newline). */ - #ifndef __EMX__ if (should_client_block(r)) { void (*handler)(); int dbsize, len_read; --- 409,414 ---- *************** *** 458,464 **** kill_timeout (r); } - #endif pfclose (r->connection->pool, script_out); --- 439,444 ----