From: Greg Stein Date: Fri, 30 Mar 2001 23:27:09 +0000 (+0000) Subject: remove some items which are no longer used/needed. X-Git-Tag: 2.0.16~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5623c97b243432c7c08d5d0d12c0f6890da18f8;p=apache remove some items which are no longer used/needed. Reviewed by: David McCreedy git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88619 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/os/tpf/os.c b/os/tpf/os.c index 2181a190b0..5424f992b3 100644 --- a/os/tpf/os.c +++ b/os/tpf/os.c @@ -69,60 +69,6 @@ static FILE *sock_fp; -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 = 0; - int rv; - - if(maxfds) { - if(tv) - timeout = tv->tv_sec * 1000 + tv->tv_usec; - sockets[0] = maxfds-1; - no_reads++; - } - else - sockets[0] = 0; - - ap_check_signals(); - rv = select(sockets, no_reads, no_writes, no_excepts, timeout); - ap_check_signals(); - - return rv; - -} - -int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen) -{ - int socks[1]; - int rv; - - ap_check_signals(); - socks[0] = sockfd; - rv = select(socks, 1, 0, 0, 1000); - errno = sock_errno(); - if(rv>0) { - ap_check_signals(); - 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); -} - #ifndef __PIPE_ int pipe(int fildes[2]) { @@ -165,135 +111,6 @@ int execvp(const char *file, char *const argv[]) } - -int ap_tpf_spawn_child(apr_pool_t *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, temp_in, temp_err, save_errno, pid, result=0; - int fd_flags_out, fd_flags_in, fd_flags_err; - struct tpf_fork_input fork_input; - TPF_FORK_CHILD *cld = (TPF_FORK_CHILD *) data; - apr_array_header_t *env_arr = apr_table_elts ((array_header *) cld->subprocess_env); - table_entry *elts = (table_entry *) env_arr->elts; - - - - 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); - } - - if (cld->subprocess_env) { - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - setenv (elts[i].key, elts[i].val, 1); - } - } - - 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; - - - if ((pid = tpf_fork(&fork_input)) < 0) { - 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; - } - - if (cld->subprocess_env) { - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - unsetenv (elts[i].key); - } - } - - 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) { - - apr_pool_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; @@ -350,22 +167,6 @@ int os_check_server(char *server) { return 0; } -void os_note_additional_cleanups(apr_pool_t *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+"); - ap_note_cleanups_for_file(p, sock_fp); /* arrange to close on exec or restart */ - fcntl(sd,F_SETFD,FD_CLOEXEC); -} - -void os_tpf_child(APACHE_TPF_INPUT *input_parms) { - tpf_child = 1; - ap_my_generation = input_parms->generation; - ap_restart_time = input_parms->restart_time; -} - AP_DECLARE(apr_status_t) ap_os_create_privileged_process( const request_rec *r, apr_proc_t *newproc, const char *progname, diff --git a/os/tpf/os.h b/os/tpf/os.h index 65965c0959..c50fdc5451 100644 --- a/os/tpf/os.h +++ b/os/tpf/os.h @@ -114,11 +114,6 @@ typedef struct fd_set { #define FD_SET(n, p) (0) #endif -#define RESOURCE_KEY ((void*) 0xC1C2C1C3) - -/* TPF doesn't have, or need, tzset (it is used in mod_expires.c) */ -#define tzset() - #include struct apache_input { INETD_SERVER_INPUT inetd_server; @@ -132,19 +127,12 @@ struct apache_input { typedef struct apache_input APACHE_TPF_INPUT; -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); int os_check_server(char *server); -char *getpass(const char *prompt); + extern char *ap_server_argv0; extern int scoreboard_fd; #include