manoj 98/11/06 14:42:46
Modified: src Configure CHANGES src/helpers GuessOS src/include alloc.h ap_config.h scoreboard.h src/main buff.c http_main.c util.c . STATUS Log: Submitted by: Joe Moenich <[EMAIL PROTECTED]> and others at IBM The rest of the port to TPF, consisting of changes to existing files. Revision Changes Path 1.305 +15 -2 apache-1.3/src/Configure Index: Configure =================================================================== RCS file: /export/home/cvs/apache-1.3/src/Configure,v retrieving revision 1.304 retrieving revision 1.305 diff -u -u -r1.304 -r1.305 --- Configure 1998/11/04 12:38:32 1.304 +++ Configure 1998/11/06 22:42:37 1.305 @@ -616,6 +616,14 @@ DEF_WANTHSREGEX=yes LIBS="$LIBS -lsocket -lnsl -lc" ;; + TPF) + OS='TPF' + OSDIR='os/tpf' + CC='c89' + CFLAGS="$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE" + DEF_WANTHSREGEX=yes + LIBS="$LIBS" + ;; *-sni-sysv4*) OS='SVR4' CFLAGS="$CFLAGS -DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN" @@ -1815,10 +1823,14 @@ ## Use TestCompile to see if $(CC) is ANSI and as a "final" sanity ## check ## -echo " + doing sanity check on compiler and options" -if ./helpers/TestCompile sanity; then + +if [ "$OS" = "TPF" ] ; then : else + echo " + doing sanity check on compiler and options" + if ./helpers/TestCompile sanity; then + : + else echo "** A test compilation with your Makefile configuration" echo "** failed. This is most likely because your C compiler" echo "** is not ANSI. Apache requires an ANSI C Compiler, such" @@ -1827,6 +1839,7 @@ echo " Aborting!" exitcode=1 exit 1 + fi fi #################################################################### 1.1138 +3 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1137 retrieving revision 1.1138 diff -u -u -r1.1137 -r1.1138 --- CHANGES 1998/11/06 12:24:35 1.1137 +++ CHANGES 1998/11/06 22:42:38 1.1138 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) PORT: Add a port to the TPF OS. [Joe Moenich <[EMAIL PROTECTED]> and + others at IBM] + *) Fix internal handling of registered cleanups in alloc.c by making sure that NULL-specified callback functions (we don't do this in the official set of modules, but third-party modules do) for ap_register_cleanup() 1.52 +7 -0 apache-1.3/src/helpers/GuessOS Index: GuessOS =================================================================== RCS file: /export/home/cvs/apache-1.3/src/helpers/GuessOS,v retrieving revision 1.51 retrieving revision 1.52 diff -u -u -r1.51 -r1.52 --- GuessOS 1998/11/04 12:38:34 1.51 +++ GuessOS 1998/11/06 22:42:40 1.52 @@ -275,6 +275,13 @@ exit 0 fi +# Apache is not compiled on the TPF platform +# therefore an environment variable is used +if [ "$TPF" = "YES" ]; then + echo "TPF" + exit 0 +fi + # Now NeXT ISNEXT=`hostinfo 2>/dev/null` case "$ISNEXT" in 1.64 +5 -0 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.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- alloc.h 1998/08/14 02:49:45 1.63 +++ alloc.h 1998/11/06 22:42:41 1.64 @@ -269,8 +269,13 @@ * up with timeout handling in general... */ +#ifdef TPF +#define ap_block_alarms() (0) +#define ap_unblock_alarms() (0) +#else API_EXPORT(void) ap_block_alarms(void); API_EXPORT(void) ap_unblock_alarms(void); +#endif /* TPF */ /* Common cases which want utility support.. * the note_cleanups_for_foo routines are for 1.244 +38 -4 apache-1.3/src/include/ap_config.h Index: ap_config.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.243 retrieving revision 1.244 diff -u -u -r1.243 -r1.244 --- ap_config.h 1998/11/05 19:20:16 1.243 +++ ap_config.h 1998/11/06 22:42:41 1.244 @@ -92,7 +92,7 @@ #include "os.h" #endif -#if !defined(QNX) && !defined(MPE) && !defined(WIN32) +#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF) #include <sys/param.h> #endif @@ -801,6 +801,36 @@ /* All windows stuff is now in os/win32/os.h */ +#elif defined(TPF) /* IBM Transaction Processing Facility operating system */ + +#include <tpfeq.h> +#include <tpfio.h> +#include <sysapi.h> +#include <sysgtime.h> +#define PRIMECRAS 0x010000 +#define JMP_BUF jmp_buf +#define NEED_INITGROUPS +#define NEED_STRCASECMP +#define NEED_STRDUP +#define NEED_STRNCASECMP +#define NO_DBM_REWRITEMAP +#define NO_GETTIMEOFDAY +#define NO_KILLPG +#define NO_LINGCLOSE +#define NO_MMAP +#define NO_OTHER_CHILD +#define NO_RELIABLE_PIPED_LOGS +#define NO_SETSID +#define NO_SHMGET +#define NO_SLACK +#define NO_TIMES +#define NO_USE_SIGACTION +#define NO_WRITEV +#define USE_LONGJMP +#define USE_TPF_SELECT +#undef offsetof +#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field)) + #else /* Unknown system - Edit these to match */ #ifdef BSD @@ -906,7 +936,7 @@ #include <stdlib.h> #include <string.h> #include "ap_ctype.h" -#if !defined(MPE) && !defined(WIN32) +#if !defined(MPE) && !defined(WIN32) && !defined(TPF) #include <sys/file.h> #endif #ifndef WIN32 @@ -914,10 +944,12 @@ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif /* HAVE_SYS_SELECT_H */ +#ifndef TPF #include <netinet/in.h> +#endif /* TPF */ #include <netdb.h> #include <sys/ioctl.h> -#if !defined(MPE) && !defined(BEOS) +#if !defined(MPE) && !defined(BEOS) && !defined(TPF) #include <arpa/inet.h> /* for inet_ntoa */ #endif #include <sys/wait.h> @@ -943,7 +975,7 @@ #endif #include <signal.h> #include <errno.h> -#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) +#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) #include <memory.h> #endif @@ -1047,6 +1079,8 @@ #ifdef SELECT_NEEDS_CAST #define ap_select(_a, _b, _c, _d, _e) \ select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e)) +#elif defined(USE_TPF_SELECT) +#define ap_select tpf_select #else #define ap_select select #endif 1.43 +4 -0 apache-1.3/src/include/scoreboard.h Index: scoreboard.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/scoreboard.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -u -r1.42 -r1.43 --- scoreboard.h 1998/10/28 13:02:37 1.42 +++ scoreboard.h 1998/11/06 22:42:41 1.43 @@ -63,7 +63,11 @@ #endif #ifndef WIN32 +#ifdef TPF +#include <time.h> +#else #include <sys/times.h> +#endif /* TPF */ #endif /* Scoreboard info on a process is, for now, kept very brief --- 1.84 +19 -0 apache-1.3/src/main/buff.c Index: buff.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -u -r1.83 -r1.84 --- buff.c 1998/10/05 17:48:44 1.83 +++ buff.c 1998/11/06 22:42:42 1.84 @@ -259,6 +259,24 @@ } else rv = ap_read(fb, buf, nbyte); +#elif defined(TPF) + fd_set fds; + struct timeval tv; + + tpf_process_signals(); + if (fb->flags & B_SOCKET) { + alarm(rv = alarm(0)); + FD_ZERO(&fds); + FD_SET(fb->fd_in, &fds); + tv.tv_sec = rv+1; + tv.tv_usec = 0; + rv = ap_select(fb->fd_in + 1, &fds, NULL, NULL, &tv); + if (rv < 1) { + tpf_process_signals(); + return(rv); + } + } + rv = ap_read(fb, buf, nbyte); #else rv = ap_read(fb, buf, nbyte); #endif /* WIN32 */ @@ -1578,3 +1596,4 @@ } return res; } + 1.405 +46 -18 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.404 retrieving revision 1.405 diff -u -u -r1.404 -r1.405 --- http_main.c 1998/10/28 19:26:26 1.404 +++ http_main.c 1998/11/06 22:42:43 1.405 @@ -116,7 +116,7 @@ #endif #ifdef WIN32 #include "../os/win32/getopt.h" -#elif !defined(BEOS) +#elif !defined(BEOS) && !defined(TPF) #include <netinet/tcp.h> #endif @@ -1096,6 +1096,7 @@ } } +#ifndef TPF /* * These two called from alloc.c to protect its critical sections... * Note that they can nest (as when destroying the sub_pools of a pool @@ -1129,8 +1130,8 @@ } } } +#endif /* TPF */ - static APACHE_TLS void (*volatile alarm_fn) (int) = NULL; #ifdef WIN32 static APACHE_TLS unsigned int alarm_expiry_time = 0; @@ -2781,7 +2782,7 @@ int x; chdir("/"); -#if !defined(MPE) && !defined(OS2) +#if !defined(MPE) && !defined(OS2) && !defined(TPF) /* Don't detach for MPE because child processes can't survive the death of the parent. */ if ((x = fork()) > 0) @@ -2805,7 +2806,7 @@ fprintf(stderr, "httpd: setpgrp or getpgrp failed\n"); exit(1); } -#elif defined(OS2) +#elif defined(OS2) || defined(TPF) /* OS/2 don't support process group IDs */ pgrp = getpid(); #elif defined(MPE) @@ -4102,7 +4103,17 @@ idle_count, total_non_dead); } for (i = 0; i < free_length; ++i) { +#ifdef TPF + if(make_child(server_conf, free_slots[i], now) == -1) { + if(free_length == 1) { + shutdown_pending = 1; + ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, + "No active child processes: shutting down"); + } + } +#else make_child(server_conf, free_slots[i], now); +#endif /* TPF */ } /* the next time around we want to spawn twice as many if this * wasn't good enough, but not if we've just done a graceful @@ -4427,6 +4438,8 @@ { int c; int configtestonly = 0; + int sock_in; + int sock_out; #ifdef SecureWare if (set_auth_parameters(argc, argv) < 0) @@ -4452,6 +4465,7 @@ ap_setup_prelinked_modules(); +#ifndef TPF while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVhlL:St" #ifdef DEBUG_SIGSTOP @@ -4520,6 +4534,7 @@ usage(argv[0]); } } +#endif /* TPF */ ap_suexec_enabled = init_suexec(); server_conf = ap_read_config(pconf, ptrans, ap_server_confname); @@ -4575,33 +4590,46 @@ exit(0); } +#ifdef TPF + signal(SIGALRM, alrm_handler); + ecbptr()->ebrout = PRIMECRAS; +#endif /* TPF */ + +#ifdef TPF +/* TPF only passes the incoming socket number from the internet daemon + in ebw000 */ + sock_in = * (int*)(&(ecbptr()->ebw000)); + sock_out = * (int*)(&(ecbptr()->ebw000)); +#elif defined(MPE) +/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas + HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1). + Go figure. SR 5003355016 has been submitted to request that the existing + functionality be documented, and then to enhance the functionality to be + like HPUX. */ + sock_in = fileno(stdin); + sock_out = fileno(stdin); +#else + sock_in = fileno(stdin); + sock_out = fileno(stdout); +#endif + l = sizeof(sa_client); - if ((getpeername(fileno(stdin), &sa_client, &l)) < 0) { + if ((getpeername(sock_in, &sa_client, &l)) < 0) { /* get peername will fail if the input isn't a socket */ perror("getpeername"); memset(&sa_client, '\0', sizeof(sa_client)); } l = sizeof(sa_server); - if (getsockname(fileno(stdin), &sa_server, &l) < 0) { + if (getsockname(sock_in, &sa_server, &l) < 0) { perror("getsockname"); fprintf(stderr, "Error getting local address\n"); exit(1); } server_conf->port = ntohs(((struct sockaddr_in *) &sa_server)->sin_port); cio = ap_bcreate(ptrans, B_RDWR | B_SOCKET); -#ifdef MPE -/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas - HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1). - Go figure. SR 5003355016 has been submitted to request that the existing - functionality be documented, and then to enhance the functionality to be - like HPUX. */ - - cio->fd = fileno(stdin); -#else - cio->fd = fileno(stdout); -#endif - cio->fd_in = fileno(stdin); + cio->fd = sock_out; + cio->fd_in = sock_in; conn = new_connection(ptrans, server_conf, cio, (struct sockaddr_in *) &sa_client, (struct sockaddr_in *) &sa_server, -1); 1.139 +1 -1 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.138 retrieving revision 1.139 diff -u -u -r1.138 -r1.139 --- util.c 1998/11/05 20:11:27 1.138 +++ util.c 1998/11/06 22:42:43 1.139 @@ -1438,7 +1438,7 @@ #ifdef NEED_INITGROUPS int initgroups(const char *name, gid_t basegid) { -#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) +#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) /* QNX, MPE and BeOS do not appear to support supplementary groups. */ return 0; #else /* ndef QNX */ 1.531 +0 -4 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.530 retrieving revision 1.531 diff -u -u -r1.530 -r1.531 --- STATUS 1998/11/06 17:04:10 1.530 +++ STATUS 1998/11/06 22:42:45 1.531 @@ -73,10 +73,6 @@ Available Patches: - * [PATCH] TPF port - Message-ID: <[EMAIL PROTECTED]> - Status: Jim +1 (with minor nits), Lars +1 (concept) - * Ralf's Build outside of source tree (take 2: alternative solution) ("overrules" Wilfredo Sanchez's [PATCH] Build outside of source tree) Message-ID: <[EMAIL PROTECTED]>