From: David McCreedy Date: Wed, 15 Sep 2004 23:45:18 +0000 (+0000) Subject: Various TPF platform-specific changes: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6d13b2cf8e20f2a4e33822fe9b0c9896dc90e45;p=thirdparty%2Fapache%2Fhttpd.git Various TPF platform-specific changes: provide cleaner shutdown on fatal child exit, expand address size handling, and clean up some warnings git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@105167 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/Configure b/src/Configure index 3df526abc69..ac2f0bc0791 100755 --- a/src/Configure +++ b/src/Configure @@ -611,14 +611,18 @@ case "$PLAT" in CFLAGS_SHLIB='-Zpic' ;; TPF) - OS='TPF' - OSDIR='os/tpf' - CC='c89' - CFLAGS="$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE" - DEF_WANTHSREGEX=yes - LIBS="$LIBS" - SUBTARGET="target_compile_only" - ;; + OS='TPF' + OSDIR='os/tpf' + CC='c89' + CFLAGS="$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE" + if [ "x$TPF64BIT" = "xYES" ] ; then + DEF_WANTHSREGEX=no + else + DEF_WANTHSREGEX=yes + fi + LIBS="$LIBS" + SUBTARGET="target_compile_only" + ;; BS2000*-siemens-sysv4*) OS='BS2000' OSDIR='os/bs2000' @@ -1778,6 +1782,10 @@ MODDIRS_NO_SO=`awk < $tmpfile ' # Use tmpfile2 for the module definition file, and tmpfile3 for the # shell commands to be executed for this module. +if [ "x$OS" = "xTPF" -a "x$TPF64BIT" = "xYES" ]; then + rm -f apache.modules +fi + for modfile in $MODFILES ; do rm -f $tmpfile2 $tmpfile3 modname='' @@ -1841,6 +1849,10 @@ for modfile in $MODFILES ; do if [ "x$ext" = "x$SHMOD_SUFFIX_NAME" -a "x$SHLIB_EXPORT_FILES" = "xyes" ]; then echo "$modname" >$modbase.exp fi + if [ "x$OS" = "xTPF" -a "x$TPF64BIT" = "xYES" ] ; then + # output a list of modules for TPF's 64BIT build process + `echo $modfile | sed 's/.*\/\([_a-zA-Z]*\.\)o$/\1c/' >> apache.modules` + fi done # $tmpfile now contains Module lines for all the modules we want diff --git a/src/helpers/GuessOS b/src/helpers/GuessOS index 4c18d52dbc4..94c354440cf 100755 --- a/src/helpers/GuessOS +++ b/src/helpers/GuessOS @@ -27,15 +27,10 @@ # Be as similar to the output of config.guess/config.sub # as possible. -# Handle TPF before handling other OSes. This -# is being done because TPF is sometimes compiled -# on OS/390. When that is the case, if we don't -# handle TPF ahead of the other OSes, TPF will -# fall into the OS/390 case and this script would -# return an incorrect value for the platform. -# -# Apache is not compiled on the TPF platform -# therefore an environment variable is used +# Handle TPF before the other operating systems +# since it's compiled on non-TPF platforms. +# This keeps GuessOS from returning incorrect +# uname values for TPF: if [ "x$TPF" = "xYES" ]; then echo "TPF" exit 0 diff --git a/src/include/ap_config.h b/src/include/ap_config.h index d546a45036b..6fc8b07fead 100644 --- a/src/include/ap_config.h +++ b/src/include/ap_config.h @@ -30,9 +30,11 @@ extern "C" { /* * Support for platform dependent autogenerated defines */ -#if !defined(WIN32) && !defined(NETWARE) +#if !defined(WIN32) && !defined(NETWARE) && !defined(TPF) #include "ap_config_auto.h" -#else +#endif + +#if defined(WIN32) || defined(NETWARE) /* not available under WIN32, so provide important entries manually */ #undef HAVE_UNISTD_H #endif @@ -904,47 +906,7 @@ typedef int rlim_t; #elif defined(TPF) /* IBM Transaction Processing Facility operating system */ -#include -#include -#include -#include -#define PRIMECRAS 0x010000 -#define JMP_BUF jmp_buf -#define HAVE_SHMGET -#undef HAVE_SYS_RESOURCE_H -#define NEED_INITGROUPS -#define NEED_SIGNAL_INTERRUPT -#include -#ifndef __strings_h -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#define NEED_STRDUP -#define NO_DBM_REWRITEMAP -#define NO_GETTIMEOFDAY -#define NO_LINGCLOSE -#define NO_MMAP -#define NO_OTHER_CHILD -#define NO_PIPED_LOGS -#define NO_RELIABLE_PIPED_LOGS -#define NO_SETSID -#define NO_SLACK -#define NO_TIMES -#ifndef TPF_HAVE_SIGACTION -#define NO_USE_SIGACTION -#endif -#define USE_LONGJMP -#define USE_SHMGET_SCOREBOARD -#define USE_TPF_ACCEPT -#define HAVE_TPF_CORE_SERIALIZED_ACCEPT -#define USE_TPF_SELECT -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR -#include -#define crypt(buf,salt) ((char *)buf) -#undef offsetof -#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field)) +/* All TPF definitions are now in os/tpf/os.h */ #elif defined(__TANDEM) #define NO_WRITEV @@ -1095,7 +1057,7 @@ typedef int rlim_t; #include #endif #include "ap_ctype.h" -#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE) +#if !defined(MPE) && !defined(WIN32) && !defined(TPF41) && !defined(__TANDEM) && !defined(NETWARE) #include #endif #if !defined(WIN32) && !defined(NETWARE) @@ -1103,15 +1065,15 @@ typedef int rlim_t; #ifdef HAVE_SYS_SELECT_H #include #endif /* HAVE_SYS_SELECT_H */ -#ifndef TPF +#ifndef TPF41 #include -#endif /* TPF */ +#endif /* ndef TPF41 */ #if defined(OS390) && !defined(NO_ADDRESS) #define NO_ADDRESS NO_DATA /* Not defined properly by OS/390 v1r2 */ #endif #include #include -#if !defined(MPE) && !defined(BEOS) && !defined(TPF) +#if !defined(MPE) && !defined(BEOS) && !defined(TPF41) #include /* for inet_ntoa */ #endif #include @@ -1151,11 +1113,11 @@ typedef int rlim_t; #undef SIG_SETMASK #undef SIG_UNBLOCK #endif -#if defined(TPF) && defined(NSIG) +#if defined(TPF41) && defined(NSIG) #undef NSIG #endif #include -#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE) +#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF41) && !defined(NETWARE) && !defined(MPE) #include #endif diff --git a/src/include/scoreboard.h b/src/include/scoreboard.h index 30e5722b445..eaa79d213cf 100644 --- a/src/include/scoreboard.h +++ b/src/include/scoreboard.h @@ -21,11 +21,11 @@ extern "C" { #endif #ifndef WIN32 -#if defined(TPF) || defined(NETWARE) +#if defined(TPF41) || defined(NETWARE) #include #else #include -#endif /* TPF */ +#endif /* TPF41 || NETWARE */ #endif diff --git a/src/main/http_log.c b/src/main/http_log.c index e786dcfd829..0e87ccca651 100644 --- a/src/main/http_log.c +++ b/src/main/http_log.c @@ -318,7 +318,7 @@ static void log_error_core(const char *file, int line, int level, len += ap_snprintf(errstr + len, sizeof(errstr) - len, "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); -#ifndef TPF +#ifndef TPF41 if (file && (level & APLOG_LEVELMASK) == APLOG_DEBUG) { #ifdef _OSD_POSIX char tmp[256]; @@ -341,7 +341,7 @@ static void log_error_core(const char *file, int line, int level, len += ap_snprintf(errstr + len, sizeof(errstr) - len, "%s(%d): ", file, line); } -#endif /* TPF */ +#endif /* TPF41 */ if (r) { /* XXX: TODO: add a method of selecting whether logged client * addresses are in dotted quad or resolved form... dotted diff --git a/src/main/http_main.c b/src/main/http_main.c index 88ac34f9b43..0f7bcb0c5e3 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -5167,6 +5167,16 @@ static void process_child_status(int pid, ap_wait_t status) WEXITSTATUS(status) == APEXIT_CHILDFATAL) { /* cleanup pid file -- it is useless after our exiting */ const char *pidfile = NULL; +#ifdef TPF + /* safer on TPF to go through normal shutdown process */ + if (!shutdown_pending) { + ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf, + "Child %d returned a Fatal error... \n" + "Apache is shutting down!", pid); + shutdown_pending = 1; + } + return; +#endif pidfile = ap_server_root_relative (pconf, ap_pid_fname); if ( pidfile != NULL && unlink(pidfile) == 0) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, @@ -5651,7 +5661,7 @@ int REALMAIN(int argc, char *argv[]) memcpy(tpf_server_name, input_parms.parent.servname, INETD_SERVNAME_LENGTH); tpf_server_name[INETD_SERVNAME_LENGTH + 1] = '\0'; - sprintf(tpf_mutex_key, "%.*x", TPF_MUTEX_KEY_SIZE - 1, getpid()); + sprintf(tpf_mutex_key, "%.*x", (int) TPF_MUTEX_KEY_SIZE - 1, getpid()); tpf_parent_pid = getppid(); ap_open_logs(server_conf, plog); ap_tpf_zinet_checks(ap_standalone, tpf_server_name, server_conf); diff --git a/src/main/http_protocol.c b/src/main/http_protocol.c index 9c86708573a..19a62cdd272 100644 --- a/src/main/http_protocol.c +++ b/src/main/http_protocol.c @@ -2412,7 +2412,7 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) long total_bytes_sent = 0; register int n, w, o, len, fd; fd_set fds; -#ifdef TPF +#ifdef TPF_HAVE_NONSOCKET_SELECT struct timeval tv; #endif diff --git a/src/modules/proxy/mod_proxy.h b/src/modules/proxy/mod_proxy.h index 553174499fa..a3fea0ce40a 100644 --- a/src/modules/proxy/mod_proxy.h +++ b/src/modules/proxy/mod_proxy.h @@ -213,7 +213,11 @@ typedef struct { struct per_thread_data { struct hostent hpbuf; +#ifdef TPF + u_int ipaddr; +#else u_long ipaddr; +#endif char *charpbuf[2]; }; /* Function prototypes */ diff --git a/src/modules/standard/mod_usertrack.c b/src/modules/standard/mod_usertrack.c index af031479dd9..0711ea5dc98 100644 --- a/src/modules/standard/mod_usertrack.c +++ b/src/modules/standard/mod_usertrack.c @@ -53,7 +53,7 @@ #include "httpd.h" #include "http_config.h" #include "http_core.h" -#if !defined(WIN32) && !defined(MPE) && !defined(TPF) +#if !defined(WIN32) && !defined(MPE) && !defined(TPF41) #include #endif diff --git a/src/os/tpf/TPFExport b/src/os/tpf/TPFExport index 6cc580e593f..8453d02ee3c 100644 --- a/src/os/tpf/TPFExport +++ b/src/os/tpf/TPFExport @@ -1,8 +1,8 @@ #!/bin/sh -echo " Setting TPF/c89 environment variables" +echo " Setting TPF41/c89 environment variables" export _C89_CCMODE=1 -# replace the following with the location of your TPF include files -export _C89_INCDIRS="/u/tpf41/currentmaint/include" +# replace the following with the location of your TPF41 include files +export _C89_INCDIRS="/u/tpf41/rlse/include" export TPF=YES export _C89_INCLIBS="" export _C89_CSYSLIB="" diff --git a/src/os/tpf/cgetop.c b/src/os/tpf/cgetop.c index 90ffbce5f45..03356603d48 100644 --- a/src/os/tpf/cgetop.c +++ b/src/os/tpf/cgetop.c @@ -36,6 +36,8 @@ /* */ /**********************************************************************/ +/* used only on TPF41 systems */ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94"; #endif /* LIBC_SCCS and not lint */ @@ -148,4 +150,4 @@ getopt(nargc, nargv, ostr) ++optind; } return (optopt); /* dump back option letter */ -} \ No newline at end of file +} diff --git a/src/os/tpf/os.c b/src/os/tpf/os.c index 4131eb4f6b2..9c79e0f5163 100644 --- a/src/os/tpf/os.c +++ b/src/os/tpf/os.c @@ -24,11 +24,17 @@ #include "scoreboard.h" #include "http_log.h" #include "http_conf_globals.h" +#ifdef TPF41 #ifdef __PIPE_ #include #include static TPF_FD_LIST *tpf_fds = NULL; -#endif +#endif /* __PIPE_ */ +#else +#include +#include +static TPF_FD_LIST *tpf_fds = NULL; +#endif /* TPF41 */ void *tpf_shm_static_ptr = NULL; unsigned short zinet_model; @@ -162,13 +168,10 @@ int ap_tpf_spawn_child(pool *p, int (*func) (void *, child_info *), int out_fds[], int in_fds[], int err_fds[]) { - - int i, temp_out, temp_in, temp_err, save_errno, pid, result=0; - int fd_flags_out, fd_flags_in, fd_flags_err; + int i, temp_out=0, temp_in=0, temp_err=0, save_errno, pid, result=0; + int fd_flags_out=0, fd_flags_in=0, fd_flags_err=0; struct tpf_fork_input fork_input; TPF_FORK_CHILD *cld = (TPF_FORK_CHILD *) data; - array_header *env_arr = ap_table_elts ((array_header *) cld->subprocess_env); - table_entry *elts = (table_entry *) env_arr->elts; #ifdef TPF_FORK_EXTENDED #define WHITE " \t\n" #define MAXARGC 49 @@ -178,11 +181,13 @@ int ap_tpf_spawn_child(pool *p, int (*func) (void *, child_info *), pool *subpool = NULL; #include "util_script.h" - +#else + array_header *env_arr = ap_table_elts ((array_header *) cld->subprocess_env); + table_entry *elts = (table_entry *) env_arr->elts; #endif /* TPF_FORK_EXTENDED */ if (func) { - if (result=func(data, NULL)) { + if ((result=func(data, NULL))) { return 0; /* error from child function */ } } @@ -473,10 +478,10 @@ void os_tpf_child(APACHE_TPF_INPUT *input_parms) { tpf_fds = input_parms->tpf_fds; tpf_shm_static_ptr = input_parms->shm_static_ptr; tpf_parent_pid = getppid(); - sprintf(tpf_mutex_key, "%.*x", TPF_MUTEX_KEY_SIZE - 1, tpf_parent_pid); + sprintf(tpf_mutex_key, "%.*x", (int) TPF_MUTEX_KEY_SIZE - 1, tpf_parent_pid); } -#ifndef __PIPE_ +#if defined(TPF41) && !defined(__PIPE_) int pipe(int fildes[2]) { @@ -505,7 +510,7 @@ static void *ap_tpf_get_shared_mem(size_t size) { key_t shmkey = IPC_PRIVATE; int shmid = -1; - void *result; + static void *result; if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) { perror("shmget failed in ap_tpf_get_shared_mem function"); @@ -565,7 +570,7 @@ void ap_tpf_add_fd(pool *p, int fd, enum FILE_TYPE file_type, const char *fname) return; /* no kids allowed */ } if (tpf_fds == NULL) { - /* get shared memory if necssary */ + /* get shared memory if necessary */ tpf_fds = ap_tpf_get_shared_mem((size_t)TPF_FD_LIST_SIZE); if (tpf_fds) { ap_register_cleanup(p, (void *)&tpf_fds, @@ -636,7 +641,7 @@ API_EXPORT(piped_log *) ap_open_piped_log(pool *p, const char *program) return pl; } -#endif /* __PIPE_ */ +#endif /* TPF41 && ndef __PIPE_ */ /* The following functions are used for the tpf specific module called mod_tpf_shm_static. This module is a clone of Apache's mod_mmap_static. @@ -768,7 +773,7 @@ int i; #error "is no longer supported." #error "Replace with USE_SHMGET_SCOREBOARD to use" #error "shared memory or remove entirely to use" - #error "scoreboard on file for pre-PUT10 systems" + #error "scoreboard on file for pre-TPF41 PUT10 systems" #endif #ifdef TPF_FORK_EXTENDED diff --git a/src/os/tpf/os.h b/src/os/tpf/os.h index aee524fcec9..34fdfcf0cfb 100644 --- a/src/os/tpf/os.h +++ b/src/os/tpf/os.h @@ -23,9 +23,40 @@ */ #define PLATFORM "TPF" +#ifndef TPF +#define TPF 1 +#endif +#if !defined(TPF64BIT) && !defined(TPF41) +#define TPF41 +#endif + +/*---------------------------------------------------------------------*/ +#ifdef TPF64BIT +/*---------------------------------------------------------------------*/ +#define TPF_HAVE_NONSOCKET_SELECT +#define TPF_HAVE_SAWNC +#define HAVE_SYSLOG +#define TPF_HAVE_SIGACTION +#define HAVE_SYS_SELECT_H +#define HAVE_ISNAN +#define HAVE_ISINF +#define TPF_FORK_EXTENDED +#include +#include +#include +#include +#include +#include +#include +#include +#endif /* TPF64BIT */ + +/*---------------------------------------------------------------------*/ +#ifdef TPF41 +/*---------------------------------------------------------------------*/ /************************************************************************ - * PJ26895 provides support for non_socket_select. + * TPF41 PJ26895 provides support for non_socket_select. * You can determine if this apar is applied to your system by looking * at i$pwbl.h. If the function non_socket_select is defined, * then add #define TPF_HAVE_NONSOCKET_SELECT @@ -47,7 +78,7 @@ #endif /************************************************************************ - * PJ27387 or PJ26188 provides support for tpf_sawnc. + * TPF41 PJ27387 or PJ26188 provides support for tpf_sawnc. * You can determine if this apar is applied to your system by looking at * tpfapi.h or i$fsdd.h. If the function tpf_sawnc is defined, * then add #define TPF_HAVE_SAWNC @@ -75,19 +106,78 @@ #include #endif -/* If APAR PJ27277 (which shipped on PUT13) has been applied */ +/* If TPF41 APAR PJ27277 (which shipped on TPF41 PUT13) has been applied */ /* then we want to #define TPF_FORK_EXTENDED so Perl CGIs will work. */ /* Rather than hardcoding it we'll check for "environ" in stdlib.h, */ -/* which was also added by PJ27277. */ +/* which was also added by TPF41 PJ27277. */ #include #if defined(environ) && !defined(TPF_FORK_EXTENDED) #define TPF_FORK_EXTENDED #endif - +#define WUNTRACED 0 /* TPF41's waitpid() doesn't support WUNTRACED */ +#include +#include #include -#include "ap_config.h" +#include +#include +#include +#ifndef __strings_h +#define NEED_STRCASECMP +#define NEED_STRNCASECMP +#endif +#define NEED_STRDUP +#define NO_GETTIMEOFDAY +#ifndef _POSIX_SOURCE +#define _POSIX_SOURCE 1 +#endif +#ifndef USE_HSREGEX +#define USE_HSREGEX 1 +#endif +#include +#define crypt(buf,salt) ((char *)buf) +#undef offsetof +#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field)) + +#endif /* TPF41 */ + +/*---------------------------------------------------------------------*/ +/* common */ +/*---------------------------------------------------------------------*/ +#define AP_LONGEST_LONG long long +/* byte order of machine (12: little endian, 21: big endian) */ +#define AP_BYTE_ORDER 21 /* TPF is big endian */ +#define CHARSET_EBCDIC 1 +#define PRIMECRAS 0x010000 +#define JMP_BUF jmp_buf +#define HAVE_SHMGET +#define HAVE_SYS_PARAM_H +#define NEED_INITGROUPS +#define NEED_SIGNAL_INTERRUPT +#define NO_LINGCLOSE +#define NO_MMAP +#define NO_OTHER_CHILD +#define NO_PIPED_LOGS +#define NO_RELIABLE_PIPED_LOGS +#define NO_SETSID +#define NO_SLACK +#define NO_TIMES +#ifndef TPF_HAVE_SIGACTION +#define NO_USE_SIGACTION +#endif +#define USE_LONGJMP +#define USE_SHMGET_SCOREBOARD +#define USE_TPF_ACCEPT +#define HAVE_TPF_CORE_SERIALIZED_ACCEPT +#define USE_TPF_SELECT +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#define HAVE_UNISTD_H 1 +#ifndef NO_DL_NEEDED +#define NO_DL_NEEDED 1 +#endif -#define WUNTRACED 0 /* TPF's waitpid() doesn't support WUNTRACED */ +#include "ap_config.h" /* TPF_ACCEPT_SECS_TO_BLOCK is the number of seconds to block while waiting to accept a new request in the ap_accept/tpf_accept function */ @@ -95,14 +185,6 @@ #define TPF_ACCEPT_SECS_TO_BLOCK 1 #endif -#ifdef HAVE_ISNAN -#undef HAVE_ISNAN -#endif - -#ifdef HAVE_ISINF -#undef HAVE_ISINF -#endif - #if !defined(INLINE) && defined(USE_GNU_INLINE) /* Compiler supports inline, so include the inlineable functions as * part of the header @@ -123,7 +205,9 @@ extern int ap_os_is_path_absolute(const char *f); #define ap_os_is_filename_valid(f) (1) #define ap_os_kill(pid, sig) kill(pid, sig) -#include +/*---------------------------------------------------------------------*/ +#ifdef TPF41 +/*---------------------------------------------------------------------*/ #ifndef __strings_h #define FD_SETSIZE 2048 @@ -140,14 +224,19 @@ typedef struct fd_set { #define FD_CLR(n, p)((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p)((p)->fds_bits[(n)/NFDBITS] & (1 <<((n) % NFDBITS))) -#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) -#endif +#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) +#endif /* __strings_h */ #ifdef FD_SET #undef FD_SET #define FD_SET(n, p) (0) -#endif +#endif /* FD_SET */ +#endif /* TPF41 */ + +/*---------------------------------------------------------------------*/ +/* common */ +/*---------------------------------------------------------------------*/ #define TPF_MUTEX_KEY_SIZE (sizeof(pid_t)*2+1) /* TPF doesn't have, or need, tzset (it is used in mod_expires.c) */ @@ -171,7 +260,6 @@ typedef struct tpf_fd_list { TPF_FD_ITEM first_item; }TPF_FD_LIST; -#include typedef struct apache_input { void *scoreboard_heap; /* scoreboard system heap address */ int slot; /* child number */ @@ -180,12 +268,12 @@ typedef struct apache_input { time_t restart_time; TPF_FD_LIST *tpf_fds; /* fd inheritance table ptr */ void *shm_static_ptr; /* shm ptr for static pages */ -}APACHE_TPF_INPUT; +} APACHE_TPF_INPUT; typedef union ebw_area { INETD_SERVER_INPUT parent; APACHE_TPF_INPUT child; -}EBW_AREA; +} EBW_AREA; extern void *tpf_shm_static_ptr; /* mod_tpf_shm_static */ #define TPF_SHM_STATIC_SIZE 200000 @@ -196,7 +284,7 @@ typedef struct tpf_fork_child { char *filename; enum { FORK_NAME = 1, FORK_FILE = 2 } prog_type; void *subprocess_env; -}TPF_FORK_CHILD; +} TPF_FORK_CHILD; int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen); extern int tpf_child; @@ -212,13 +300,19 @@ char *getpass(const char *prompt); int killpg(pid_t pgrp, int sig); extern char *ap_server_argv0; #include -#ifndef SIGPIPE +#if defined(TPF41) && !defined(SIGPIPE) #define SIGPIPE 14 #endif -#ifdef NSIG +#if defined(TPF41) && defined(NSIG) #undef NSIG #endif void ap_tpf_save_argv(int argc, char **argv); +int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, + struct timeval *tv); +void os_tpf_child(APACHE_TPF_INPUT *input_parms); +#if defined(TPF64BIT) || defined(__PIPE_) +static void *ap_tpf_get_shared_mem(size_t size); +#endif /* various #defines for ServerType/ZINET model checks: */ diff --git a/src/os/tpf/samples/linkhttp.jcl b/src/os/tpf/samples/linkhttp.jcl index fa026c1318e..bafc62c1be3 100644 --- a/src/os/tpf/samples/linkhttp.jcl +++ b/src/os/tpf/samples/linkhttp.jcl @@ -1,4 +1,5 @@ //LINKHTTP JOB MSGLEVEL=(1,1),CLASS=S,MSGCLASS=S +//* SAMPLE JCL FOR LINKING APACHE ON TPF41 /*ROUTE PRINT /*ROUTE PUNCH /*NOTIFY diff --git a/src/os/tpf/samples/loadset.jcl b/src/os/tpf/samples/loadset.jcl index ed84b7452b6..ea74a2dfd01 100644 --- a/src/os/tpf/samples/loadset.jcl +++ b/src/os/tpf/samples/loadset.jcl @@ -1,4 +1,5 @@ //LOADSET JOB MSGLEVEL=1,CLASS=S,MSGCLASS=S +//* SAMPLE JCL TO BUILD AN APACHE LOADSET FOR TPF41 /*ROUTE PRINT /*ROUTE PUNCH //TLDR EXEC PGM=TPFLDR40,REGION=8M, diff --git a/src/os/tpf/samples/sample_env.txt b/src/os/tpf/samples/sample_env.txt new file mode 100644 index 00000000000..f3db0c9b34a --- /dev/null +++ b/src/os/tpf/samples/sample_env.txt @@ -0,0 +1,51 @@ +# Sample maketpf environment file for Apache + +####################################################################### +# Define the directories where the shared objects reside # +####################################################################### +ROOTLIBDIRS := $(foreach d,$(TPF_ROOT),$d/your_path/apache/lib) + +####################################################################### +# Define directories where the loadables (XXXXVV) are to be written # +####################################################################### +ROOTLOADDIRS := $(foreach d,$(TPF_ROOT),$d/your_path/load) + +####################################################################### +# Define location of the export files used by the LD postprocessor # +# The .exp files will live in lib directory # +####################################################################### +ROOTEXPDIRS := $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/exp) + +####################################################################### +# Define the object file directory name # +####################################################################### +ROOTOBJDIRS := $(foreach d,$(TPF_ROOT),$d/your_path/apache/obj) + +####################################################################### +# Define the listing files directory name # +####################################################################### +ROOTLSTDIRS := $(foreach d,$(TPF_ROOT),$d/your_path/apache/lst) + +####################################################################### +# Set the include/header file directories # +####################################################################### +ROOTINCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/include) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/proxy) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/standard) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/os/tpf) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/regex) + +####################################################################### +# Set the C file directories # +####################################################################### +ROOTCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/ap) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/main) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/example) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/extra) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/experimental) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/proxy) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/modules/standard) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/os/tpf) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/regex) +ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/your_path/apache/src/support) diff --git a/src/os/tpf/samples/sample_mak.txt b/src/os/tpf/samples/sample_mak.txt new file mode 100644 index 00000000000..fe62c80c66b --- /dev/null +++ b/src/os/tpf/samples/sample_mak.txt @@ -0,0 +1,72 @@ +# Sample .mak file for Apache + +####################################################################### +# Define shared object name # +####################################################################### +APP := CHTA +APP_ENTRY := main + +####################################################################### +# External LIB References # +####################################################################### +# Apache needs the Internet Daemon / ZINET (CLTY) +LIBS := CLTY + +####################################################################### +# Environments needed for build # +####################################################################### +maketpf_env := apache +maketpf_env += base_rt +maketpf_env += system + +CFLAGS_CHTA := -fPIC +CFLAGS_CHTA += -w +CFLAGS_CHTA += -DTPF +CFLAGS_CHTA += -DTPF64BIT + +####################################################################### +# C programs to be compiled # +####################################################################### +C_SRC := buildmark.c +C_SRC += modules.c +C_SRC += ap_base64.c +C_SRC += ap_checkpass.c +C_SRC += ap_cpystrn.c +C_SRC += ap_ebcdic.c +C_SRC += ap_execve.c +C_SRC += ap_fnmatch.c +C_SRC += ap_getpass.c +C_SRC += ap_md5c.c +C_SRC += ap_sha1.c +C_SRC += ap_signal.c +C_SRC += ap_slack.c +C_SRC += ap_snprintf.c +C_SRC += ap_strtol.c +C_SRC += alloc.c +C_SRC += buff.c +C_SRC += http_config.c +C_SRC += http_core.c +C_SRC += http_log.c +C_SRC += http_main.c +C_SRC += http_protocol.c +C_SRC += http_request.c +C_SRC += http_vhost.c +C_SRC += rfc1413.c +C_SRC += util.c +C_SRC += util_date.c +C_SRC += util_md5.c +C_SRC += util_script.c +C_SRC += util_uri.c +C_SRC += os.c +C_SRC += os-inline.c + +APACHE_MODULE_FILE := $(word 1,$(foreach d,$(TPF_ROOT),$(wildcard $d/your_path/apache/src/apache.modules))) +ifeq ("$(APACHE_MODULE_FILE)","") +$(error $(MTPF0045E)) +endif +C_SRC += $(shell cat $(APACHE_MODULE_FILE)) + +####################################################################### +# Include maketpf build rules # +####################################################################### +include maketpf.rules diff --git a/src/os/tpf/samples/test_char.txt b/src/os/tpf/samples/test_char.txt new file mode 100644 index 00000000000..44b13441f08 --- /dev/null +++ b/src/os/tpf/samples/test_char.txt @@ -0,0 +1,43 @@ +/* this file is automatically generated by gen_test_char, do not edit */ +#define T_ESCAPE_SHELL_CMD 0x01 /* chars with special meaning in the shell */ +#define T_ESCAPE_PATH_SEGMENT 0x02 /* find path segment, as defined in RFC1808 */ +#define T_OS_ESCAPE_PATH 0x04 /* escape characters in a path or uri */ +#define T_HTTP_TOKEN_STOP 0x08 /* find http tokens, as defined in RFC2616 */ +#define T_ESCAPE_LOGITEM 0x10 /* filter what should go in the log file */ +#define T_ESCAPE_FORENSIC 0x20 /* filter what should go in the forensic log */ + +static const unsigned char test_char_table[256] = { + 0x20, 0x3e, 0x3e, 0x3e, 0x36, 0x3e, 0x36, 0x3e, /*0x00...0x07*/ + 0x36, 0x36, 0x36, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, /*0x08...0x0f*/ + 0x3e, 0x3e, 0x3e, 0x3e, 0x36, 0x3f, 0x3e, 0x36, /*0x10...0x17*/ + 0x3e, 0x3e, 0x36, 0x36, 0x3e, 0x3e, 0x3e, 0x3e, /*0x18...0x1f*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3e, 0x3e, /*0x20...0x27*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x3e, 0x3e, 0x3e, /*0x28...0x2f*/ + 0x36, 0x36, 0x3e, 0x36, 0x36, 0x36, 0x36, 0x3e, /*0x30...0x37*/ + 0x36, 0x36, 0x36, 0x36, 0x3e, 0x3e, 0x36, 0x3e, /*0x38...0x3f*/ + 0x0e, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x40...0x47*/ + 0x36, 0x36, 0x36, 0x00, 0x0f, 0x09, 0x00, 0x27, /*0x48...0x4f*/ + 0x01, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x50...0x57*/ + 0x36, 0x36, 0x00, 0x01, 0x01, 0x09, 0x0f, 0x07, /*0x58...0x5f*/ + 0x00, 0x0a, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x60...0x67*/ + 0x36, 0x36, 0x36, 0x08, 0x26, 0x00, 0x0f, 0x0f, /*0x68...0x6f*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x70...0x77*/ + 0x36, 0x07, 0x28, 0x06, 0x08, 0x01, 0x08, 0x17, /*0x78...0x7f*/ + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x80...0x87*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x88...0x8f*/ + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x90...0x97*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x98...0x9f*/ + 0x36, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa0...0xa7*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x0f, 0x36, 0x36, /*0xa8...0xaf*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xb0...0xb7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x0f, 0x36, 0x36, /*0xb8...0xbf*/ + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc0...0xc7*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xc8...0xcf*/ + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd0...0xd7*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xd8...0xdf*/ + 0x1f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe0...0xe7*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xe8...0xef*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf0...0xf7*/ + 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 /*0xf8...0xff*/ + +}; diff --git a/src/os/tpf/samples/uri_delims.txt b/src/os/tpf/samples/uri_delims.txt new file mode 100644 index 00000000000..cadfef47b1f --- /dev/null +++ b/src/os/tpf/samples/uri_delims.txt @@ -0,0 +1,16 @@ +/* this file is automatically generated by gen_uri_delims, do not edit */ +static const unsigned char uri_delims[256] = { + T_NUL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T_SLASH,0,0, + 0,0,0,0,0,0,0,0,0,0,0,T_QUESTION,0,0,0,0,0,0,0,0, + 0,0,T_COLON,T_HASH,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +};