stoddard 99/10/21 13:46:38
Modified: src/ap ap_checkpass.c ap_getpass.c ap_snprintf.c src/include ap_config.h http_conf_globals.h httpd.h multithread.h scoreboard.h src/main alloc.c buff.c http_core.c http_log.c http_main.c http_request.c util.c util_script.c src/modules/proxy mod_proxy.c proxy_cache.c proxy_util.c src/modules/standard mod_auth_anon.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_expires.c mod_headers.c mod_include.c mod_info.c mod_rewrite.c mod_rewrite.h mod_speling.c mod_status.c mod_userdir.c mod_usertrack.c src/support htdigest.c htpasswd.c Log: Apache port to Netware 5 Submitted by: Mike Gardiner Reviewed by: Bill Stoddard Revision Changes Path 1.6 +1 -1 apache-1.3/src/ap/ap_checkpass.c Index: ap_checkpass.c =================================================================== RCS file: /home/cvs/apache-1.3/src/ap/ap_checkpass.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ap_checkpass.c 1999/09/01 04:29:00 1.5 +++ ap_checkpass.c 1999/10/21 20:44:07 1.6 @@ -97,7 +97,7 @@ /* * It's not our algorithm, so feed it to crypt() if possible. */ -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) /* * On Windows, the only alternative to our MD5 algorithm is plain * text. 1.2 +3 -1 apache-1.3/src/ap/ap_getpass.c Index: ap_getpass.c =================================================================== RCS file: /home/cvs/apache-1.3/src/ap/ap_getpass.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ap_getpass.c 1999/05/31 17:09:30 1.1 +++ ap_getpass.c 1999/10/21 20:44:09 1.2 @@ -62,7 +62,9 @@ */ #include "ap_config.h" +#ifndef NETWARE #include <sys/types.h> +#endif #include <errno.h> #include "ap.h" @@ -104,7 +106,7 @@ #endif -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) /* * Windows lacks getpass(). So we'll re-implement it here. */ 1.37 +3 -1 apache-1.3/src/ap/ap_snprintf.c Index: ap_snprintf.c =================================================================== RCS file: /home/cvs/apache-1.3/src/ap/ap_snprintf.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- ap_snprintf.c 1999/09/02 16:27:26 1.36 +++ ap_snprintf.c 1999/10/21 20:44:10 1.37 @@ -62,7 +62,9 @@ #include <stdio.h> #include <ctype.h> +#ifndef NETWARE #include <sys/types.h> +#endif #include <stdarg.h> #include <string.h> #include <stdlib.h> @@ -130,7 +132,7 @@ register int r2; double fi, fj; register char *p, *p1; - + if (ndigits >= NDIG - 1) ndigits = NDIG - 2; r2 = 0; 1.271 +41 -5 apache-1.3/src/include/ap_config.h Index: ap_config.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.270 retrieving revision 1.271 diff -u -r1.270 -r1.271 --- ap_config.h 1999/09/13 13:32:40 1.270 +++ ap_config.h 1999/10/21 20:44:15 1.271 @@ -72,7 +72,7 @@ /* * Support for platform dependent autogenerated defines */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) #include "ap_config_auto.h" #else /* not available under WIN32, so provide important entries manually */ @@ -81,9 +81,12 @@ /* Have to include sys/stat.h before ../os/win32/os.h so we can override stat() properly */ +#ifndef NETWARE #include <sys/types.h> +#endif #include <sys/stat.h> + /* So that we can use inline on some critical functions, and use * GNUC attributes (such as to get -Wall warnings for printf-like * functions). Only do this in gcc 2.7 or later ... it may work @@ -113,7 +116,7 @@ #include "os.h" #endif -#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF) +#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(NETWARE) #include <sys/param.h> #endif @@ -950,6 +953,9 @@ #define NEED_INITGROUPS #define NO_SLACK +#elif defined(NETWARE) +#define USE_HSREGEX +/* Most all NetWare stuff is in os/NetWare/os.h */ #else /* Unknown system - Edit these to match */ #ifdef BSD @@ -1017,7 +1023,9 @@ * file. If you have neither, I'm confused. */ +#ifndef NETWARE #include <sys/types.h> +#endif #include <stdarg.h> #if !defined(NEXT) && !defined(WIN32) @@ -1037,10 +1045,10 @@ #include <strings.h> #endif #include "ap_ctype.h" -#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) +#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE) #include <sys/file.h> #endif -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) #include <sys/socket.h> #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> @@ -1065,17 +1073,45 @@ #endif #endif /* ndef WIN32 */ +/* This block is added for NETWARE... Should be moved to os.h? */ +#ifdef NETWARE +#include <ws2nlm.h> +#include <winsock2.h> +#include <malloc.h> +#include <io.h> +#include <fcntl.h> +#endif + #include <limits.h> #include <time.h> /* for ctime */ #ifdef WIN32 #define strftime(s,max,format,tm) os_strftime(s,max,format,tm) #endif #include <signal.h> +#ifdef NETWARE +#undef SIGKILL +#undef SA_NOCLDSTOP +#undef SIGALRM +#undef SIGCHILD +#undef SIGCONT +#undef SIGHUP +#undef SIGPIPE +#undef SIGQUIT +#undef SIGSTOP +#undef SIGTSTP +#undef SIGTTIN +#undef SIGTTOU +#undef SIGUSR1 +#undef SIGUSR2 +#undef SIG_BLOCK +#undef SIG_SETMASK +#undef SIG_UNBLOCK +#endif #if defined(TPF) && defined(NSIG) #undef NSIG #endif #include <errno.h> -#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) +#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) #include <memory.h> #endif 1.40 +3 -0 apache-1.3/src/include/http_conf_globals.h Index: http_conf_globals.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/http_conf_globals.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- http_conf_globals.h 1999/06/29 15:13:11 1.39 +++ http_conf_globals.h 1999/10/21 20:44:16 1.40 @@ -72,6 +72,9 @@ extern uid_t ap_user_id; extern char *ap_user_name; extern gid_t ap_group_id; +#ifdef NETWARE +extern unsigned int ap_thread_stack_size; +#endif #ifdef MULTIPLE_GROUPS extern gid_t group_id_list[NGROUPS_MAX]; #endif 1.296 +3 -1 apache-1.3/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.295 retrieving revision 1.296 diff -u -r1.295 -r1.296 --- httpd.h 1999/08/16 18:55:31 1.295 +++ httpd.h 1999/10/21 20:44:18 1.296 @@ -87,6 +87,8 @@ #define HTTPD_ROOT "/apache" #elif defined(BEOS) #define HTTPD_ROOT "/boot/home/apache" +#elif defined(NETWARE) +#define HTTPD_ROOT "sys:/apache" #else #define HTTPD_ROOT "/usr/local/apache" #endif @@ -928,7 +930,7 @@ listen_rec *next; struct sockaddr_in local_addr; /* local IP address and port */ int fd; - int used; /* Only used during restart */ + int used; /* Only used during restart */ /* more stuff here, like which protocol is bound to the port */ }; 1.12 +4 -0 apache-1.3/src/include/multithread.h Index: multithread.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/multithread.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- multithread.h 1998/05/03 17:31:10 1.11 +++ multithread.h 1999/10/21 20:44:20 1.12 @@ -19,7 +19,11 @@ * I believe this is terribly ugly */ #ifdef MULTITHREAD +#ifdef NETWARE +#define APACHE_TLS +#else #define APACHE_TLS __declspec( thread ) +#endif thread *create_thread(void (thread_fn) (void *thread_arg), void *thread_arg); int kill_thread(thread *thread_id); 1.48 +2 -1 apache-1.3/src/include/scoreboard.h Index: scoreboard.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/scoreboard.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- scoreboard.h 1999/04/27 20:36:29 1.47 +++ scoreboard.h 1999/10/21 20:44:23 1.48 @@ -63,12 +63,13 @@ #endif #ifndef WIN32 -#ifdef TPF +#if defined(TPF) || defined(NETWARE) #include <time.h> #else #include <sys/times.h> #endif /* TPF */ #endif + /* Scoreboard info on a process is, for now, kept very brief --- * just status value and pid (the latter so that the caretaker process 1.117 +7 -2 apache-1.3/src/main/alloc.c Index: alloc.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/alloc.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -r1.116 -r1.117 --- alloc.c 1999/10/08 14:23:40 1.116 +++ alloc.c 1999/10/21 20:44:28 1.117 @@ -1992,7 +1992,7 @@ ap_block_alarms(); res = closesocket(sock); -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) errno = WSAGetLastError(); #endif /* WIN32 */ save_errno = errno; @@ -2072,7 +2072,7 @@ #endif /* WIN32 */ /* for ap_fdopen, to get binary mode */ -#if defined (OS2) || defined (WIN32) +#if defined (OS2) || defined (WIN32) || defined (NETWARE) #define BINMODE "b" #else #define BINMODE @@ -2197,6 +2197,10 @@ */ } +#elif defined(NETWARE) + /* NetWare currently has no pipes yet. This will + be solved with the new libc for NetWare soon. */ + pid = 0; #elif defined(OS2) { int save_in=-1, save_out=-1, save_err=-1; @@ -2658,6 +2662,7 @@ for (p = procs; p; p = p->next) { CloseHandle((HANDLE) p->pid); } +#elif defined(NETWARE) #else #ifndef NEED_WAITPID /* Pick up all defunct processes */ 1.89 +29 -14 apache-1.3/src/main/buff.c Index: buff.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/buff.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -r1.88 -r1.89 --- buff.c 1999/07/29 18:13:40 1.88 +++ buff.c 1999/10/21 20:44:32 1.89 @@ -119,7 +119,7 @@ * futher I/O will be done */ -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) /* select() sometimes returns 1 even though the write will block. We must work around this. @@ -137,12 +137,13 @@ if (!(tv.tv_sec = ap_check_alarm())) return (send(sock, buf, len, flags)); - rv = ioctlsocket(sock, FIONBIO, &iostate); + rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate); iostate = 0; if (rv) { err = WSAGetLastError(); ap_assert(0); } + rv = send(sock, buf, len, flags); if (rv == SOCKET_ERROR) { err = WSAGetLastError(); @@ -157,27 +158,36 @@ if (rv == SOCKET_ERROR) err = WSAGetLastError(); else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); + ioctlsocket(sock, FIONBIO, (u_long*)&iostate); if(ap_check_alarm() < 0) { WSASetLastError(EINTR); /* Simulate an alarm() */ return (SOCKET_ERROR); } - } + } else { rv = send(sock, buf, len, flags); if (rv == SOCKET_ERROR) { err = WSAGetLastError(); if(err == WSAEWOULDBLOCK) { - ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL, - "select claimed we could write, but in fact we couldn't. This is a bug in Windows."); + retry=1; +#ifdef NETWARE + ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL, + "select claimed we could write, but in fact we couldn't."); + ThreadSwitchWithDelay(); +#else + ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL, + "select claimed we could write, but in fact we couldn't. This is a bug in Windows."); Sleep(100); +#endif } } } } while(retry); } - ioctlsocket(sock, FIONBIO, &iostate); + + ioctlsocket(sock, FIONBIO, (u_long*)&iostate); + if (rv == SOCKET_ERROR) WSASetLastError(err); return (rv); @@ -195,9 +205,10 @@ if (!(tv.tv_sec = ap_check_alarm())) return (recv(sock, buf, len, flags)); - rv = ioctlsocket(sock, FIONBIO, &iostate); + rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate); iostate = 0; ap_assert(!rv); + rv = recv(sock, buf, len, flags); if (rv == SOCKET_ERROR) { err = WSAGetLastError(); @@ -209,7 +220,7 @@ if (rv == SOCKET_ERROR) err = WSAGetLastError(); else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); + ioctlsocket(sock, FIONBIO, (u_long*)&iostate); ap_check_alarm(); WSASetLastError(WSAEWOULDBLOCK); return (SOCKET_ERROR); @@ -221,7 +232,9 @@ } } } - ioctlsocket(sock, FIONBIO, &iostate); + + ioctlsocket(sock, FIONBIO, (u_long*)&iostate); + if (rv == SOCKET_ERROR) WSASetLastError(err); return (rv); @@ -251,7 +264,7 @@ { int rv; -#if defined (WIN32) +#if defined (WIN32) || defined(NETWARE) if (fb->flags & B_SOCKET) { rv = recvwithtimeout(fb->fd_in, buf, nbyte, 0); if (rv == SOCKET_ERROR) @@ -312,7 +325,7 @@ { int rv; -#if defined(WIN32) +#if defined(WIN32) || defined(NETWARE) if (fb->flags & B_SOCKET) { rv = sendwithtimeout(fb->fd, buf, nbyte, 0); if (rv == SOCKET_ERROR) @@ -1432,7 +1445,7 @@ rc1 = ap_bflush(fb); else rc1 = 0; -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) if (fb->flags & B_SOCKET) { rc2 = ap_pclosesocket(fb->pool, fb->fd); if (fb->fd_in != fb->fd) { @@ -1442,10 +1455,12 @@ rc3 = 0; } } +#ifndef NETWARE else if (fb->hFH != INVALID_HANDLE_VALUE) { rc2 = ap_pcloseh(fb->pool, fb->hFH); rc3 = 0; } +#endif else { #elif defined(BEOS) if (fb->flags & B_SOCKET) { @@ -1465,7 +1480,7 @@ else { rc3 = 0; } -#if defined(WIN32) || defined (BEOS) +#if defined(WIN32) || defined (BEOS) || defined(NETWARE) } #endif 1.274 +21 -2 apache-1.3/src/main/http_core.c Index: http_core.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v retrieving revision 1.273 retrieving revision 1.274 diff -u -r1.273 -r1.274 --- http_core.c 1999/10/21 18:23:39 1.273 +++ http_core.c 1999/10/21 20:44:35 1.274 @@ -2171,6 +2171,8 @@ { #ifdef WIN32 fprintf(stderr, "WARNING: StartServers has no effect on Win32\n"); +#elif defined(NETWARE) + fprintf(stderr, "WARNING: StartServers has no effect on NetWare\n"); #else const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -2390,12 +2392,25 @@ return NULL; } +#ifdef NETWARE +static const char *set_threadstacksize(cmd_parms *cmd, void *dummy, char *stacksize) +{ + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + if (err != NULL) { + return err; + } + + ap_thread_stack_size = atoi(stacksize); + return NULL; +} +#endif + static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) { listen_rec *new; char *ports; unsigned short port; - + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; @@ -2881,6 +2896,10 @@ OR_ALL, TAKE12, "soft/hard limits for max number of processes per uid" }, { "BindAddress", set_bind_address, NULL, RSRC_CONF, TAKE1, "'*', a numeric IP address, or the name of a host with a unique IP address"}, +#ifdef NETWARE +{ "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, + "Stack size each created thread will use."}, +#endif { "Listen", set_listener, NULL, RSRC_CONF, TAKE1, "A port number or a numeric IP address and a port number"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, @@ -3054,7 +3073,7 @@ return METHOD_NOT_ALLOWED; } -#if defined(OS2) || defined(WIN32) +#if defined(OS2) || defined(WIN32) || defined(NETWARE) /* Need binary mode for OS/2 */ f = ap_pfopen(r->pool, r->filename, "rb"); #else 1.81 +8 -2 apache-1.3/src/main/http_log.c Index: http_log.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_log.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- http_log.c 1999/09/01 04:29:04 1.80 +++ http_log.c 1999/10/21 20:44:38 1.81 @@ -168,7 +168,10 @@ /* No concept of a child process on Win32 */ signal(SIGHUP, SIG_IGN); #endif /* ndef SIGHUP */ -#if defined(WIN32) +#if defined(NETWARE) + child_pid = spawnlp(P_NOWAIT, SHELL_PATH, (char *)cmd); + return(child_pid); +#elif defined(WIN32) child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); return(child_pid); #elif defined(OS2) @@ -726,7 +729,10 @@ #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif -#if defined(WIN32) +#if defined(NETWARE) + child_pid = spawnlp(P_NOWAIT, SHELL_PATH, (char *)cmd); + return(child_pid); +#elif defined(WIN32) child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); return(child_pid); #elif defined(OS2) 1.479 +477 -61 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.478 retrieving revision 1.479 diff -u -r1.478 -r1.479 --- http_main.c 1999/10/11 23:08:19 1.478 +++ http_main.c 1999/10/21 20:44:41 1.479 @@ -116,10 +116,9 @@ #endif #ifdef WIN32 #include "../os/win32/getopt.h" -#elif !defined(BEOS) && !defined(TPF) +#elif !defined(BEOS) && !defined(TPF) && !defined(NETWARE) #include <netinet/tcp.h> #endif - #ifdef HAVE_BSTRING_H #include <bstring.h> /* for IRIX, FD_SET calls bzero() */ #endif @@ -228,7 +227,12 @@ * Actual definitions of config globals... here because this is * for the most part the only code that acts on 'em. (Hmmm... mod_main.c?) */ - + +#ifdef NETWARE +int ap_thread_count = 0; +BOOL ap_main_finished = FALSE; +unsigned int ap_thread_stack_size = 65536; +#endif int ap_standalone=0; int ap_configtestonly=0; int ap_docrootcheck=1; @@ -294,11 +298,15 @@ /* *Non*-shared http_main globals... */ static server_rec *server_conf; +#ifndef NETWARE static JMP_BUF APACHE_TLS jmpbuffer; +#endif static int sd; static fd_set listenfds; static int listenmaxfd; +#ifndef NETWARE static pid_t pgrp; +#endif /* one_process --- debugging mode variable; can be set from the command line * with the -X flag. If set, this gets you the child_main loop running @@ -316,7 +324,9 @@ /* set if timeouts are to be handled by the children and not by the parent. * i.e. child_timeouts = !standalone || one_process. */ +#ifndef NETWARE static int child_timeouts; +#endif #ifdef DEBUG_SIGSTOP int raise_sigstop_flags; @@ -342,7 +352,9 @@ static pool *pchild; /* Pool for httpd child stuff */ static pool *pcommands; /* Pool for -C and -c switches */ +#ifndef NETWARE static int APACHE_TLS my_pid; /* it seems silly to call getpid all the time */ +#endif #ifndef MULTITHREAD static int my_child_num; #endif @@ -426,7 +438,9 @@ } } +#ifndef NETWARE static APACHE_TLS int volatile exit_after_unblock = 0; +#endif #ifdef GPROF /* @@ -1010,7 +1024,7 @@ #endif /* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's + * ' case. But it's never safe to do it in the case where there's * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT * when it's safe in the single Listen case. */ @@ -1063,9 +1077,42 @@ fprintf(stderr, " -i : install an Apache service\n"); fprintf(stderr, " -u : uninstall an Apache service\n"); #endif + +#ifdef NETWARE + clean_parent_exit(0); +#else exit(1); +#endif } + + +#ifdef NETWARE +/* Thread Storage Data */ +typedef struct _TSD { + conn_rec* current_conn; + int alarms_blocked; + int alarm_pending; + request_rec* timeout_req; + char* timeout_name; + JMP_BUF jmpbuffer; + int exit_after_unblock; + void (*alarm_fn) (int); + unsigned int alarm_expiry_time; +} TSD; + +#define get_tsd TSD* tsd = (TSD*) GetThreadDataAreaPtr(); +#define current_conn tsd->current_conn +#define alarms_blocked tsd->alarms_blocked +#define alarm_pending tsd->alarm_pending +#define timeout_req tsd->timeout_req +#define timeout_name tsd->timeout_name +#define jmpbuffer tsd->jmpbuffer +#define exit_after_unblock tsd->exit_after_unblock +#define alarm_fn tsd->alarm_fn +#define alarm_expiry_time tsd->alarm_expiry_time + +#else /***************************************************************** * * Timeout handling. DISTINCTLY not thread-safe, but all this stuff @@ -1078,11 +1125,15 @@ static APACHE_TLS const char *volatile timeout_name = NULL; static APACHE_TLS int volatile alarms_blocked = 0; static APACHE_TLS int volatile alarm_pending = 0; +#endif + static void timeout(int sig) { void *dirconf; - +#ifdef NETWARE + get_tsd +#endif if (alarms_blocked) { alarm_pending = 1; return; @@ -1110,7 +1161,6 @@ /* Someone has asked for this transaction to just be aborted * if it times out... */ - request_rec *log_req = timeout_req; request_rec *save_req = timeout_req; @@ -1120,6 +1170,9 @@ timeout_req = NULL; while (log_req->main || log_req->prev) { +#ifdef NETWARE + ThreadSwitch(); +#endif /* Get back to original request... */ if (log_req->main) log_req = log_req->main; @@ -1130,18 +1183,17 @@ if (!current_conn->keptalive) { /* in some cases we come here before setting the time */ if (log_req->request_time == 0) { - log_req->request_time = time(0); + log_req->request_time = time(0); } ap_log_transaction(log_req); } ap_bsetflag(save_req->connection->client, B_EOUT, 1); ap_bclose(save_req->connection->client); - + if (!ap_standalone) exit(0); - - ap_longjmp(jmpbuffer, 1); + ap_longjmp(jmpbuffer, 1); } else { /* abort the connection */ ap_bsetflag(current_conn->client, B_EOUT, 1); @@ -1150,6 +1202,7 @@ } } + #ifndef TPF /* * These two called from alloc.c to protect its critical sections... @@ -1159,11 +1212,17 @@ API_EXPORT(void) ap_block_alarms(void) { +#ifdef NETWARE + get_tsd +#endif ++alarms_blocked; } API_EXPORT(void) ap_unblock_alarms(void) { +#ifdef NETWARE + get_tsd +#endif --alarms_blocked; if (alarms_blocked == 0) { if (exit_after_unblock) { @@ -1186,12 +1245,14 @@ } #endif /* TPF */ +#ifndef NETWARE static APACHE_TLS void (*volatile alarm_fn) (int) = NULL; +#endif #ifdef WIN32 static APACHE_TLS unsigned int alarm_expiry_time = 0; #endif /* WIN32 */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) static void alrm_handler(int sig) { if (alarm_fn) { @@ -1204,8 +1265,12 @@ { unsigned int old; -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) +#ifdef NETWARE + get_tsd +#endif old = alarm_expiry_time; + if (old) old -= time(0); if (x == 0) { @@ -1243,9 +1308,12 @@ } -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) API_EXPORT(int) ap_check_alarm(void) { +#ifdef NETWARE + get_tsd +#endif if (alarm_expiry_time) { unsigned int t; @@ -1273,7 +1341,9 @@ API_EXPORT(void) ap_reset_timeout(request_rec *r) { int i; - +#ifdef NETWARE + get_tsd +#endif if (timeout_name) { /* timeout has been set */ i = ap_set_callback_and_alarm(alarm_fn, r->server->timeout); if (i == 0) /* timeout already expired, so set it back to 0 */ @@ -1287,37 +1357,42 @@ void ap_keepalive_timeout(char *name, request_rec *r) { unsigned int to; - +#ifdef NETWARE + get_tsd +#endif timeout_req = r; timeout_name = name; - if (r->connection->keptalive) to = r->server->keep_alive_timeout; else to = r->server->timeout; ap_set_callback_and_alarm(timeout, to); - } API_EXPORT(void) ap_hard_timeout(char *name, request_rec *r) { +#ifdef NETWARE + get_tsd +#endif timeout_req = r; timeout_name = name; - ap_set_callback_and_alarm(timeout, r->server->timeout); - } API_EXPORT(void) ap_soft_timeout(char *name, request_rec *r) { +#ifdef NETWARE + get_tsd +#endif timeout_name = name; - ap_set_callback_and_alarm(timeout, r->server->timeout); - } API_EXPORT(void) ap_kill_timeout(request_rec *dummy) { +#ifdef NETWARE + get_tsd +#endif ap_check_signals(); ap_set_callback_and_alarm(NULL, 0); timeout_req = NULL; @@ -1377,6 +1452,9 @@ static void lingerout(int sig) { +#ifdef NETWARE + get_tsd +#endif if (alarms_blocked) { alarm_pending = 1; return; @@ -1391,8 +1469,10 @@ static void linger_timeout(void) { +#ifdef NETWARE + get_tsd +#endif timeout_name = "lingering close"; - ap_set_callback_and_alarm(lingerout, MAX_SECS_TO_LINGER); } @@ -1453,6 +1533,10 @@ * These parameters are reset on each pass, since they might be * changed by select. */ +#ifdef NETWARE + ThreadSwitch(); +#endif + FD_SET(lsd, &lfds); tv.tv_sec = 2; tv.tv_usec = 0; @@ -1878,7 +1962,7 @@ } #endif ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "could not call shmget"); + "could not call shmget"); exit(APEXIT_INIT); } @@ -2110,6 +2194,10 @@ static void clean_parent_exit(int code) __attribute__((noreturn)); static void clean_parent_exit(int code) { +#ifdef NETWARE + AMCSocketCleanup(); + ap_main_finished = TRUE; +#endif /* Clear the pool - including any registered cleanups */ ap_destroy_pool(pglobal); exit(code); @@ -2129,6 +2217,10 @@ ss = &ap_scoreboard_image->servers[child_num]; old_status = ss->status; ss->status = status; +#ifdef NETWARE + ap_scoreboard_image->parent[child_num].pid = GetThreadID(); +#endif + #ifdef OPTIMIZE_TIMEOUTS ++ss->cur_vtime; #endif @@ -2448,7 +2540,31 @@ } } return (-1); +#elif defined(NETWARE) + struct timeval tv; + int ret = 0; + ++wait_or_timeout_counter; + if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { + wait_or_timeout_counter = 0; +#ifndef NO_OTHER_CHILD + probe_writable_fds(); +#endif + } + + if (ret == -1 && errno == EINTR) { + return -1; + } + + if (ret > 0) { + return ret; + } + + tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; + tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; + ap_select(0, NULL, NULL, NULL, &tv); + return -1; + #else /* WIN32 */ struct timeval tv; int ret; @@ -2617,7 +2733,7 @@ { chdir(ap_coredump_dir); signal(sig, SIG_DFL); -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) kill(getpid(), sig); #else raise(sig); @@ -2639,6 +2755,9 @@ { /* SIGHUP to child process??? */ /* if alarms are blocked we have to wait to die otherwise we might * end up with corruption in alloc.c's internal structures */ +#ifdef NETWARE + get_tsd +#endif if (alarms_blocked) { exit_after_unblock = 1; } @@ -2789,7 +2908,7 @@ static void restart(int sig) { -#ifndef WIN32 +#if !defined (WIN32) && !defined(NETWARE) ap_start_restart(sig == SIGUSR1); #else ap_start_restart(1); @@ -2884,8 +3003,9 @@ signal(SIGXFSZ, SIG_DFL); #endif /* SIGXFSZ */ } - +#ifndef NETWARE signal(SIGTERM, sig_term); +#endif #ifdef SIGHUP signal(SIGHUP, restart); #endif /* SIGHUP */ @@ -2906,7 +3026,7 @@ static void detach(void) { -#if !defined(WIN32) +#if !defined(WIN32) && !defined(NETWARE) int x; chdir("/"); @@ -2978,7 +3098,7 @@ static void set_group_privs(void) { -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) if (!geteuid()) { char *name; @@ -3101,6 +3221,9 @@ if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no, sizeof(int)) < 0) { +#ifdef NETWARE + errno = WSAGetLastError(); +#endif ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "setsockopt: (TCP_NODELAY)"); } @@ -3110,7 +3233,6 @@ #define sock_disable_nagle(s) /* NOOP */ #endif - static int make_sock(pool *p, const struct sockaddr_in *server) { int s; @@ -3126,10 +3248,11 @@ /* note that because we're about to slack we don't use psocket */ ap_block_alarms(); if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: failed to get a socket for %s", addr); - ap_unblock_alarms(); - exit(1); + + ap_unblock_alarms(); + exit(1); } /* Solaris (probably versions 2.4, 2.5, and 2.5.1 with various levels @@ -3319,10 +3442,15 @@ lr = ap_listeners; do { listen_rec *nr = malloc(sizeof *nr); - if (nr == NULL) { - fprintf(stderr, "Ouch! malloc failed in copy_listeners()\n"); - exit(1); - } + +#ifdef NETWARE + ThreadSwitch(); +#endif + + if (nr == NULL) { + fprintf(stderr, "Ouch! malloc failed in copy_listeners()\n"); + exit(1); + } *nr = *lr; ap_kill_cleanups_for_socket(p, nr->fd); nr->next = old_listeners; @@ -3373,7 +3501,7 @@ for (;;) { fd = find_listener(lr); if (fd < 0) { - fd = make_sock(p, &lr->local_addr); + fd = make_sock(p, &lr->local_addr); } else { ap_note_cleanups_for_socket(p, fd); @@ -3417,6 +3545,9 @@ lr = head_listener; do { +#ifdef NETWARE + ThreadSwitch(); +#endif if (FD_ISSET(lr->fd, main_fds)) { head_listener = lr->next; return (lr); @@ -3427,7 +3558,7 @@ } -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) static int s_iInitCount = 0; static int AMCSocketInitialize(void) @@ -3444,18 +3575,24 @@ return (s_iInitCount); /* s_iInitCount == 0. Do the initailization */ +#ifdef NETWARE + iVersionRequested = MAKEWORD(2, 0); +#else iVersionRequested = MAKEWORD(1, 1); +#endif err = WSAStartup((WORD) iVersionRequested, &wsaData); if (err) { s_iInitCount = -1; return (s_iInitCount); } +#ifdef WIN32 if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1) { s_iInitCount = -2; WSACleanup(); return (s_iInitCount); } +#endif s_iInitCount++; return (s_iInitCount); @@ -3614,7 +3751,7 @@ (void) set42sig(); #endif -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) /* Initialize the stupid sockets */ AMCSocketInitialize(); #endif /* WIN32 */ @@ -5072,8 +5209,9 @@ void add_job(int sock) { joblist *new_job; - + ap_assert(allowed_globals.jobmutex); + /* TODO: If too many jobs in queue, sleep, check for problems */ ap_acquire_mutex(allowed_globals.jobmutex); new_job = (joblist *) malloc(sizeof(joblist)); @@ -5167,6 +5305,20 @@ int dupped_csd = -1; int srv = 0; +#ifdef NETWARE + TSD* tsd = NULL; + + while(tsd == NULL) { + tsd = (TSD*) GetThreadDataAreaPtr(); + ThreadSwitchWithDelay(); + } + + SetCurrentNameSpace(4); + SetTargetNameSpace(4); + + ap_thread_count++; +#endif + ptrans = ap_make_sub_pool(pconf); (void) ap_update_child_status(child_num, SERVER_READY, (request_rec *) NULL); @@ -5179,22 +5331,28 @@ #else sigsetjmp(jmpbuffer, 1); #endif -#ifdef SIGURG +#if defined(SIGURG) signal(SIGURG, timeout); #endif +#ifdef NETWARE + tsd = (TSD*) GetThreadDataAreaPtr(); +#endif + while (1) { BUFF *conn_io; request_rec *r; - + +#ifdef NETWARE + ThreadSwitch(); +#endif /* * (Re)initialize this child to a pre-connection state. */ - + ap_set_callback_and_alarm(NULL, 0); /* Cancel any outstanding alarms */ timeout_req = NULL; /* No request in progress */ current_conn = NULL; - ap_clear_pool(ptrans); (void) ap_update_child_status(child_num, SERVER_READY, @@ -5206,6 +5364,7 @@ csd = remove_job(); if (csd == -1) break; /* time to exit */ + requests_this_child++; ap_note_cleanups_for_socket(ptrans, csd); @@ -5215,7 +5374,7 @@ * socket options, file descriptors, and read/write buffers. */ - clen = sizeof(sa_server); + clen = sizeof(sa_server); if (getsockname(csd, &sa_server, &clen) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "getsockname"); continue; @@ -5248,21 +5407,22 @@ (struct sockaddr_in *) &sa_client, (struct sockaddr_in *) &sa_server, child_num); - + /* * Read and process each request found on our connection * until no requests are left or we decide to close. */ - while ((r = ap_read_request(current_conn)) != NULL) { - (void) ap_update_child_status(child_num, SERVER_BUSY_WRITE, r); +#ifdef NETWARE + ThreadSwitch(); +#endif + (void) ap_update_child_status(child_num, SERVER_BUSY_WRITE, r); if (r->status == HTTP_OK) ap_process_request(r); if (ap_extended_status) increment_counts(child_num, r); - if (!current_conn->keepalive || current_conn->aborted) break; @@ -5298,10 +5458,18 @@ } ap_destroy_pool(ptrans); (void) ap_update_child_status(child_num, SERVER_DEAD, NULL); + +#ifdef NETWARE + ap_thread_count--; +#endif } +#ifdef NETWARE +void child_main(void* child_num_arg) +#else void child_main(int child_num_arg) +#endif { /* * Only reason for this function, is to pass in @@ -5310,7 +5478,15 @@ * variables and I don't need to make those * damn variables static/global */ +#ifdef NETWARE + TSD Tsd; + + memset(&Tsd, 0, sizeof(TSD)); + SaveThreadDataAreaPtr(&Tsd); + child_sub_main((int)child_num_arg); +#else child_sub_main(child_num_arg); +#endif } @@ -5396,6 +5572,7 @@ APD2("signal prefix %s", signal_name_prefix); } +#ifndef NETWARE static void setup_inherited_listeners(pool *p) { HANDLE pipe; @@ -5448,13 +5625,183 @@ CloseHandle(pipe); return; } +#endif /* * worker_main() is main loop for the child process. The loop in * this function becomes the controlling thread for the actually working * threads (which run in a loop in child_sub_main()). */ + +#ifdef NETWARE +void worker_main(void) +{ + int nthreads; + fd_set main_fds; + int srv; + int clen; + int csd; + struct sockaddr_in sa_client; + int total_jobs = 0; + thread **child_handles; + int rv; + int i; + struct timeval tv; + int my_pid; + + int count_select_errors = 0; + pool *pchild; + pchild = ap_make_sub_pool(pconf); + + ap_standalone = 1; + sd = -1; + nthreads = ap_threads_per_child; + + if (nthreads <= 0) + nthreads = 40; + + my_pid = getpid(); + + ++ap_my_generation; + + copy_listeners(pconf); + ap_restart_time = time(NULL); + + reinit_scoreboard(pconf); + setup_listeners(pconf); + + if (listenmaxfd == -1) { + /* Help, no sockets were made, better log something and exit */ + ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_NOERRNO, NULL, + "No sockets were created for listening"); + + ap_destroy_pool(pchild); + cleanup_scoreboard(); + exit(0); + } + + set_signals(); + + /* + * - Initialize allowed_globals + * - Create the thread table + * - Spawn off threads + * - Create listen socket set (done above) + * - loop { + * wait for request + * create new job + * } while (!time to exit) + * - Close all listeners + * - Wait for all threads to complete + * - Exit + */ + + ap_child_init_modules(pconf, server_conf); + allowed_globals.jobmutex = ap_create_mutex(NULL); + allowed_globals.jobsemaphore = create_semaphore(0); + + /* spawn off the threads */ + child_handles = (thread *) malloc(nthreads * sizeof(int)); + + for (i = 0; i < nthreads; i++) { + child_handles[i] = create_thread((void (*)(void *)) child_main, (void *) i); + } + + if (nthreads > max_daemons_limit) { + max_daemons_limit = nthreads; + } + + while (1) { + tv.tv_sec = 1; + tv.tv_usec = 0; + + ThreadSwitch(); + + if (shutdown_pending) + break; + + memcpy(&main_fds, &listenfds, sizeof(fd_set)); + srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); + + if (srv == 0) { + count_select_errors = 0; /* reset count of errors */ + continue; + } + else if (srv == SOCKET_ERROR) { + if (h_errno != WSAEINTR) { + /* A "real" error occurred, log it and increment the count of + * select errors. This count is used to ensure we don't go into + * a busy loop of continuous errors. + */ + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "select failed with errno %d", h_errno); + count_select_errors++; + if (count_select_errors > MAX_SELECT_ERRORS) { + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, server_conf, + "Too many errors in select loop. Child process exiting."); + break; + } + } + continue; + } else { + listen_rec *lr; + + lr = find_ready_listener(&main_fds); + + if (lr != NULL) { + sd = lr->fd; + } + } + + do { + clen = sizeof(sa_client); + csd = accept(sd, (struct sockaddr *) &sa_client, &clen); + + if (csd == INVALID_SOCKET) { + csd = -1; + } + } while (csd < 0 && h_errno == EINTR); + + if (csd == INVALID_SOCKET) { + if (h_errno != WSAECONNABORTED) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "accept: (client socket) failed with errno = %d",h_errno); + } + } + else { + add_job(csd); + total_jobs++; + } + } + + APD2("process PID %d exiting", my_pid); + + /* Get ready to shutdown and exit */ + allowed_globals.exit_now = 1; + ap_release_mutex(start_mutex); + + for (i = 0; i < nthreads; i++) { + add_job(-1); + } + + APD2("process PID %d waiting for worker threads to exit", my_pid); + while(ap_thread_count) + ThreadSwitch(); + + destroy_semaphore(allowed_globals.jobsemaphore); + ap_destroy_mutex(allowed_globals.jobmutex); + + ap_child_exit_modules(pconf, server_conf); + ap_destroy_pool(pchild); + free(child_handles); + cleanup_scoreboard(); + + APD2("process PID %d exited", my_pid); + clean_parent_exit(0); + +} +#else void worker_main(void) { int nthreads; @@ -5473,6 +5820,7 @@ int max_jobs_per_exe; int max_jobs_after_exit_request; HANDLE hObjects[2]; + int count_select_errors = 0; pool *pchild; @@ -5501,7 +5849,7 @@ ap_restart_time = time(NULL); reinit_scoreboard(pconf); - + /* * Wait until we have permission to start accepting connections. * start_mutex is used to ensure that only one child ever @@ -6134,6 +6482,7 @@ service_set_status(SERVICE_STOPPED); return (0); } +#endif /* * Send signal to a running Apache. On entry signal should contain @@ -6212,9 +6561,35 @@ return TRUE; } -#ifdef WIN32 -__declspec(dllexport) - int apache_main(int argc, char *argv[]) + +#ifdef NETWARE +extern char *optarg; + +void signal_handler(int sig) +{ + switch (sig) { + case SIGTERM: + shutdown_pending = 1; + + while(!ap_main_finished) + ThreadSwitchWithDelay(); + + break; + } + return; +} + +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif + +#if defined(NETWARE) +int apache_main(int argc, char *argv[]) +#elif defined(WIN32) + __declspec(dllexport) +int apache_main(int argc, char *argv[]) #else int REALMAIN(int argc, char *argv[]) #endif @@ -6229,6 +6604,15 @@ char *signal_to_send = NULL; char cwd[MAX_STRING_LEN]; +#ifdef NETWARE + TSD Tsd; + + SetCurrentNameSpace(4); + SetTargetNameSpace(4); + signal(SIGTERM, signal_handler); + memset(&Tsd, 0, sizeof(Tsd)); + SaveThreadDataAreaPtr(&Tsd); +#else /* Service application * Configuration file in registry at: * HKLM\System\CurrentControlSet\Services\[Svc name]\Parameters\ConfPath @@ -6237,6 +6621,7 @@ service_main(master_main, argc, argv); clean_parent_exit(0); } +#endif /* Console application or a child process. */ @@ -6249,7 +6634,13 @@ common_init(); ap_setup_prelinked_modules(); - + +#ifdef NETWARE + if(!*ap_server_root) { + ap_cpystrn(ap_server_root, bslash2slash(remove_filename(argv[0])), + sizeof(ap_server_root)); + } +#else if(!GetCurrentDirectory(sizeof(cwd),cwd)) { ap_log_error(APLOG_MARK,APLOG_WIN32ERROR, NULL, "GetCurrentDirectory() failure"); @@ -6258,6 +6649,7 @@ ap_cpystrn(cwd, ap_os_canonical_filename(pcommands, cwd), sizeof(cwd)); ap_cpystrn(ap_server_root, cwd, sizeof(ap_server_root)); +#endif while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLZ:iusStThk:n:")) != -1) { char **new; @@ -6329,17 +6721,21 @@ ap_set_version(); printf("Server version: %s\n", ap_get_server_version()); printf("Server built: %s\n", ap_get_server_built()); - exit(0); + clean_parent_exit(0); + case 'V': ap_set_version(); show_compile_settings(); - exit(0); + clean_parent_exit(0); + case 'l': ap_show_modules(); - exit(0); + clean_parent_exit(0); + case 'L': ap_show_directives(); - exit(0); + clean_parent_exit(0); + case 'X': ++one_process; /* Weird debugging mode. */ break; @@ -6356,6 +6752,9 @@ case '?': usage(ap_server_argv0); } /* switch */ +#ifdef NETWARE + ThreadSwitch(); +#endif } /* while */ /* ServerConfFile is found in this order: @@ -6365,11 +6764,13 @@ * (4) [Registry: HKLM\Software\[product]\ServerRoot]/SERVER_CONFIG_FILE * (5) /HTTPD_ROOT/SERVER_CONFIG_FILE */ - + if (!conf_specified) { ap_cpystrn(ap_server_confname, SERVER_CONFIG_FILE, sizeof(ap_server_confname)); if (access(ap_server_root_relative(pcommands, ap_server_confname), 0)) { +#ifndef NETWARE ap_registry_get_server_root(pconf, ap_server_root, sizeof(ap_server_root)); +#endif if (!*ap_server_root) ap_cpystrn(ap_server_root, HTTPD_ROOT, sizeof(ap_server_root)); ap_cpystrn(ap_server_root, ap_os_canonical_filename(pcommands, ap_server_root), @@ -6377,6 +6778,7 @@ } } + if (!ap_os_is_path_absolute(ap_server_confname)) { char *full_conf_path; @@ -6424,25 +6826,38 @@ send_signal(pconf, signal_to_send); clean_parent_exit(0); } - + +#ifndef NETWARE if (!child && !ap_dump_settings) { ap_log_pid(pconf, ap_pid_fname); } +#endif post_parse_init(); #ifdef OS2 printf("%s running...\n", ap_get_server_version()); #endif -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) if (!child) { printf("%s running...\n", ap_get_server_version()); } #endif + +#ifndef NETWARE if (one_process && !exit_event) exit_event = create_event(0, 0, NULL); if (one_process && !start_mutex) start_mutex = ap_create_mutex(NULL); +#endif + +#ifdef NETWARE + worker_main(); + destroy_semaphore(allowed_globals.jobsemaphore); + + while((ap_thread_count) || (!shutdown_pending)) + ThreadSwitchWithDelay(); +#else /* * In the future, the main will spawn off a couple * of children and monitor them. As soon as a child @@ -6457,6 +6872,7 @@ } else master_main(argc, argv); +#endif clean_parent_exit(0); return 0; /* purely to avoid a warning */ 1.150 +1 -1 apache-1.3/src/main/http_request.c Index: http_request.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v retrieving revision 1.149 retrieving revision 1.150 diff -u -r1.149 -r1.150 --- http_request.c 1999/05/21 12:16:21 1.149 +++ http_request.c 1999/10/21 20:44:43 1.150 @@ -113,7 +113,7 @@ static int check_symlinks(char *d, int opts) { -#if defined(OS2) || defined(WIN32) +#if defined(OS2) || defined(WIN32) || defined(NETWARE) /* OS/2 doesn't have symlinks */ return OK; #else 1.173 +5 -5 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.172 retrieving revision 1.173 diff -u -r1.172 -r1.173 --- util.c 1999/09/18 10:57:07 1.172 +++ util.c 1999/10/21 20:44:44 1.173 @@ -1377,7 +1377,7 @@ s = (const unsigned char *)str; for (; *s; ++s) { -#if defined(OS2) || defined(WIN32) +#if defined(OS2) || defined(WIN32) || defined(NETWARE) /* Don't allow '&' in parameters under OS/2. */ /* This can be used to send commands to the shell. */ if (*s == '&') { @@ -1637,7 +1637,7 @@ #ifdef MULTIPLE_GROUPS int cnt; #endif -#if defined(OS2) || defined(WIN32) +#if defined(OS2) || defined(WIN32) || defined(NETWARE) /* OS/2 dosen't have Users and Groups */ return 1; #else @@ -1746,7 +1746,7 @@ #ifdef NEED_INITGROUPS int initgroups(const char *name, gid_t basegid) { -#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM) +#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM) || defined(NETWARE) /* QNX, MPE and BeOS do not appear to support supplementary groups. */ return 0; #else /* ndef QNX */ @@ -1826,7 +1826,7 @@ API_EXPORT(uid_t) ap_uname2id(const char *name) { -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) return (1); #else struct passwd *ent; @@ -1844,7 +1844,7 @@ API_EXPORT(gid_t) ap_gname2id(const char *name) { -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) return (1); #else struct group *ent; 1.146 +1 -1 apache-1.3/src/main/util_script.c Index: util_script.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/util_script.c,v retrieving revision 1.145 retrieving revision 1.146 diff -u -r1.145 -r1.146 --- util_script.c 1999/08/23 16:20:46 1.145 +++ util_script.c 1999/10/21 20:44:45 1.146 @@ -1045,7 +1045,7 @@ } return (pid); } - +#elif defined(NETWARE) #else if (ap_suexec_enabled && ((r->server->server_uid != ap_user_id) 1.67 +8 -0 apache-1.3/src/modules/proxy/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- mod_proxy.c 1999/10/11 21:33:35 1.66 +++ mod_proxy.c 1999/10/21 20:45:01 1.67 @@ -955,3 +955,11 @@ NULL, /* child_exit */ proxy_detect /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.64 +5 -5 apache-1.3/src/modules/proxy/proxy_cache.c Index: proxy_cache.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- proxy_cache.c 1999/08/27 20:21:49 1.63 +++ proxy_cache.c 1999/10/21 20:45:03 1.64 @@ -123,7 +123,7 @@ const char *cachedir, const char *cachesubdir); static void help_proxy_garbage_coll(request_rec *r); static int should_proxy_garbage_coll(request_rec *r); -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) +#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) static void detached_proxy_garbage_coll(request_rec *r); #endif @@ -143,7 +143,7 @@ ap_block_alarms(); /* avoid SIGALRM on big cache cleanup */ if (should_proxy_garbage_coll(r)) -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) +#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) detached_proxy_garbage_coll(r); #else help_proxy_garbage_coll(r); @@ -203,7 +203,7 @@ return 0; } -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) +#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) static void detached_proxy_garbage_coll(request_rec *r) { pid_t pid; @@ -1141,7 +1141,7 @@ if (!p) break; *p = '\0'; -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) if (mkdir(c->filename) < 0 && errno != EEXIST) #elif defined(__TANDEM) if (mkdir(c->filename, S_IRWXU | S_IRWXG | S_IRWXO) < 0 && errno != EEXIST) @@ -1154,7 +1154,7 @@ *p = '/'; ++p; } -#if defined(OS2) || defined(WIN32) +#if defined(OS2) || defined(WIN32) || defined(NETWARE) /* Under OS/2 use rename. */ if (rename(c->tempfile, c->filename) == -1) ap_log_error(APLOG_MARK, APLOG_ERR, s, 1.81 +2 -2 apache-1.3/src/modules/proxy/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- proxy_util.c 1999/08/27 20:21:52 1.80 +++ proxy_util.c 1999/10/21 20:45:04 1.81 @@ -280,7 +280,7 @@ if (!ap_isdigit(host[i]) && host[i] != '.') break; /* must be an IP address */ -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) if (host[i] == '\0' && (inet_addr(host) == -1)) #else if (host[i] == '\0' && (ap_inet_addr(host) == -1 || inet_network(host) == -1)) @@ -1242,7 +1242,7 @@ ap_hard_timeout("proxy connect", r); do { i = connect(sock, (struct sockaddr *) addr, sizeof(struct sockaddr_in)); -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) if (i == SOCKET_ERROR) errno = WSAGetLastError(); #endif /* WIN32 */ 1.37 +7 -0 apache-1.3/src/modules/standard/mod_auth_anon.c Index: mod_auth_anon.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_auth_anon.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- mod_auth_anon.c 1999/01/01 19:05:07 1.36 +++ mod_auth_anon.c 1999/10/21 20:45:15 1.37 @@ -313,3 +313,10 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.37 +10 -0 apache-1.3/src/modules/standard/mod_cern_meta.c Index: mod_cern_meta.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_cern_meta.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- mod_cern_meta.c 1999/01/01 19:05:08 1.36 +++ mod_cern_meta.c 1999/10/21 20:45:17 1.37 @@ -150,7 +150,9 @@ #include "httpd.h" #include "http_config.h" +#ifndef NETWARE #include <sys/types.h> +#endif #include <sys/stat.h> #include "util_script.h" #include "http_log.h" @@ -393,3 +395,11 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.93 +1 -1 apache-1.3/src/modules/standard/mod_cgi.c Index: mod_cgi.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- mod_cgi.c 1999/06/30 04:36:55 1.92 +++ mod_cgi.c 1999/10/21 20:45:22 1.93 @@ -210,7 +210,7 @@ /* Soak up script output */ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) continue; -#ifdef WIN32 +#if defined(WIN32) || defined(NETWARE) /* Soak up stderr and redirect it to the error log. * Script output to stderr is already directed to the error log * on Unix, thanks to the magic of fork(). 1.42 +8 -0 apache-1.3/src/modules/standard/mod_digest.c Index: mod_digest.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_digest.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- mod_digest.c 1999/01/01 19:05:08 1.41 +++ mod_digest.c 1999/10/21 20:45:24 1.42 @@ -388,3 +388,11 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.33 +8 -0 apache-1.3/src/modules/standard/mod_expires.c Index: mod_expires.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_expires.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- mod_expires.c 1999/01/01 19:05:09 1.32 +++ mod_expires.c 1999/10/21 20:45:26 1.33 @@ -508,3 +508,11 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.21 +7 -0 apache-1.3/src/modules/standard/mod_headers.c Index: mod_headers.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_headers.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- mod_headers.c 1999/07/29 17:54:05 1.20 +++ mod_headers.c 1999/10/21 20:45:28 1.21 @@ -263,3 +263,10 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif \ No newline at end of file 1.119 +1 -1 apache-1.3/src/modules/standard/mod_include.c Index: mod_include.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_include.c,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- mod_include.c 1999/05/21 23:57:57 1.118 +++ mod_include.c 1999/10/21 20:45:29 1.119 @@ -129,7 +129,7 @@ ap_ht_time(r->pool, r->finfo.st_mtime, timefmt, 0)); ap_table_setn(e, "DOCUMENT_URI", r->uri); ap_table_setn(e, "DOCUMENT_PATH_INFO", r->path_info); -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) pw = getpwuid(r->finfo.st_uid); if (pw) { ap_table_setn(e, "USER_NAME", ap_pstrdup(r->pool, pw->pw_name)); 1.46 +8 -0 apache-1.3/src/modules/standard/mod_info.c Index: mod_info.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_info.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- mod_info.c 1999/06/05 15:48:12 1.45 +++ mod_info.c 1999/10/21 20:45:32 1.46 @@ -693,3 +693,11 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.145 +15 -5 apache-1.3/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v retrieving revision 1.144 retrieving revision 1.145 diff -u -r1.144 -r1.145 --- mod_rewrite.c 1999/08/03 09:27:33 1.144 +++ mod_rewrite.c 1999/10/21 20:45:36 1.145 @@ -92,7 +92,9 @@ #include "mod_rewrite.h" #ifndef NO_WRITEV +#ifndef NETWARE #include <sys/types.h> +#endif #include <sys/uio.h> #endif @@ -1200,7 +1202,7 @@ /* it was finally rewritten to a local path */ /* expand "/~user" prefix */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) r->filename = expand_tildepaths(r, r->filename); #endif rewritelog(r, 2, "local path result: %s", r->filename); @@ -2509,7 +2511,7 @@ ** Unix /etc/passwd database information ** */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) static char *expand_tildepaths(request_rec *r, char *uri) { char user[LONG_STRING_LEN]; @@ -3274,7 +3276,7 @@ "file %s", lockname); exit(1); } -#if !defined(OS2) && !defined(WIN32) +#if !defined(OS2) && !defined(WIN32) && !defined(NETWARE) /* make sure the childs have access to this file */ if (geteuid() == 0 /* is superuser */) chown(lockname, ap_user_id, -1 /* no gid change */); @@ -3437,6 +3439,8 @@ child_pid = pi.dwProcessId; } } +#elif defined(NETWARE) + // Need something here!!! Spawn???? #elif defined(OS2) /* IBM OS/2 */ execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); @@ -3709,7 +3713,7 @@ LOOKAHEAD(ap_sub_req_lookup_file) } -#ifndef WIN32 +#if !defined(WIN32) && !defined(NETWARE) /* Win32 has a rather different view of file ownerships. For now, just forget it */ @@ -3744,7 +3748,7 @@ } } } -#endif /* ndef WIN32 */ +#endif /* ndef WIN32 && NETWARE*/ if (result == NULL) { return ap_pstrdup(r->pool, ""); @@ -4259,5 +4263,11 @@ return 0; } +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif /*EOF*/ 1.66 +3 -1 apache-1.3/src/modules/standard/mod_rewrite.h Index: mod_rewrite.h =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- mod_rewrite.h 1999/08/03 09:27:35 1.65 +++ mod_rewrite.h 1999/10/21 20:45:38 1.66 @@ -101,7 +101,9 @@ #include <signal.h> #include <errno.h> #include <ctype.h> +#ifndef NETWARE #include <sys/types.h> +#endif #include <sys/stat.h> /* Include from the Apache server ... */ @@ -157,7 +159,7 @@ #endif #if !defined(USE_FCNTL) && !defined(USE_FLOCK) #define USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) && !defined(__TANDEM) +#if !defined(MPE) && !defined(WIN32) && !defined(__TANDEM) && !defined(NETWARE) #include <sys/file.h> #endif #ifndef LOCK_UN 1.34 +7 -0 apache-1.3/src/modules/standard/mod_speling.c Index: mod_speling.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- mod_speling.c 1999/09/23 19:03:06 1.33 +++ mod_speling.c 1999/10/21 20:45:40 1.34 @@ -557,3 +557,10 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.108 +7 -0 apache-1.3/src/modules/standard/mod_status.c Index: mod_status.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_status.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- mod_status.c 1999/06/05 15:48:12 1.107 +++ mod_status.c 1999/10/21 20:45:42 1.108 @@ -771,3 +771,10 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif 1.40 +4 -4 apache-1.3/src/modules/standard/mod_userdir.c Index: mod_userdir.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_userdir.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mod_userdir.c 1999/03/07 13:13:54 1.39 +++ mod_userdir.c 1999/10/21 20:45:46 1.40 @@ -290,10 +290,10 @@ return REDIRECT; } else { -#ifdef WIN32 - /* Need to figure out home dirs on NT */ +#if defined(WIN32) || defined(NETWARE) + /* Need to figure out home dirs on NT and NetWare */ return DECLINED; -#else /* WIN32 */ +#else /* WIN32 & NetWare */ struct passwd *pw; if ((pw = getpwnam(w))) { #ifdef OS2 @@ -303,7 +303,7 @@ filename = ap_pstrcat(r->pool, pw->pw_dir, "/", userdir, NULL); #endif } -#endif /* WIN32 */ +#endif /* WIN32 & NetWare */ } /* 1.40 +16 -1 apache-1.3/src/modules/standard/mod_usertrack.c Index: mod_usertrack.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_usertrack.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mod_usertrack.c 1999/04/29 15:44:31 1.39 +++ mod_usertrack.c 1999/10/21 20:45:48 1.40 @@ -135,10 +135,14 @@ #if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) clock_t mpe_times; struct tms mpe_tms; -#elif !defined(WIN32) +#elif !defined(WIN32) || defined(NETWARE) struct timeval tv; +#ifdef NETWARE + time_t tz = 0; +#else struct timezone tz = {0, 0}; #endif +#endif /* 1024 == hardcoded constant */ char cookiebuf[1024]; char *new_cookie; @@ -158,6 +162,9 @@ ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, (int) getpid(), (long) r->request_time, (long) mpe_tms.tms_utime); +#elif defined(NETWARE) + ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, + (int) getpid(), (long) r->request_time, (long) clock()); #elif defined(WIN32) /* * We lack gettimeofday() and we lack times(). So we'll use a combination @@ -375,3 +382,11 @@ NULL, /* child_exit */ NULL /* post read-request */ }; + + +#ifdef NETWARE +int main(int argc, char *argv[]) +{ + ExitThread(TSR_THREAD, 0); +} +#endif \ No newline at end of file 1.27 +30 -1 apache-1.3/src/support/htdigest.c Index: htdigest.c =================================================================== RCS file: /home/cvs/apache-1.3/src/support/htdigest.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- htdigest.c 1999/08/02 10:45:36 1.26 +++ htdigest.c 1999/10/21 20:46:31 1.27 @@ -67,7 +67,9 @@ */ #include "ap_config.h" +#ifndef NETWARE #include <sys/types.h> +#endif #include "ap.h" #include "ap_md5.h" #if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) @@ -93,6 +95,7 @@ char *tn; + static void getword(char *word, char *line, char stop) { int x = 0, y; @@ -189,6 +192,18 @@ exit(1); } + +#ifdef NETWARE +static void copy_file(FILE *target, FILE *source) +{ + static char line[MAX_STRING_LEN]; + + while (!(getline(line, MAX_STRING_LEN, source))) { + putline(target, line); + } +} +#endif + int main(int argc, char *argv[]) { FILE *tfp, *f; @@ -257,15 +272,29 @@ if (!found) { printf("Adding user %s in realm %s\n", user, realm); add_password(user, realm, tfp); - } + } fclose(f); fclose(tfp); +#ifndef NETWARE #if defined(OS2) || defined(WIN32) sprintf(command, "copy \"%s\" \"%s\"", tn, argv[1]); #else sprintf(command, "cp %s %s", tn, argv[1]); #endif system(command); +#else + if (!(tfp = fopen(tn, "r"))) { + fprintf(stderr, "Could not open temp file.\n"); + exit(1); + } + + if (!(f = fopen(argv[1], "w"))) { + fprintf(stderr, "Could not open %s.\n", argv[1]); + exit(1); + } + + copy_file(f, tfp); +#endif unlink(tn); return 0; } 1.37 +2 -0 apache-1.3/src/support/htpasswd.c Index: htpasswd.c =================================================================== RCS file: /home/cvs/apache-1.3/src/support/htpasswd.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- htpasswd.c 1999/09/01 04:12:22 1.36 +++ htpasswd.c 1999/10/21 20:46:32 1.37 @@ -79,7 +79,9 @@ */ #include "ap_config.h" +#ifndef NETWARE #include <sys/types.h> +#endif #include <signal.h> #include <errno.h> #include "ap.h"