diff options
Diffstat (limited to 'rubbos/app/httpd-2.0.64/os/beos')
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/.deps | 0 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/Makefile | 10 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/Makefile.in | 5 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/beosd.c | 166 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/beosd.h | 60 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/config.m4 | 3 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/os.c | 37 | ||||
-rw-r--r-- | rubbos/app/httpd-2.0.64/os/beos/os.h | 30 |
8 files changed, 311 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/os/beos/.deps b/rubbos/app/httpd-2.0.64/os/beos/.deps new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/.deps diff --git a/rubbos/app/httpd-2.0.64/os/beos/Makefile b/rubbos/app/httpd-2.0.64/os/beos/Makefile new file mode 100644 index 00000000..cc4ca876 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/Makefile @@ -0,0 +1,10 @@ +top_srcdir = /bottlenecks/rubbos/app/httpd-2.0.64 +top_builddir = /bottlenecks/rubbos/app/httpd-2.0.64 +srcdir = /bottlenecks/rubbos/app/httpd-2.0.64/os/beos +builddir = /bottlenecks/rubbos/app/httpd-2.0.64/os/beos +VPATH = /bottlenecks/rubbos/app/httpd-2.0.64/os/beos + +LTLIBRARY_NAME = libos.la +LTLIBRARY_SOURCES = os.c beosd.c + +include $(top_srcdir)/build/ltlib.mk diff --git a/rubbos/app/httpd-2.0.64/os/beos/Makefile.in b/rubbos/app/httpd-2.0.64/os/beos/Makefile.in new file mode 100644 index 00000000..66272ecc --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/Makefile.in @@ -0,0 +1,5 @@ + +LTLIBRARY_NAME = libos.la +LTLIBRARY_SOURCES = os.c beosd.c + +include $(top_srcdir)/build/ltlib.mk diff --git a/rubbos/app/httpd-2.0.64/os/beos/beosd.c b/rubbos/app/httpd-2.0.64/os/beos/beosd.c new file mode 100644 index 00000000..0d1755d4 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/beosd.c @@ -0,0 +1,166 @@ +/* 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. + */ + +#include <unistd.h> +#include "httpd.h" +#include "http_config.h" +#include "http_main.h" +#include "http_log.h" +#include "beosd.h" +#include "mpm_common.h" + +beosd_config_rec beosd_config; + +/* Set group privileges. + * + * Note that until we get the multi-user situation sorted on beos, + * this is just a no-op to allow common configuration files! + */ + +#if B_BEOS_VERSION < 0x0460 +static int set_group_privs(void) +{ + /* no-op */ + return 0; +} +#endif + + +int beosd_setup_child(void) +{ + /* TODO: revisit the whole issue of users/groups for BeOS as + * R5 and below doesn't really have much concept of them. + */ + + return 0; +} + + +AP_DECLARE(const char *) beosd_set_user(cmd_parms *cmd, + void *dummy, const char *arg) +{ + /* no-op */ + return NULL; +} + +AP_DECLARE(const char *) beosd_set_group(cmd_parms *cmd, + void *dummy, const char *arg) +{ + /* no-op */ + return NULL; +} + +void beosd_pre_config(void) +{ + /* Until the multi-user situation on BeOS is fixed, + simply have a no-op here to allow for common conf files + */ +} + +AP_DECLARE(apr_status_t) beosd_accept(void **accepted, ap_listen_rec *lr, + apr_pool_t *ptrans) +{ + apr_socket_t *csd; + apr_status_t status; + int sockdes; + + status = apr_accept(&csd, lr->sd, ptrans); + if (status == APR_SUCCESS) { + *accepted = csd; + apr_os_sock_get(&sockdes, csd); + if (sockdes >= FD_SETSIZE) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, + "new file descriptor %d is too large; you probably need " + "to rebuild Apache with a larger FD_SETSIZE " + "(currently %d)", + sockdes, FD_SETSIZE); + apr_socket_close(csd); + return APR_EINTR; + } + return status; + } + + if (APR_STATUS_IS_EINTR(status)) { + return status; + } + /* Our old behaviour here was to continue after accept() + * errors. But this leads us into lots of troubles + * because most of the errors are quite fatal. For + * example, EMFILE can be caused by slow descriptor + * leaks (say in a 3rd party module, or libc). It's + * foolish for us to continue after an EMFILE. We also + * seem to tickle kernel bugs on some platforms which + * lead to never-ending loops here. So it seems best + * to just exit in most cases. + */ + switch (status) { +#ifdef EPROTO + /* EPROTO on certain older kernels really means + * ECONNABORTED, so we need to ignore it for them. + * See discussion in new-httpd archives nh.9701 + * search for EPROTO. + * + * Also see nh.9603, search for EPROTO: + * There is potentially a bug in Solaris 2.x x<6, + * and other boxes that implement tcp sockets in + * userland (i.e. on top of STREAMS). On these + * systems, EPROTO can actually result in a fatal + * loop. See PR#981 for example. It's hard to + * handle both uses of EPROTO. + */ + case EPROTO: +#endif +#ifdef ECONNABORTED + case ECONNABORTED: +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: +#endif +#ifdef ENETUNREACH + case ENETUNREACH: +#endif + break; +#ifdef ENETDOWN + case ENETDOWN: + /* + * When the network layer has been shut down, there + * is not much use in simply exiting: the parent + * would simply re-create us (and we'd fail again). + * Use the CHILDFATAL code to tear the server down. + * @@@ Martin's idea for possible improvement: + * A different approach would be to define + * a new APEXIT_NETDOWN exit code, the reception + * of which would make the parent shutdown all + * children, then idle-loop until it detected that + * the network is up again, and restart the children. + * Ben Hyde noted that temporary ENETDOWN situations + * occur in mobile IP. + */ + ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, + "apr_accept: giving up."); + return APR_EGENERAL; +#endif /*ENETDOWN*/ + + default: + ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf, + "apr_accept: (client socket)"); + return APR_EGENERAL; + } + return status; +} diff --git a/rubbos/app/httpd-2.0.64/os/beos/beosd.h b/rubbos/app/httpd-2.0.64/os/beos/beosd.h new file mode 100644 index 00000000..337b5ced --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/beosd.h @@ -0,0 +1,60 @@ +/* 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 BEOSD_H +#define BEOSD_H + +#include "httpd.h" +#include "ap_listen.h" +/* common stuff that beos MPMs will want */ + +/* Default user name and group name. These may be specified as numbers by + * placing a # before a number */ + +#ifndef DEFAULT_USER +#define DEFAULT_USER "#-1" +#endif +#ifndef DEFAULT_GROUP +#define DEFAULT_GROUP "#" +#endif + +typedef struct { + char *user_name; + uid_t user_id; + gid_t group_id; +} beosd_config_rec; +extern beosd_config_rec beosd_config; + +void beosd_detach(void); +int beosd_setup_child(void); +void beosd_pre_config(void); +AP_DECLARE(const char *) beosd_set_user (cmd_parms *cmd, void *dummy, + const char *arg); +AP_DECLARE(const char *) beosd_set_group(cmd_parms *cmd, void *dummy, + const char *arg); +AP_DECLARE(apr_status_t) beosd_accept(void **accepted, ap_listen_rec *lr, + apr_pool_t *ptrans); + +#define beosd_killpg(x, y) (kill (-(x), (y))) +#define ap_os_killpg(x, y) (kill (-(x), (y))) + +#define BEOS_DAEMON_COMMANDS \ +AP_INIT_TAKE1("User", beosd_set_user, NULL, RSRC_CONF, \ + "Effective user id for this server (NO-OP)"), \ +AP_INIT_TAKE1("Group", beosd_set_group, NULL, RSRC_CONF, \ + "Effective group id for this server (NO-OP)") + +#endif /* BEOSD_H */ diff --git a/rubbos/app/httpd-2.0.64/os/beos/config.m4 b/rubbos/app/httpd-2.0.64/os/beos/config.m4 new file mode 100644 index 00000000..4fe95b75 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/config.m4 @@ -0,0 +1,3 @@ +if test "$OS" = "beos" ; then + APR_ADDTO(CFLAGS,-DBEOS) +fi diff --git a/rubbos/app/httpd-2.0.64/os/beos/os.c b/rubbos/app/httpd-2.0.64/os/beos/os.c new file mode 100644 index 00000000..a4361f88 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/os.c @@ -0,0 +1,37 @@ +/* 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 "ap_config.h" +#include "os.h" +#include "httpd.h" +#include "apr_thread_proc.h" +#include "ap_mpm.h" /* needed for definition of + * ap_os_create_privileged_process */ + +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); +} diff --git a/rubbos/app/httpd-2.0.64/os/beos/os.h b/rubbos/app/httpd-2.0.64/os/beos/os.h new file mode 100644 index 00000000..f5fa9064 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/os/beos/os.h @@ -0,0 +1,30 @@ +/* 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 + +#include "ap_config.h" + +#ifndef PLATFORM +# ifdef BONE_VERSION +# define PLATFORM "BeOS BONE" +# else +# define PLATFORM "BeOS R5" +# endif +#endif + +#endif /* !APACHE_OS_H */ |