You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2000/07/29 13:53:07 UTC
Re: cvs commit: apache-2.0/src/modules/mpm/perchild mpm_default.h perchild.c
rbb@locus.apache.org writes:
> rbb 00/07/29 00:29:48
>
> Modified: src/modules/mpm/perchild mpm_default.h perchild.c
> Log:
> Associate virtual hosts with a specific child process. This doesn't
> work quite yet. The problem right now is that the thread doesn't really
> have the logic required to pass the request to the next child process.
>
> Revision Changes Path
> 1.2 +13 -0 apache-2.0/src/modules/mpm/perchild/mpm_default.h
>
> Index: perchild.c
> ===================================================================
> RCS file: /home/cvs/apache-2.0/src/modules/mpm/perchild/perchild.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- perchild.c 2000/07/28 19:34:39 1.3
> +++ perchild.c 2000/07/29 07:29:48 1.4
...
> +static int create_child_socket(int child_num, ap_pool_t *p)
> +{
> + struct sockaddr_un unix_addr;
> + mode_t omask;
> + int rc;
> + int sd;
> + perchild_server_conf *sconf = (perchild_server_conf *)
> + ap_get_module_config(ap_server_conf->module_config, &mpm_perchild_module);
> + char *socket_name = ap_palloc(p, strlen(sconf->sockname) + 6);
> +
> + ap_snprintf(socket_name, strlen(socket_name), "%s.%d", sconf->sockname, child_num);
> + if (unlink(socket_name) < 0 &&
> + errno != ENOENT) {
> + ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf,
> + "Couldn't unlink unix domain socket %s",
> + socket_name);
> + /* Just a warning; don't bail out */
> + }
> +
> + if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
> + ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf,
> + "Couldn't create unix domain socket");
> + return -1;
> + }
> +
> + memset(&unix_addr, 0, sizeof(unix_addr));
> + unix_addr.sun_family = AF_UNIX;
> + strcpy(unix_addr.sun_path, socket_name);
> +
> + omask = umask(0077); /* so that only Apache can use socket */
> + rc = bind(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr));
> + umask(omask); /* can't fail, so can't clobber -1 */
In the previous line, "-1" should be "errno".
> + if (rc < 0) {
> + ap_log_error(APLOG_MARK, APLOG_ERR, -1, ap_server_conf,
same comment
> + "Couldn't bind unix domain socket %s",
> + socket_name);
> + return -1;
> + }
> +
> + if (listen(sd, DEFAULT_PERCHILD_LISTENBACKLOG) < 0) {
> + ap_log_error(APLOG_MARK, APLOG_ERR, -1, ap_server_conf,
same comment
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...