summaryrefslogtreecommitdiffstats
path: root/rubbos/app/httpd-2.0.64/os/tpf/os.c
diff options
context:
space:
mode:
authorhongbotian <hongbo.tianhongbo@huawei.com>2015-11-30 01:45:08 -0500
committerhongbotian <hongbo.tianhongbo@huawei.com>2015-11-30 01:45:08 -0500
commite8ec7aa8e38a93f5b034ac74cebce5de23710317 (patch)
treeaa031937bf856c1f8d6ad7877b8d2cb0224da5ef /rubbos/app/httpd-2.0.64/os/tpf/os.c
parentcc40af334e619bb549038238507407866f774f8f (diff)
upload http
JIRA: BOTTLENECK-10 Change-Id: I7598427ff904df438ce77c2819ee48ac75ffa8da Signed-off-by: hongbotian <hongbo.tianhongbo@huawei.com>
Diffstat (limited to 'rubbos/app/httpd-2.0.64/os/tpf/os.c')
-rw-r--r--rubbos/app/httpd-2.0.64/os/tpf/os.c132
1 files changed, 132 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/os/tpf/os.c b/rubbos/app/httpd-2.0.64/os/tpf/os.c
new file mode 100644
index 00000000..ff46b551
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/os/tpf/os.c
@@ -0,0 +1,132 @@
+/* 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"
+
+static FILE *sock_fp;
+
+#ifndef __PIPE_
+int pipe(int fildes[2])
+{
+ errno = ENOSYS;
+ return(-1);
+}
+#endif
+
+/* 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);
+}
+
+
+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;
+
+ fflush(stdin);
+ if (dup2(fileno(sock_fp), STDIN_FILENO) == -1)
+ ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s,
+ "unable to replace stdin with sock device driver");
+ fflush(stdout);
+ if (dup2(fileno(sock_fp), STDOUT_FILENO) == -1)
+ ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s,
+ "unable to replace stdout with sock device driver");
+ input_parms.generation = ap_my_generation;
+ input_parms.scoreboard_heap = ap_scoreboard_image;
+
+ 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;
+ 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 = "-x";
+ return tpf_fork(&fork_input);
+}
+
+int os_check_server(char *server) {
+#ifndef USE_TPF_DAEMON
+ int rv;
+ int *current_acn;
+ if((rv = inetd_getServerStatus(server)) == INETD_SERVER_STATUS_INACTIVE)
+ return 1;
+ else {
+ current_acn = (int *)cinfc_fast(CINFC_CMMACNUM);
+ if(ecbp2()->ce2acn != *current_acn)
+ return 1;
+ }
+#endif
+ return 0;
+}
+
+AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
+ const request_rec *r,
+ apr_proc_t *newproc, const char *progname,
+ const char * const *args,
+ const char * const *env,
+ apr_procattr_t *attr, apr_pool_t *p)
+{
+ return apr_proc_create(newproc, progname, args, env, attr, p);
+}