summaryrefslogtreecommitdiff
path: root/APACHE_1_3_42/src/os/tpf
diff options
context:
space:
mode:
Diffstat (limited to 'APACHE_1_3_42/src/os/tpf')
-rw-r--r--APACHE_1_3_42/src/os/tpf/Makefile.tmpl41
-rw-r--r--APACHE_1_3_42/src/os/tpf/TPFExport10
-rw-r--r--APACHE_1_3_42/src/os/tpf/cgetop.c153
-rw-r--r--APACHE_1_3_42/src/os/tpf/ebcdic.h22
-rw-r--r--APACHE_1_3_42/src/os/tpf/os-inline.c47
-rw-r--r--APACHE_1_3_42/src/os/tpf/os.c860
-rw-r--r--APACHE_1_3_42/src/os/tpf/os.h358
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/linkhttp.dlm66
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/linkhttp.jcl147
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/loadset.jcl42
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/sample_env.txt51
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/sample_mak.txt72
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/test_char.txt43
-rw-r--r--APACHE_1_3_42/src/os/tpf/samples/uri_delims.txt16
14 files changed, 1928 insertions, 0 deletions
diff --git a/APACHE_1_3_42/src/os/tpf/Makefile.tmpl b/APACHE_1_3_42/src/os/tpf/Makefile.tmpl
new file mode 100644
index 0000000000..719f603bda
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/Makefile.tmpl
@@ -0,0 +1,41 @@
+CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
+LIBS=$(EXTRA_LIBS) $(LIBS1)
+INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
+LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+
+OBJS= os.o os-inline.o cgetop.o
+
+LIB= libos.a
+
+all: $(LIB)
+
+$(LIB): $(OBJS)
+ rm -f $@
+ ar cr $@ $(OBJS)
+ $(RANLIB) $@
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
+
+clean:
+ rm -f $(OBJS) $(LIB)
+
+distclean: clean
+ -rm -f Makefile
+
+# We really don't expect end users to use this rule. It works only with
+# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
+# using it.
+depend:
+ cp Makefile.tmpl Makefile.tmpl.bak \
+ && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
+ && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
+ && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
+ > Makefile.tmpl \
+ && rm Makefile.new
+
+$(OBJS): Makefile
+os.o: os.c os-inline.c $(INCDIR)/ap_config.h
+cgetop.o: cgetop.c
+# DO NOT REMOVE
+os.o: os.c
diff --git a/APACHE_1_3_42/src/os/tpf/TPFExport b/APACHE_1_3_42/src/os/tpf/TPFExport
new file mode 100644
index 0000000000..8453d02ee3
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/TPFExport
@@ -0,0 +1,10 @@
+#!/bin/sh
+echo " Setting TPF41/c89 environment variables"
+export _C89_CCMODE=1
+# 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=""
+export _C89_OPTIONS="-W 0,langlvl(extended)"
+echo "Done"
diff --git a/APACHE_1_3_42/src/os/tpf/cgetop.c b/APACHE_1_3_42/src/os/tpf/cgetop.c
new file mode 100644
index 0000000000..03356603d4
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/cgetop.c
@@ -0,0 +1,153 @@
+/**********************************************************************/
+/* */
+/* Copyright (c) 1987, 1993, 1994 */
+/* The Regents of the University of California. All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* 3. All advertising materials mentioning features or use of this */
+/* software must display the following acknowledgement: */
+/* This product includes software developed by the University of */
+/* California, Berkeley and its contributors. */
+/* 4. Neither the name of the University nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''*/
+/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
+/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
+/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF */
+/* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND*/
+/* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
+/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF */
+/* SUCH DAMAGE. */
+/* */
+/**********************************************************************/
+
+/* 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 */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __CGETOP_
+extern char *optarg;
+extern int opterr, optind, optopt;
+int getopt (int, char * const *, const char *);
+char *group_from_gid (unsigned long, int);
+char *user_from_uid (unsigned long, int);
+extern int optreset;
+#endif
+
+int opterr = 1, /* if error message should be */
+ /* printed */
+ optind = 1, /* index into parent argv vector */
+ optopt, /* character checked for validity */
+ optreset; /* reset getopt */
+char *optarg; /* argument associated with */
+ /* option */
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/**********************************************************************/
+/* */
+/* getopt -- */
+/* Parse argc/argv argument vector. */
+/* */
+/**********************************************************************/
+int
+getopt(nargc, nargv, ostr)
+ int nargc;
+ char * const *nargv;
+ const char *ostr;
+{
+ /* removed -- BSD2TPF -- crt0 does not create __progname on TPF */
+ /* extern char *__progname; */
+ /* end of removed -- BSD2TPF */
+
+ static char *place = EMSG; /* option letter processing */
+ char *oli; /* option letter list index */
+
+ /* added -- BSD2TPF -- emulate BSD crt0 function to set __progname */
+ char empty = '\0';
+ char *__progname = &empty;
+ if (nargv[0]) {
+ if ((__progname = strrchr(nargv[0], '/')) == NULL) {
+ __progname = nargv[0];
+ }
+ else {
+ ++__progname;
+ }
+ }
+ /* end of added -- BSD2TPF */
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (EOF);
+ }
+ if (place[1] && *++place == '-') {
+ /* found "--" */
+ ++optind;
+ place = EMSG;
+ return (EOF);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /* if the user didn't */
+ /* specify '-' as an option, */
+ /* assume it means EOF. */
+ if (optopt == (int)'-')
+ return (EOF);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)fprintf(stderr,
+ "%s: illegal option -- %c\n", __progname, optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ }
+ else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if (*ostr == ':')
+ return (BADARG);
+ if (opterr)
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n",
+ __progname, optopt);
+ return (BADCH);
+ }
+ else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
diff --git a/APACHE_1_3_42/src/os/tpf/ebcdic.h b/APACHE_1_3_42/src/os/tpf/ebcdic.h
new file mode 100644
index 0000000000..c495eba165
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/ebcdic.h
@@ -0,0 +1,22 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EBCDIC_H
+#define EBCDIC_H "$Id$"
+
+#include <ap_ebcdic.h>
+
+#endif /*EBCDIC_H*/
diff --git a/APACHE_1_3_42/src/os/tpf/os-inline.c b/APACHE_1_3_42/src/os/tpf/os-inline.c
new file mode 100644
index 0000000000..efd915d4cf
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/os-inline.c
@@ -0,0 +1,47 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file contains functions which can be inlined if the compiler
+ * has an "inline" modifier. Because of this, this file is both a
+ * header file and a compilable module.
+ *
+ * Only inlineable functions should be defined in here. They must all
+ * include the INLINE modifier.
+ *
+ * If the compiler supports inline, this file will be #included as a
+ * header file from os.h to create all the inline function
+ * definitions. INLINE will be defined to whatever is required on
+ * function definitions to make them inline declarations.
+ *
+ * If the compiler does not support inline, this file will be compiled
+ * as a normal C file into libos.a (along with os.c). In this case
+ * INLINE will _not_ be set so we can use this to test if we are
+ * compiling this source file.
+ */
+
+#ifndef INLINE
+#define INLINE
+
+/* Anything required only when compiling */
+#include "ap_config.h"
+
+#endif
+
+INLINE int ap_os_is_path_absolute(const char *file)
+{
+ return (file && file[0] == '/' ? 1 : 0);
+}
diff --git a/APACHE_1_3_42/src/os/tpf/os.c b/APACHE_1_3_42/src/os/tpf/os.c
new file mode 100644
index 0000000000..015b95f4f0
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/os.c
@@ -0,0 +1,860 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file will include OS specific functions which are not inlineable.
+ * Any inlineable functions should be defined in os-inline.c instead.
+ */
+
+#include "httpd.h"
+#include "http_core.h"
+#include "os.h"
+#include "scoreboard.h"
+#include "http_log.h"
+#include "http_conf_globals.h"
+#ifdef TPF41
+#ifdef __PIPE_
+#include <ipc.h>
+#include <shm.h>
+static TPF_FD_LIST *tpf_fds = NULL;
+#endif /* __PIPE_ */
+#else
+#include <sys/ipc.h>
+#include <sys/shm.h>
+static TPF_FD_LIST *tpf_fds = NULL;
+#endif /* TPF41 */
+
+void *tpf_shm_static_ptr = NULL;
+unsigned short zinet_model;
+char *argv_ptr = NULL;
+
+static FILE *sock_fp;
+static int sock_sd;
+
+int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts,
+ struct timeval *tv)
+{
+/* We're going to force our way through select. We're only interested reads
+ and TPF allows 2billion+ socket descriptors for we don't want an fd_set
+ that big. Just assume that maxfds-1 contains the socket descriptor we're
+ interested in. If it's 0, leave it alone. */
+
+ int sockets[1];
+ int no_reads = 0;
+ int no_writes = 0;
+ int no_excepts = 0;
+ int timeout_seconds = 0;
+ int timeout_millisec = 0;
+ int rv = 0;
+
+ if(maxfds) {
+ if(tv)
+ timeout_millisec = tv->tv_sec * 1000 + tv->tv_usec;
+ sockets[0] = maxfds-1;
+ no_reads++;
+ }
+ else
+ sockets[0] = 0;
+
+ ap_check_signals();
+ if ((no_reads + no_writes + no_excepts == 0) &&
+ (tv) && (tv->tv_sec + tv->tv_usec != 0)) {
+ /* TPF's select immediately returns if the sum of
+ no_reads, no_writes, and no_excepts is zero.
+ The following code makes TPF's select work a little closer
+ to everyone else's select:
+ */
+#ifdef TPF_HAVE_SAWNC
+ struct ev0bk evnblock;
+#endif
+ /* event processing uses seconds, select uses milliseconds */
+ timeout_seconds = tv->tv_sec;
+ if (tv->tv_usec) {
+ timeout_seconds++; /* round up to seconds (like TPF's select does) */
+ }
+ if (timeout_seconds > 0) { /* paranoid check for valid timeout */
+#ifdef TPF_HAVE_SAWNC
+ evnblock.evnpstinf.evnbkc1 = 1; /* nbr of posts needed */
+ evntc(&evnblock, EVENT_CNT, 'N', timeout_seconds, EVNTC_1052);
+ tpf_sawnc(&evnblock, EVENT_CNT);
+#else
+ sleep(timeout_seconds);
+#endif
+ }
+ } else {
+ if (timeout_millisec < 0) { /* paranoid check for valid timeout */
+ timeout_millisec = 0;
+ }
+ if (timeout_millisec != 0)
+ timeout_millisec += 1000;
+
+ rv = select(sockets, no_reads, no_writes, no_excepts, timeout_millisec);
+ }
+ ap_check_signals();
+
+ return rv;
+
+}
+
+int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen)
+{
+ extern pid_t tpf_parent_pid;
+ int socks[1];
+ int rv;
+
+ socks[0] = sockfd;
+ rv = select(socks, 1, 0, 0, 1 * 1000);
+ ap_check_signals();
+ if ((rv == 0) && (errno == 0)) {
+ /* select timed out */
+ errno = EINTR; /* make errno look like accept was interruped */
+ /* now's a good time to make sure our parent didn't abnormally exit */
+ if (getppid() == 1) {
+ /* our parent is gone... close the socket so Apache can restart
+ (it shouldn't still be open but we're taking no chances) */
+ closesocket(sockfd);
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, NULL,
+ "child %d closing the socket because getppid()"
+ " returned 1 instead of parent pid %d",
+ getpid(), tpf_parent_pid);
+ errno = 0;
+ }
+ return -1;
+ }
+ /* paranoid check for rv == 0 and errno != 0, should never happen */
+ if (rv == 0) {
+ rv = -1;
+ }
+
+ if(rv>0) {
+ rv = accept(sockfd, peer, paddrlen);
+ errno = sock_errno();
+ }
+ return rv;
+}
+
+/* the getpass function is not usable on TPF */
+char *getpass(const char* prompt)
+{
+ errno = EIO;
+ return((char *)NULL);
+}
+
+/* fork and exec functions are not defined on
+ TPF due to the implementation of tpf_fork() */
+
+pid_t fork(void)
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+int execl(const char *path, const char *arg0, ...)
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+int execle(const char *path, const char *arg0, ...)
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+int execve(const char *path, char *const argv[], char *const envp[])
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+int execvp(const char *file, char *const argv[])
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+
+
+int ap_tpf_spawn_child(pool *p, int (*func) (void *, child_info *),
+ void *data, enum kill_conditions kill_how,
+ int *pipe_in, int *pipe_out, int *pipe_err,
+ int out_fds[], int in_fds[], int err_fds[])
+
+{
+ 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;
+#ifdef TPF_FORK_EXTENDED
+#define WHITE " \t\n"
+#define MAXARGC 49
+ char *arguments;
+ char *args[MAXARGC + 1];
+ char **envp = NULL;
+ 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))) {
+ return 0; /* error from child function */
+ }
+ }
+
+ if (pipe_out) {
+ fd_flags_out = fcntl(out_fds[0], F_GETFD);
+ fcntl(out_fds[0], F_SETFD, FD_CLOEXEC);
+ temp_out = dup(STDOUT_FILENO);
+ fcntl(temp_out, F_SETFD, FD_CLOEXEC);
+ dup2(out_fds[1], STDOUT_FILENO);
+ }
+
+ if (pipe_in) {
+ fd_flags_in = fcntl(in_fds[1], F_GETFD);
+ fcntl(in_fds[1], F_SETFD, FD_CLOEXEC);
+ temp_in = dup(STDIN_FILENO);
+ fcntl(temp_in, F_SETFD, FD_CLOEXEC);
+ dup2(in_fds[0], STDIN_FILENO);
+ }
+
+ if (pipe_err) {
+ fd_flags_err = fcntl(err_fds[0], F_GETFD);
+ fcntl(err_fds[0], F_SETFD, FD_CLOEXEC);
+ temp_err = dup(STDERR_FILENO);
+ fcntl(temp_err, F_SETFD, FD_CLOEXEC);
+ dup2(err_fds[1], STDERR_FILENO);
+ }
+
+/* set up environment variables for the tpf_fork */
+ if (cld->subprocess_env) {
+#ifdef TPF_FORK_EXTENDED
+ /* with extended tpf_fork( ) we pass the pointer to a list of pointers */
+ /* that point to "key=value" strings for each env variable */
+ subpool = ap_make_sub_pool(p);
+ envp = ap_create_environment(subpool, cld->subprocess_env);
+#else
+ /* without extended tpf_fork( ) we setenv( ) each env variable */
+ /* so the child inherits them */
+ for (i = 0; i < env_arr->nelts; ++i) {
+ if (!elts[i].key)
+ continue;
+ setenv (elts[i].key, elts[i].val, 1);
+ }
+#endif /* TPF_FORK_EXTENDED */
+ }
+
+ fork_input.program = (const char*) cld->filename;
+ fork_input.prog_type = cld->prog_type;
+ fork_input.istream = TPF_FORK_IS_BALANCE;
+ fork_input.ebw_data_length = 0;
+ fork_input.ebw_data = NULL;
+ fork_input.parm_data = NULL;
+
+#ifdef TPF_FORK_EXTENDED
+ /* use a copy of cld->filename because strtok is destructive */
+ arguments = ap_pstrdup(p, cld->filename);
+ args[0] = strtok(arguments, WHITE);
+
+ for (i = 0; i < MAXARGC && args[i] ; i++) {
+ args[i + 1] = strtok(NULL, WHITE);
+ }
+ args[MAXARGC] = NULL;
+
+ if ((pid = tpf_fork(&fork_input,
+ (const char **)args,
+ (const char **)envp)) < 0) {
+#else
+ if ((pid = tpf_fork(&fork_input)) < 0) {
+#endif /* TPF_FORK_EXTENDED */
+ save_errno = errno;
+ if (pipe_out) {
+ close(out_fds[0]);
+ }
+ if (pipe_in) {
+ close(in_fds[1]);
+ }
+ if (pipe_err) {
+ close(err_fds[0]);
+ }
+ errno = save_errno;
+ pid = 0;
+ }
+
+#ifdef TPF_FORK_EXTENDED
+ if (subpool) {
+ ap_destroy_pool(subpool);
+ }
+#else
+ if (cld->subprocess_env) {
+ for (i = 0; i < env_arr->nelts; ++i) {
+ if (!elts[i].key)
+ continue;
+ unsetenv (elts[i].key);
+ }
+ }
+#endif /* TPF_FORK_EXTENDED */
+
+ if (pipe_out) {
+ close(out_fds[1]);
+ dup2(temp_out, STDOUT_FILENO);
+ close(temp_out);
+ fcntl(out_fds[0], F_SETFD, fd_flags_out);
+ }
+
+ if (pipe_in) {
+ close(in_fds[0]);
+ dup2(temp_in, STDIN_FILENO);
+ close(temp_in);
+ fcntl(in_fds[1], F_SETFD, fd_flags_in);
+ }
+
+
+ if (pipe_err) {
+ close(err_fds[1]);
+ dup2(temp_err, STDERR_FILENO);
+ close(temp_err);
+ fcntl(err_fds[0], F_SETFD, fd_flags_err);
+ }
+
+
+ if (pid) {
+
+ ap_note_subprocess(p, pid, kill_how);
+
+ if (pipe_out) {
+ *pipe_out = out_fds[0];
+ }
+ if (pipe_in) {
+ *pipe_in = in_fds[1];
+ }
+ if (pipe_err) {
+ *pipe_err = err_fds[0];
+ }
+ }
+
+ return pid;
+
+}
+
+pid_t os_fork(server_rec *s, int slot)
+{
+ struct tpf_fork_input fork_input;
+ APACHE_TPF_INPUT input_parms;
+ int count;
+ listen_rec *lr;
+
+ input_parms.generation = ap_my_generation;
+#ifdef USE_SHMGET_SCOREBOARD
+ input_parms.scoreboard_heap = ap_scoreboard_image;
+#endif
+
+ lr = ap_listeners;
+ count = 0;
+ do {
+ input_parms.listeners[count] = lr->fd;
+ lr = lr->next;
+ count++;
+ } while(lr != ap_listeners);
+
+ input_parms.slot = slot;
+ input_parms.restart_time = ap_restart_time;
+ input_parms.shm_static_ptr = tpf_shm_static_ptr;
+ input_parms.tpf_fds = tpf_fds;
+ fork_input.ebw_data = &input_parms;
+ fork_input.program = ap_server_argv0;
+ fork_input.prog_type = TPF_FORK_NAME;
+ fork_input.istream = TPF_FORK_IS_BALANCE;
+ fork_input.ebw_data_length = sizeof(input_parms);
+ fork_input.parm_data = argv_ptr;
+#ifdef TPF_FORK_EXTENDED
+ return tpf_fork(&fork_input, NULL, NULL);
+#else
+ return tpf_fork(&fork_input);
+#endif /* TPF_FORK_EXTENDED */
+}
+
+void ap_tpf_zinet_checks(int standalone,
+ const char *servername,
+ server_rec *s) {
+
+ INETD_IDCT_ENTRY_PTR idct;
+
+ /* explicitly disallow "ServerType inetd" on TPF */
+ if (!standalone) {
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
+ TPF_SERVERTYPE_MSG);
+ exit(1); /* abort start-up of server */
+ }
+
+ /* figure out zinet model for our server from the idct slot */
+ idct = inetd_getServer(servername);
+ if (idct) {
+ zinet_model = idct->model;
+ free(idct);
+ } else {
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
+ TPF_UNABLE_TO_DETERMINE_ZINET_MODEL, servername);
+ exit(1); /* abort start-up of server */
+ }
+
+ /* check for valid zinet models */
+ if (zinet_model != INETD_IDCF_MODEL_DAEMON &&
+ zinet_model != INETD_IDCF_MODEL_NOLISTEN) {
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
+ TPF_STANDALONE_CONFLICT_MSG);
+ exit(1); /* abort start-up of server */
+ }
+
+#ifdef TPF_NOLISTEN_WARNING
+/* nag about switching to DAEMON model */
+ if (zinet_model == INETD_IDCF_MODEL_NOLISTEN) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, s,
+ TPF_NOLISTEN_WARNING);
+ }
+#endif
+
+}
+
+int os_check_server(char *server) {
+ int *current_acn;
+
+ ap_check_signals();
+
+ /* check our InetD status */
+ if (inetd_getServerStatus(server) != INETD_SERVER_STATUS_ACTIVE) {
+ return 1; /* shutdown */
+ }
+
+ /* if DAEMON model, make sure CLTZ parent is still around */
+ if (zinet_model == INETD_IDCF_MODEL_DAEMON) {
+ if (getppid() == 1) {
+ return 1; /* shutdown */
+ }
+ } else {
+ /* this is the NOLISTEN model (INETD_IDCF_MODEL_NOLISTEN) */
+ /* check that the program activation number hasn't changed */
+ current_acn = (int *)cinfc_fast(CINFC_CMMACNUM);
+ if (ecbp2()->ce2acn != *current_acn) {
+ return 1; /* shutdown */
+ }
+ }
+
+ return 0; /* keep on running... */
+}
+
+void os_note_additional_cleanups(pool *p, int sd) {
+ char sockfilename[50];
+ /* write the socket to file so that TPF socket device driver
+ will close socket in case we happen to abend. */
+ sprintf(sockfilename, "/dev/tpf.socket.file/%.8X", sd);
+ sock_fp = fopen(sockfilename, "r+");
+ /* we don't want the children to inherit this fd */
+ fcntl(fileno(sock_fp), F_SETFD, FD_CLOEXEC);
+ sock_sd = sd;
+}
+
+void ap_tpf_save_argv(int argc, char **argv) {
+
+ int i, len = 3; /* 3 for "-x " */
+
+ for (i = 1; i < argc; i++) { /* find len for calloc */
+ len += strlen (argv[i]);
+ ++len; /* 1 for blank */
+ }
+
+ argv_ptr = malloc(len + 1);
+ strcpy(argv_ptr, "-x");
+ for (i = 1; i < argc; i++) {
+ strcat(argv_ptr, " ");
+ strcat(argv_ptr, argv[i]);
+ }
+}
+
+void os_tpf_child(APACHE_TPF_INPUT *input_parms) {
+ extern pid_t tpf_parent_pid;
+ extern char tpf_mutex_key[TPF_MUTEX_KEY_SIZE];
+
+ tpf_child = 1;
+ ap_my_generation = input_parms->generation;
+ ap_restart_time = input_parms->restart_time;
+ tpf_fds = input_parms->tpf_fds;
+ tpf_shm_static_ptr = input_parms->shm_static_ptr;
+ tpf_parent_pid = getppid();
+ sprintf(tpf_mutex_key, "%.*x", (int) TPF_MUTEX_KEY_SIZE - 1, tpf_parent_pid);
+}
+
+#if defined(TPF41) && !defined(__PIPE_)
+
+int pipe(int fildes[2])
+{
+ errno = ENOSYS;
+ return(-1);
+}
+
+API_EXPORT(piped_log *) ap_open_piped_log(pool *p, const char *program)
+
+{
+ fprintf(stderr, "Pipes not supported on this TPF system\n");
+ exit (1);
+}
+
+#else
+
+void ap_tpf_detach_shared_mem(void *address)
+{
+ if (*((void **)address)) {
+ shmdt(*((void **)address));
+ *((void **)address) = NULL;
+ }
+}
+
+static void *ap_tpf_get_shared_mem(size_t size)
+{
+ key_t shmkey = IPC_PRIVATE;
+ int shmid = -1;
+ 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");
+ exit(1);
+ }
+#define BADSHMAT ((void *)(-1))
+ if ((result = shmat(shmid, 0, 0)) == BADSHMAT) {
+ perror("shmat failed in ap_tpf_get_shared_mem");
+ }
+ if (shmctl(shmid, IPC_RMID, NULL) != 0) {
+ perror("shmctl(IPC_RMID) failed in ap_tpf_get_shared_mem");
+ }
+ if (result == BADSHMAT) { /* now bailout */
+ exit(1);
+ }
+
+ return result;
+}
+
+int ap_tpf_fd_lookup(enum FILE_TYPE file_type, const char *fname)
+/* lookup a fd in the fd inheritance table */
+{
+ if (tpf_fds) {
+ int i;
+ TPF_FD_ITEM *fd_item = &tpf_fds->first_item;
+
+ for (i = 1; i <= tpf_fds->nbr_of_items; i++, fd_item++) {
+ /* check for an fd with the same type and name */
+ if ((file_type == fd_item->file_type) &&
+ (strcmp(fname, fd_item->fname) == 0) ) {
+ /* we've got a match, check that fd is still open */
+ struct stat stbuf;
+
+ if (fstat(fd_item->fd, &stbuf) == 0) {
+ return(fd_item->fd);
+ }
+ else {
+ /* fd is not open - the entire fd table is suspect */
+ fprintf(stderr, "fstat failed in ap_tpf_fd_lookup "
+ "for fd %i (filename/pipe to %s): %s\n",
+ fd_item->fd, fname, strerror(errno));
+ ap_tpf_detach_shared_mem(&tpf_fds);
+ return(-1);
+ }
+ }
+ }
+ }
+ return(-1);
+}
+
+void ap_tpf_add_fd(pool *p, int fd, enum FILE_TYPE file_type, const char *fname)
+/* add a newly opened fd to the fd inheritance table */
+{
+ int fname_size;
+
+ if (tpf_child) {
+ return; /* no kids allowed */
+ }
+ if (tpf_fds == NULL) {
+ /* 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,
+ ap_tpf_detach_shared_mem, ap_null_cleanup);
+ tpf_fds->nbr_of_items = 0;
+ tpf_fds->next_avail_byte = &tpf_fds->first_item;
+ tpf_fds->last_avail_byte = (char *)tpf_fds + TPF_FD_LIST_SIZE;
+ }
+ }
+ /* add fd */
+ if (tpf_fds) {
+ TPF_FD_ITEM *fd_item;
+
+ /* make sure there's room */
+ fname_size = strlen(fname) + 1;
+ if (sizeof(TPF_FD_ITEM) + fname_size >
+ (char *)tpf_fds->last_avail_byte -
+ (char *)tpf_fds->next_avail_byte) {
+ fprintf(stderr, "fd inheritance table out of room, increase "
+ "TPF_FD_LIST_SIZE in os.h and recompile Apache\n");
+ exit(1);
+ }
+ /* add the new item */
+ fd_item = tpf_fds->next_avail_byte;
+ tpf_fds->next_avail_byte = fd_item + 1;
+ tpf_fds->last_avail_byte
+ = (char *)tpf_fds->last_avail_byte - fname_size;
+ fd_item->fname = tpf_fds->last_avail_byte;
+ strcpy(fd_item->fname, fname);
+ fd_item->fd = fd;
+ fd_item->file_type = file_type;
+ tpf_fds->nbr_of_items++;
+ }
+}
+
+API_EXPORT(piped_log *) ap_open_piped_log(pool *p, const char *program)
+{
+ int log_fd;
+ piped_log *pl;
+
+ /* check fd inheritance table to see if this log is already open */
+ log_fd = ap_tpf_fd_lookup(PIPE_OUT, program);
+ if (log_fd < 0) {
+ /* this is a new log - open it */
+ FILE *dummy;
+ TPF_FORK_CHILD cld;
+ cld.filename = (char *)program;
+ cld.subprocess_env = NULL;
+ cld.prog_type = FORK_NAME;
+
+ if (ap_spawn_child(p, NULL, &cld, kill_after_timeout,
+ &dummy, NULL, NULL)) {
+ log_fd = fileno(dummy);
+ /* add this log to the fd inheritance table */
+ ap_tpf_add_fd(p, log_fd, PIPE_OUT, program);
+ }
+ else {
+ perror("ap_spawn_child");
+ fprintf(stderr, "Couldn't fork child for piped log process\n");
+ exit (1);
+ }
+ }
+
+ pl = ap_palloc(p, sizeof (*pl));
+ pl->p = p;
+ pl->fds[1] = log_fd;
+
+ return pl;
+}
+
+#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.
+ Because TPF doesn't support the system call mmap(), it is replaced by
+ shared memory, but uses the mmap directives, etc. */
+
+union align{
+
+ /* Types which are likely to have the longest RELEVANT alignment
+ * restrictions... */
+
+ char *cp;
+ void (*f) (void);
+ long l;
+ FILE *fp;
+ double d;
+};
+
+#define CLICK_SZ (sizeof(union align))
+union block_hdr {
+ union align a;
+
+ /* Actual header... */
+
+ struct {
+ char *endp;
+ union block_hdr *next;
+ char *first_avail;
+ #ifdef POOL_DEBUG
+ union block_hdr *global_next;
+ struct pool *owning_pool;
+ #endif
+ } h;
+};
+
+struct pool {
+ union block_hdr *first;
+ union block_hdr *last;
+ struct cleanup *cleanups;
+ struct process_chain *subprocesses;
+ struct pool *sub_pools;
+ struct pool *sub_next;
+ struct pool *sub_prev;
+ struct pool *parent;
+ char *free_first_avail;
+#ifdef ALLOC_USE_MALLOC
+ void *allocation_list;
+#endif
+#ifdef POOL_DEBUG
+ struct pool *joined;
+#endif
+};
+
+#include "ap_alloc.h"
+#define POOL_HDR_CLICKS (1 + ((sizeof(struct pool) - 1) / CLICK_SZ))
+#define POOL_HDR_BYTES (POOL_HDR_CLICKS * CLICK_SZ)
+
+pool * ap_get_shared_mem_pool(size_t size)
+{
+ pool *new_pool;
+ union block_hdr *blok;
+
+ blok = (union block_hdr *) ap_tpf_get_shared_mem(size);
+ /* if shm fails, it will exit blok will be valid here */
+ memset((char *) blok, '\0', size);
+ blok->h.next = NULL;
+ blok->h.first_avail = (char *) (blok + 1);
+ blok->h.endp = size + blok->h.first_avail;
+ new_pool = (pool *) blok->h.first_avail;
+ blok->h.first_avail += POOL_HDR_BYTES;
+ new_pool->free_first_avail = blok->h.first_avail;
+ new_pool->first = new_pool->last = blok;
+
+ return new_pool;
+}
+
+int ap_check_shm_space(struct pool *a, int size)
+{
+ union block_hdr *blok = a->last;
+ char *first_avail = blok->h.first_avail;
+ char *new_first_avail;
+
+ new_first_avail = first_avail + size;
+ if (new_first_avail <= blok->h.endp) {
+ return (1);
+ }
+ else
+ return (0);
+}
+
+/*
+ This function serves as an interim killpg for Apache shutdown purposes.
+ TPF won't have an actual killpg for a very long time, if ever.
+ (And kill with a negative pid doesn't work on TPF either.)
+*/
+int killpg(pid_t pgrp, int sig)
+{
+ struct ev0bk evnblock;
+ struct timeval tv;
+ int i;
+
+ ap_sync_scoreboard_image();
+
+ for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
+ int pid = ap_scoreboard_image->parent[i].pid;
+ /* the pgrp check is so that we don't kill ourself: */
+ if (pid && pid != pgrp) {
+ kill(pid, sig);
+ }
+ }
+ /* Allow time for the signals to get to the children.
+ Note that ap_select is signal interruptable,
+ so we use evnwc instead. */
+ i = TPF_SHUTDOWN_SIGNAL_DELAY;
+ evnblock.evnpstinf.evnbkc1 = 1; /* nbr of posts needed */
+ evntc(&evnblock, EVENT_CNT, 'N', i, EVNTC_1052);
+ evnwc(&evnblock, EVENT_CNT);
+
+ if (sig == SIGTERM) {
+ /* get idle children's attention by closing the socket */
+ closesocket(sock_sd);
+ /* and close the /dev/tpf.socket.file special file */
+ fclose(sock_fp);
+ /* Allow the children some more time.
+ Note that ap_select is signal interruptable,
+ so we use evnwc instead. */
+ i = TPF_SHUTDOWN_CLOSING_DELAY;
+ evnblock.evnpstinf.evnbkc1 = 1; /* nbr of posts needed */
+ evntc(&evnblock, EVENT_CNT, 'N', i, EVNTC_1052);
+ evnwc(&evnblock, EVENT_CNT);
+ }
+
+ return(0);
+}
+
+/*
+ This function augments http_main's show_compile_settings function.
+ This way definitions that are only shown on TPF won't clutter up
+ main line code.
+*/
+void show_os_specific_compile_settings(void)
+{
+int i;
+
+#ifdef USE_TPF_SCOREBOARD
+ #error "USE_TPF_SCOREBOARD (system heap scoreboard)"
+ #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-TPF41 PUT10 systems"
+#endif
+
+#ifdef TPF_FORK_EXTENDED
+ printf(" -D TPF_FORK_EXTENDED\n");
+#endif
+
+#ifdef TPF_HAVE_NONSOCKET_SELECT
+ printf(" -D TPF_HAVE_NONSOCKET_SELECT\n");
+#endif
+
+#ifdef TPF_NO_NONSOCKET_SELECT
+ printf(" -D TPF_NO_NONSOCKET_SELECT\n");
+#endif
+
+#ifdef TPF_HAVE_SAWNC
+ printf(" -D TPF_HAVE_SAWNC\n");
+#endif
+
+#ifdef TPF_NO_SAWNC
+ printf(" -D TPF_NO_SAWNC\n");
+#endif
+
+#ifdef TPF_HAVE_NSD
+ printf(" -D TPF_HAVE_NSD\n");
+#endif
+
+#ifdef HAVE_SYSLOG
+ printf(" -D HAVE_SYSLOG\n");
+#endif
+
+ /* round SCOREBOARD_MAINTENANCE_INTERVAL up to seconds */
+ i = (SCOREBOARD_MAINTENANCE_INTERVAL + 999999) / 1000000;
+ if (i == 1) {
+ printf(" -D SCOREBOARD_MAINTENANCE_INTERVAL=1 SECOND\n");
+ } else {
+ printf(" -D SCOREBOARD_MAINTENANCE_INTERVAL=%i SECONDS\n", i);
+ }
+
+#ifdef TPF_HAVE_SIGACTION
+ printf(" -D TPF_HAVE_SIGACTION\n");
+#endif
+
+#ifdef NO_USE_SIGACTION
+ printf(" -D NO_USE_SIGACTION\n");
+#endif
+
+}
diff --git a/APACHE_1_3_42/src/os/tpf/os.h b/APACHE_1_3_42/src/os/tpf/os.h
new file mode 100644
index 0000000000..756d4a95ee
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/os.h
@@ -0,0 +1,358 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APACHE_OS_H
+#define APACHE_OS_H
+
+/*
+ * This file is included in all Apache source code. It contains definitions
+ * of facilities available on _this_ operating system (HAVE_* macros),
+ * and prototypes of OS specific functions defined in os.c or os-inline.c
+ */
+
+#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 <stdlib.h>
+#include <tpf/tpfeq.h>
+#include <tpf/tpfio.h>
+#include <tpf/sysapi.h>
+#include <time.h>
+#include <tpf/i_netd.h>
+#include <strings.h>
+#include <unistd.h>
+#endif /* TPF64BIT */
+
+/*---------------------------------------------------------------------*/
+#ifdef TPF41
+/*---------------------------------------------------------------------*/
+
+/************************************************************************
+ * 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
+ * else add #define TPF_NO_NONSOCKET_SELECT
+ *
+ * One of these two #defines is required and must be added here in os.h
+ * before the following check.
+ ************************************************************************/
+
+#if !defined(TPF_HAVE_NONSOCKET_SELECT) && !defined(TPF_NO_NONSOCKET_SELECT)
+ #error "You must define whether your system supports non_socket_select()"
+ #error "See src/os/tpf/os.h for instructions"
+#endif
+
+#if defined(TPF_HAVE_NONSOCKET_SELECT) && defined(TPF_NO_NONSOCKET_SELECT)
+ #error "TPF_HAVE_NONSOCKET_SELECT and TPF_NO_NONSOCKET_SELECT"
+ #error "cannot both be defined"
+ #error "See src/os/tpf/os.h for instructions"
+#endif
+
+/************************************************************************
+ * 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
+ * else add #define TPF_NO_SAWNC
+ *
+ * One of these two #defines is required and must be added here in os.h
+ * before the following check.
+ ************************************************************************/
+
+#if !defined(TPF_HAVE_SAWNC) && !defined(TPF_NO_SAWNC)
+ #error "You must define whether your system supports tpf_sawnc()"
+ #error "See src/os/tpf/os.h for instructions"
+#endif
+
+#if defined(TPF_HAVE_SAWNC) && defined(TPF_NO_SAWNC)
+ #error "TPF_HAVE_SAWNC and TPF_NO_SAWNC"
+ #error "cannot both be defined"
+ #error "See src/os/tpf/os.h for instructions"
+#endif
+
+/* if the compiler defined errno then undefine it
+ and pick up the correct definition from errno.h */
+#if defined(errno) && !defined(__errnoh)
+#undef errno
+#include <errno.h>
+#endif
+
+/* 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 TPF41 PJ27277. */
+#include <stdlib.h>
+#if defined(environ) && !defined(TPF_FORK_EXTENDED)
+#define TPF_FORK_EXTENDED
+#endif
+#define WUNTRACED 0 /* TPF41's waitpid() doesn't support WUNTRACED */
+#include <tpfeq.h>
+#include <tpfio.h>
+#include <sysapi.h>
+#include <sysgtime.h>
+#include <i$netd.h>
+#include <strings.h>
+#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 <unistd.h>
+#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
+
+#include "ap_config.h"
+
+#if !defined(INLINE) && defined(USE_GNU_INLINE)
+/* Compiler supports inline, so include the inlineable functions as
+ * part of the header
+ */
+#define INLINE extern ap_inline
+#include "os-inline.c"
+#endif
+
+#ifndef INLINE
+/* Compiler does not support inline, so prototype the inlineable functions
+ * as normal
+ */
+extern int ap_os_is_path_absolute(const char *f);
+#endif
+
+/* Other ap_os_ routines not used by this platform */
+
+#define ap_os_is_filename_valid(f) (1)
+#define ap_os_kill(pid, sig) kill(pid, sig)
+
+/*---------------------------------------------------------------------*/
+#ifdef TPF41
+/*---------------------------------------------------------------------*/
+#ifndef __strings_h
+
+#define FD_SETSIZE 2048
+
+typedef long fd_mask;
+
+#define NBBY 8 /* number of bits in a byte */
+#define NFDBITS (sizeof(fd_mask) * NBBY)
+#define howmany(x, y) (((x)+((y)-1))/(y))
+
+typedef struct fd_set {
+ fd_mask fds_bits [howmany(FD_SETSIZE, NFDBITS)];
+} 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 /* __strings_h */
+
+#ifdef FD_SET
+#undef FD_SET
+#define FD_SET(n, p) (0)
+#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) */
+#define tzset()
+
+/* definitions for the file descriptor inheritance table */
+#define TPF_FD_LIST_SIZE 4000
+
+/* seconds to delay after shutdown/restart signals have been sent */
+#ifndef TPF_SHUTDOWN_SIGNAL_DELAY
+#define TPF_SHUTDOWN_SIGNAL_DELAY 2
+#endif
+
+/* seconds to delay after closing the port as part of shutdown */
+#ifndef TPF_SHUTDOWN_CLOSING_DELAY
+#define TPF_SHUTDOWN_CLOSING_DELAY 3
+#endif
+
+#ifndef AP_OS_RECLAIM_LOOP_ADJUSTMENTS
+/* expedite shutdown/restart in http_main.c's reclaim_child_processes
+ function by skipping some of the loop iterations */
+#define AP_OS_RECLAIM_LOOP_ADJUSTMENTS \
+ if (tries == 4) { \
+ tries += 1; /* skip try #5 */ \
+ } else { \
+ if (tries == 8) { \
+ tries += 3; /* skip try #9, #10, & #11 */ \
+ } \
+ }
+#endif /* AP_OS_RECLAIM_LOOP_ADJUSTMENTS */
+
+enum FILE_TYPE { PIPE_OUT = 1, PIPE_IN, PIPE_ERR };
+
+typedef struct tpf_fd_item {
+ int fd;
+ enum FILE_TYPE file_type;
+ char *fname;
+}TPF_FD_ITEM;
+
+typedef struct tpf_fd_list {
+ void *next_avail_byte;
+ void *last_avail_byte;
+ unsigned int nbr_of_items;
+ TPF_FD_ITEM first_item;
+}TPF_FD_LIST;
+
+typedef struct apache_input {
+ void *scoreboard_heap; /* scoreboard system heap address */
+ int slot; /* child number */
+ int generation; /* server generation number */
+ int listeners[10];
+ 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;
+
+typedef union ebw_area {
+ INETD_SERVER_INPUT parent;
+ APACHE_TPF_INPUT child;
+} EBW_AREA;
+
+extern void *tpf_shm_static_ptr; /* mod_tpf_shm_static */
+#define TPF_SHM_STATIC_SIZE 200000
+#define MMAP_SEGMENT_SIZE 32767 /* writev can handle 32767 */
+#define _SYS_UIO_H_ /* writev */
+
+typedef struct tpf_fork_child {
+ char *filename;
+ enum { FORK_NAME = 1, FORK_FILE = 2 } prog_type;
+ void *subprocess_env;
+} TPF_FORK_CHILD;
+
+int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen);
+extern int tpf_child;
+
+struct server_rec;
+pid_t os_fork(struct server_rec *s, int slot);
+void ap_tpf_zinet_checks(int standalone,
+ const char *servername,
+ struct server_rec *s);
+int os_check_server(char *server);
+void show_os_specific_compile_settings(void);
+char *getpass(const char *prompt);
+int killpg(pid_t pgrp, int sig);
+extern char *ap_server_argv0;
+#include <signal.h>
+#if defined(TPF41) && !defined(SIGPIPE)
+#define SIGPIPE 14
+#endif
+#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: */
+
+#define TPF_SERVERTYPE_MSG \
+ "ServerType inetd is not supported on TPF" \
+ " -- Apache startup aborted"
+
+#ifdef INETD_IDCF_MODEL_DAEMON
+#define TPF_STANDALONE_CONFLICT_MSG \
+ "ServerType standalone requires ZINET model DAEMON or NOLISTEN" \
+ " -- Apache startup aborted"
+#define TPF_NOLISTEN_WARNING \
+ "ZINET model DAEMON is preferred over model NOLISTEN"
+#else
+#define INETD_IDCF_MODEL_DAEMON -1
+#define TPF_STANDALONE_CONFLICT_MSG \
+ "ServerType standalone requires ZINET model NOLISTEN" \
+ " -- Apache startup aborted"
+#endif
+
+#define TPF_UNABLE_TO_DETERMINE_ZINET_MODEL \
+ "Unable to determine ZINET model: inetd_getServer(\"%s\") " \
+ "call failed -- Apache startup aborted"
+
+#endif /*! APACHE_OS_H*/
diff --git a/APACHE_1_3_42/src/os/tpf/samples/linkhttp.dlm b/APACHE_1_3_42/src/os/tpf/samples/linkhttp.dlm
new file mode 100644
index 0000000000..a4ee418c3e
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/samples/linkhttp.dlm
@@ -0,0 +1,66 @@
+CHTA.dlm
+DLMVERSION(<vv>)
+CSTRTD(40)
+CINET640
+buildmark.o
+modules.o
+ap/ap_base64.o
+ap/ap_checkpass.o
+ap/ap_cpystrn.o
+ap/ap_ebcdic.o
+ap/ap_execve.o
+ap/ap_fnmatch.o
+ap/ap_getpass.o
+ap/ap_md5c.o
+ap/ap_sha1.o
+ap/ap_signal.o
+ap/ap_slack.o
+ap/ap_snprintf.o
+ap/ap_strtol.o
+main/alloc.o
+main/buff.o
+main/http_config.o
+main/http_core.o
+main/http_log.o
+main/http_main.o
+main/http_protocol.o
+main/http_request.o
+main/http_vhost.o
+main/rfc1413.o
+main/util.o
+main/util_date.o
+main/util_md5.o
+main/util_script.o
+main/util_uri.o
+modules/standard/mod_access.o
+modules/standard/mod_actions.o
+modules/standard/mod_alias.o
+modules/standard/mod_asis.o
+modules/standard/mod_auth.o
+modules/standard/mod_autoindex.o
+modules/standard/mod_cgi.o
+modules/standard/mod_dir.o
+modules/standard/mod_env.o
+modules/standard/mod_imap.o
+modules/standard/mod_include.o
+modules/standard/mod_log_config.o
+modules/standard/mod_mime.o
+modules/standard/mod_negotiation.o
+modules/standard/mod_setenvif.o
+modules/standard/mod_status.o
+modules/standard/mod_userdir.o
+os/tpf/cgetop.o
+os/tpf/os.o
+os/tpf/os-inline.o
+regex/regcomp.o
+regex/regerror.o
+regex/regexec.o
+regex/regfree.o
+SYSLIB(<your-first-syslib-dsn>)
+SYSLIB(<your-final-syslib-dsn>)
+OBJLIB(<your-first-objlib-dsn>)
+OBJLIB(<your-final-objlib-dsn>)
+STUBS()
+TARGET(<your-target-dsn-here>)
+PRELINK(MAP)
+LINK(AMODE=31 RMODE=ANY LIST XREF MAP)
diff --git a/APACHE_1_3_42/src/os/tpf/samples/linkhttp.jcl b/APACHE_1_3_42/src/os/tpf/samples/linkhttp.jcl
new file mode 100644
index 0000000000..bafc62c1be
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/samples/linkhttp.jcl
@@ -0,0 +1,147 @@
+//LINKHTTP JOB MSGLEVEL=(1,1),CLASS=S,MSGCLASS=S
+//* SAMPLE JCL FOR LINKING APACHE ON TPF41
+/*ROUTE PRINT <your-id-here>
+/*ROUTE PUNCH <your-id-here>
+/*NOTIFY <your-id-here>
+//CCLE JCLLIB ORDER=(SYS1.CBC.SCBCPRC,SYS1.CEE.SCEEPROC)
+//PRELINK EXEC EDCPL,COND.LKED=(0,NE),
+// PPARM='OMVS,DLLNAME(CHTA)',
+// LREGSIZ='2048K',
+// LPARM='AMODE=31,RMODE=ANY,LIST,XREF,MAP'
+//PLKED.SYSLIB DD DISP=SHR,DSN=<your-first-syslib-dsn>
+// DD DISP=SHR,DSN=<your-final-syslib-dsn>
+//PLKED.OBJLIB DD DISP=SHR,DSN=<your-first-objlib-dsn>
+// DD DISP=SHR,DSN=<your-final-objlib-dsn>
+//PLKED.SYSDEFSD DD DISP=SHR,DSN=<your-dsd-dsn>(CHTA<vv>)
+//PLKED.OBJ01 DD PATH='/<your-path-here>/src/buildmark.o'
+//PLKED.OBJ02 DD PATH='/<your-path-here>/src/modules.o'
+//PLKED.OBJ03 DD PATH='/<your-path-here>/src/ap/ap_base64.o'
+//PLKED.OBJ04 DD PATH='/<your-path-here>/src/ap/ap_checkpass.o'
+//PLKED.OBJ05 DD PATH='/<your-path-here>/src/ap/ap_cpystrn.o'
+//PLKED.OBJ06 DD PATH='/<your-path-here>/src/ap/ap_ebcdic.o'
+//PLKED.OBJ07 DD PATH='/<your-path-here>/src/ap/ap_execve.o'
+//PLKED.OBJ08 DD PATH='/<your-path-here>/src/ap/ap_fnmatch.o'
+//PLKED.OBJ09 DD PATH='/<your-path-here>/src/ap/ap_getpass.o'
+//PLKED.OBJ10 DD PATH='/<your-path-here>/src/ap/ap_md5c.o'
+//PLKED.OBJ11 DD PATH='/<your-path-here>/src/ap/ap_sha1.o'
+//PLKED.OBJ12 DD PATH='/<your-path-here>/src/ap/ap_signal.o'
+//PLKED.OBJ13 DD PATH='/<your-path-here>/src/ap/ap_slack.o'
+//PLKED.OBJ14 DD PATH='/<your-path-here>/src/ap/ap_snprintf.o'
+//PLKED.OBJ15 DD PATH='/<your-path-here>/src/ap/ap_strtol.o'
+//PLKED.OBJ16 DD PATH='/<your-path-here>/src/main/alloc.o'
+//PLKED.OBJ17 DD PATH='/<your-path-here>/src/main/buff.o'
+//PLKED.OBJ18 DD PATH='/<your-path-here>/src/main/http_config.o'
+//PLKED.OBJ19 DD PATH='/<your-path-here>/src/main/http_core.o'
+//PLKED.OBJ20 DD PATH='/<your-path-here>/src/main/http_log.o'
+//PLKED.OBJ21 DD PATH='/<your-path-here>/src/main/http_main.o'
+//PLKED.OBJ22 DD PATH='/<your-path-here>/src/main/http_protocol.o'
+//PLKED.OBJ23 DD PATH='/<your-path-here>/src/main/http_request.o'
+//PLKED.OBJ24 DD PATH='/<your-path-here>/src/main/http_vhost.o'
+//PLKED.OBJ25 DD PATH='/<your-path-here>/src/main/rfc1413.o'
+//PLKED.OBJ26 DD PATH='/<your-path-here>/src/main/util.o'
+//PLKED.OBJ27 DD PATH='/<your-path-here>/src/main/util_date.o'
+//PLKED.OBJ28 DD PATH='/<your-path-here>/src/main/util_md5.o'
+//PLKED.OBJ29 DD PATH='/<your-path-here>/src/main/util_script.o'
+//PLKED.OBJ30 DD PATH='/<your-path-here>/src/main/util_uri.o'
+//PLKED.OBJ31 DD PATH='/<your-path-here>/src/modules/standard/mod_acce\
+// ss.o'
+//PLKED.OBJ32 DD PATH='/<your-path-here>/src/modules/standard/mod_acti\
+// ons.o'
+//PLKED.OBJ33 DD PATH='/<your-path-here>/src/modules/standard/mod_alia\
+// s.o'
+//PLKED.OBJ34 DD PATH='/<your-path-here>/src/modules/standard/mod_asis\
+// .o'
+//PLKED.OBJ35 DD PATH='/<your-path-here>/src/modules/standard/mod_auth\
+// .o'
+//PLKED.OBJ36 DD PATH='/<your-path-here>/src/modules/standard/mod_auto\
+// index.o'
+//PLKED.OBJ37 DD PATH='/<your-path-here>/src/modules/standard/mod_cgi.\
+// o'
+//PLKED.OBJ38 DD PATH='/<your-path-here>/src/modules/standard/mod_dir.\
+// o'
+//PLKED.OBJ39 DD PATH='/<your-path-here>/src/modules/standard/mod_env.\
+// o'
+//PLKED.OBJ40 DD PATH='/<your-path-here>/src/modules/standard/mod_imap\
+// .o'
+//PLKED.OBJ41 DD PATH='/<your-path-here>/src/modules/standard/mod_incl\
+// ude.o'
+//PLKED.OBJ42 DD PATH='/<your-path-here>/src/modules/standard/mod_log_\
+// config.o'
+//PLKED.OBJ43 DD PATH='/<your-path-here>/src/modules/standard/mod_mime\
+// .o'
+//PLKED.OBJ44 DD PATH='/<your-path-here>/src/modules/standard/mod_nego\
+// tiation.o'
+//PLKED.OBJ45 DD PATH='/<your-path-here>/src/modules/standard/mod_sete\
+// nvif.o'
+//PLKED.OBJ46 DD PATH='/<your-path-here>/src/modules/standard/mod_stat\
+// us.o'
+//PLKED.OBJ47 DD PATH='/<your-path-here>/src/modules/standard/mod_user\
+// dir.o'
+//PLKED.OBJ48 DD PATH='/<your-path-here>/src/os/tpf/cgetop.o'
+//PLKED.OBJ49 DD PATH='/<your-path-here>/src/os/tpf/os.o'
+//PLKED.OBJ50 DD PATH='/<your-path-here>/src/os/tpf/os-inline.o'
+//PLKED.OBJ51 DD PATH='/<your-path-here>/src/regex/regcomp.o'
+//PLKED.OBJ52 DD PATH='/<your-path-here>/src/regex/regerror.o'
+//PLKED.OBJ53 DD PATH='/<your-path-here>/src/regex/regexec.o'
+//PLKED.OBJ54 DD PATH='/<your-path-here>/src/regex/regfree.o'
+//PLKED.SYSIN DD *
+ ORDER @@DLMHDR
+ INCLUDE OBJLIB(CSTRTD40)
+ INCLUDE OBJ01
+ INCLUDE OBJ02
+ INCLUDE OBJ03
+ INCLUDE OBJ04
+ INCLUDE OBJ05
+ INCLUDE OBJ06
+ INCLUDE OBJ07
+ INCLUDE OBJ08
+ INCLUDE OBJ09
+ INCLUDE OBJ10
+ INCLUDE OBJ11
+ INCLUDE OBJ12
+ INCLUDE OBJ13
+ INCLUDE OBJ14
+ INCLUDE OBJ15
+ INCLUDE OBJ16
+ INCLUDE OBJ17
+ INCLUDE OBJ18
+ INCLUDE OBJ19
+ INCLUDE OBJ20
+ INCLUDE OBJ21
+ INCLUDE OBJ22
+ INCLUDE OBJ23
+ INCLUDE OBJ24
+ INCLUDE OBJ25
+ INCLUDE OBJ26
+ INCLUDE OBJ27
+ INCLUDE OBJ28
+ INCLUDE OBJ29
+ INCLUDE OBJ30
+ INCLUDE OBJ31
+ INCLUDE OBJ32
+ INCLUDE OBJ33
+ INCLUDE OBJ34
+ INCLUDE OBJ35
+ INCLUDE OBJ36
+ INCLUDE OBJ37
+ INCLUDE OBJ38
+ INCLUDE OBJ39
+ INCLUDE OBJ40
+ INCLUDE OBJ41
+ INCLUDE OBJ42
+ INCLUDE OBJ43
+ INCLUDE OBJ44
+ INCLUDE OBJ45
+ INCLUDE OBJ46
+ INCLUDE OBJ47
+ INCLUDE OBJ48
+ INCLUDE OBJ49
+ INCLUDE OBJ50
+ INCLUDE OBJ51
+ INCLUDE OBJ52
+ INCLUDE OBJ53
+ INCLUDE OBJ54
+ INCLUDE OBJLIB(CINET640)
+/*
+//LKED.SYSLMOD DD DISP=OLD,DSN=<your-target-dsn-here>(CHTA<vv>)
+//
diff --git a/APACHE_1_3_42/src/os/tpf/samples/loadset.jcl b/APACHE_1_3_42/src/os/tpf/samples/loadset.jcl
new file mode 100644
index 0000000000..ea74a2dfd0
--- /dev/null
+++ b/APACHE_1_3_42/src/os/tpf/samples/loadset.jcl
@@ -0,0 +1,42 @@
+//LOADSET JOB MSGLEVEL=1,CLASS=S,MSGCLASS=S
+//* SAMPLE JCL TO BUILD AN APACHE LOADSET FOR TPF41
+/*ROUTE PRINT <your-id-here>
+/*ROUTE PUNCH <your-id-here>
+//TLDR EXEC PGM=TPFLDR40,REGION=8M,
+// PARM='OLDR,SYS=ACP,CLMSIZE=8000000'
+//STEPLIB DD DSN=ACP.LINK.RLSE40.BSS,DISP=SHR
+// DD DSN=SYS1.CEE.SCEERUN,DISP=SHR
+//SALTB DD DSN=ACP.SALTBL.RLSE40.BSS,DISP=SHR
+//OBJLIB DD DSN=ACP.OBJ.RLSE40.BSS,DISP=SHR
+//LOADMOD DD DSN=<your-source-dsn-here>,DISP=SHR
+// DD DSN=ACP.LINK.RLSE40.BSS,DISP=SHR
+//LOADSUM DD DSN=&&LOADSUM,DISP=(NEW,PASS),UNIT=SYSDA,
+// LRECL=133,SPACE=(TRK,(10,10)),RECFM=FBA
+//CPRTEMP DD UNIT=SYSDA,
+// DSN=&&CPRTEMP,SPACE=(TRK,(100,20)),
+// DCB=(RECFM=FB,BLKSIZE=4095,LRECL=4095),
+// DISP=(NEW,DELETE)
+//PROGTEMP DD UNIT=SYSDA,
+// DSN=&&PRTEMP,SPACE=(TRK,(100,20)),
+// DCB=(RECFM=FB,BLKSIZE=4095,LRECL=4095),
+// DISP=(NEW,DELETE)
+//OUTPUT DD DSN=&&VRDROUT,DISP=(NEW,PASS),UNIT=SYSDA,
+// DCB=(RECFM=F,BLKSIZE=4095,LRECL=4095)
+//SYSUDUMP DD DUMMY
+//SYSABEND DD DUMMY
+//SYSOUT DD SYSOUT=A
+//SYSPRINT DD SYSOUT=A
+//PRINTER DD SYSOUT=A
+//CEEDUMP DD SYSOUT=A
+//SYSIN DD *
+SYSID=BSS
+PATVERS=NONE
+SALVERS=40
+LOADER LOADSET HTTPD<vv>
+LOADER CALL PROG CHTA<vv>
+/*
+//TRANSMIT EXEC PGM=IKJEFT01,
+// PARM='TRANSMIT <your-id-here> DDNAME(SYSTSIN) NOLOG NONOTIFY SEQ'
+//SYSTSIN DD UNIT=SYSDA,
+// DSN=&&VRDROUT,DISP=(OLD,DELETE)
+//SYSTSPRT DD DUMMY
diff --git a/APACHE_1_3_42/src/os/tpf/samples/sample_env.txt b/APACHE_1_3_42/src/os/tpf/samples/sample_env.txt
new file mode 100644
index 0000000000..4a4526a106
--- /dev/null
+++ b/APACHE_1_3_42/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/opensource/apache/lib)
+
+#######################################################################
+# Define directories where the loadables (XXXXVV) are to be written #
+#######################################################################
+ROOTLOADDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/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/opensource/apache/exp)
+
+#######################################################################
+# Define the object file directory name #
+#######################################################################
+ROOTOBJDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/apache/obj)
+
+#######################################################################
+# Define the listing files directory name #
+#######################################################################
+ROOTLSTDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/apache/lst)
+
+#######################################################################
+# Set the include/header file directories #
+#######################################################################
+ROOTINCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/include)
+ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/proxy)
+ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/standard)
+ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/os/tpf)
+ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/regex)
+
+#######################################################################
+# Set the C file directories #
+#######################################################################
+ROOTCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/ap)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/main)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/example)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/extra)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/experimental)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/proxy)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/modules/standard)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/os/tpf)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/regex)
+ROOTCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/apache/src/support)
diff --git a/APACHE_1_3_42/src/os/tpf/samples/sample_mak.txt b/APACHE_1_3_42/src/os/tpf/samples/sample_mak.txt
new file mode 100644
index 0000000000..7fdaa38c06
--- /dev/null
+++ b/APACHE_1_3_42/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/opensource/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/APACHE_1_3_42/src/os/tpf/samples/test_char.txt b/APACHE_1_3_42/src/os/tpf/samples/test_char.txt
new file mode 100644
index 0000000000..4e436b6a1b
--- /dev/null
+++ b/APACHE_1_3_42/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/APACHE_1_3_42/src/os/tpf/samples/uri_delims.txt b/APACHE_1_3_42/src/os/tpf/samples/uri_delims.txt
new file mode 100644
index 0000000000..b995c0ebac
--- /dev/null
+++ b/APACHE_1_3_42/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
+};