On Mon, Jan 07, 2002 at 10:54:48PM -0800, Justin Erenkrantz wrote:
> Precisely my thoughts. IMHO, split it out. (The name is a bit
> iffy, but we can work on that...) -- justin
Suggestions for a better name welcome :) Patch below.
Btw, it appears that the current code in CVS does not build on FreeBSD
-current:
/bin/sh /home/jos/src/apache2/httpd-2.0/srclib/apr/libtool --silent --mode=compile gcc
-g -O2 -DHAVE_CONFIG_H -D_REENTRANT -D_THREAD_SAFE
-I/home/jos/src/apache2/httpd-2.0/srclib/apr-util/include
-I/home/jos/src/apache2/httpd-2.0/srclib/apr-util/include
-I/home/jos/src/apache2/httpd-2.0/srclib/apr/include -c apr_rmm.c && touch apr_rmm.lo
In file included from
/home/jos/src/apache2/httpd-2.0/srclib/apr-util/include/apr_rmm.h:71,
from apr_rmm.c:56:
/home/jos/src/apache2/httpd-2.0/srclib/apr-util/include/apr_anylock.h:76: syntax error
before `apr_thread_mutex_t'
apr_rmm.c: In function `apr_rmm_init':
apr_rmm.c:216: union has no member named `rw'
apr_rmm.c:219: union has no member named `tm'
apr_rmm.c:219: union has no member named `rw'
apr_rmm.c:219: union has no member named `rw'
apr_rmm.c:238: union has no member named `tm'
apr_rmm.c:238: union has no member named `rw'
apr_rmm.c: In function `apr_rmm_destroy':
apr_rmm.c:247: union has no member named `tm'
apr_rmm.c:247: union has no member named `rw'
apr_rmm.c:247: union has no member named `rw'
apr_rmm.c:272: union has no member named `tm'
apr_rmm.c:272: union has no member named `rw'
apr_rmm.c: In function `apr_rmm_attach':
apr_rmm.c:283: union has no member named `rw'
apr_rmm.c: In function `apr_rmm_malloc':
apr_rmm.c:307: union has no member named `tm'
apr_rmm.c:307: union has no member named `rw'
apr_rmm.c:307: union has no member named `rw'
apr_rmm.c:317: union has no member named `tm'
apr_rmm.c:317: union has no member named `rw'
apr_rmm.c: In function `apr_rmm_calloc':
apr_rmm.c:326: union has no member named `tm'
apr_rmm.c:326: union has no member named `rw'
apr_rmm.c:326: union has no member named `rw'
apr_rmm.c:337: union has no member named `tm'
apr_rmm.c:337: union has no member named `rw'
apr_rmm.c: In function `apr_rmm_free':
apr_rmm.c:357: union has no member named `tm'
apr_rmm.c:357: union has no member named `rw'
apr_rmm.c:357: union has no member named `rw'
apr_rmm.c:363: union has no member named `tm'
apr_rmm.c:363: union has no member named `rw'
apr_rmm.c:369: union has no member named `tm'
apr_rmm.c:369: union has no member named `rw'
apr_rmm.c:377: union has no member named `tm'
apr_rmm.c:377: union has no member named `rw'
apr_rmm.c:386: union has no member named `tm'
apr_rmm.c:386: union has no member named `rw'
*** Error code 1
Stop in /home/jos/src/apache2/httpd-2.0/srclib/apr-util/misc.
*** Error code 1
Stop in /home/jos/src/apache2/httpd-2.0/srclib/apr-util/misc.
*** Error code 1
Stop in /home/jos/src/apache2/httpd-2.0/srclib/apr-util.
*** Error code 1
Stop in /home/jos/src/apache2/httpd-2.0/srclib.
*** Error code 1
Stop in /home/jos/src/apache2/httpd-2.0.
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.75
diff -u -r1.75 beos.c
--- server/mpm/beos/beos.c 29 Dec 2001 23:16:23 -0000 1.75
+++ server/mpm/beos/beos.c 8 Jan 2002 07:36:34 -0000
@@ -1009,8 +1009,11 @@
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach)
- apr_proc_detach();
+ if (!one_process)
+ if (no_detach)
+ apr_proc_new_sessid();
+ else
+ apr_proc_detach();
server_pid = getpid();
}
Index: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.97
diff -u -r1.97 perchild.c
--- server/mpm/perchild/perchild.c 29 Dec 2001 23:16:23 -0000 1.97
+++ server/mpm/perchild/perchild.c 8 Jan 2002 07:36:36 -0000
@@ -1433,9 +1433,8 @@
debug = ap_exists_config_define("DEBUG");
- if (debug) {
+ if (debug)
no_detach = one_process = 1;
- }
else {
one_process = ap_exists_config_define("ONE_PROCESS");
no_detach = ap_exists_config_define("NO_DETACH");
@@ -1445,9 +1444,11 @@
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- apr_proc_detach();
- }
+ if (!one_process)
+ if (no_detach)
+ apr_proc_new_sessid();
+ else
+ apr_proc_detach();
my_pid = getpid();
}
Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.227
diff -u -r1.227 prefork.c
--- server/mpm/prefork/prefork.c 29 Dec 2001 23:16:24 -0000 1.227
+++ server/mpm/prefork/prefork.c 8 Jan 2002 07:36:37 -0000
@@ -1216,9 +1216,11 @@
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- apr_proc_detach();
- }
+ if (!one_process)
+ if (no_detach)
+ apr_proc_new_sessid();
+ else
+ apr_proc_detach();
parent_pid = ap_my_pid = getpid();
}
Index: server/mpm/worker/worker.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/worker/worker.c,v
retrieving revision 1.58
diff -u -r1.58 worker.c
--- server/mpm/worker/worker.c 29 Dec 2001 23:16:24 -0000 1.58
+++ server/mpm/worker/worker.c 8 Jan 2002 07:36:39 -0000
@@ -1596,9 +1596,12 @@
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- apr_proc_detach();
- }
+ if (!one_process)
+ if (no_detach)
+ apr_proc_new_sessid();
+ else
+ apr_proc_detach();
+
parent_pid = ap_my_pid = getpid();
}
Index: srclib/apr/include/apr_thread_proc.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_thread_proc.h,v
retrieving revision 1.78
diff -u -r1.78 apr_thread_proc.h
--- srclib/apr/include/apr_thread_proc.h 27 Dec 2001 17:02:59 -0000 1.78
+++ srclib/apr/include/apr_thread_proc.h 8 Jan 2002 07:36:40 -0000
@@ -550,6 +550,11 @@
apr_pool_t *p);
/**
+ * Put the process in its own process group.
+ */
+APR_DECLARE(apr_status_t) apr_proc_new_sessid(void);
+
+/**
* Detach the process from the controlling terminal.
*/
APR_DECLARE(apr_status_t) apr_proc_detach(void);
Index: srclib/apr/threadproc/netware/procsup.c
===================================================================
RCS file: /home/cvspublic/apr/threadproc/netware/procsup.c,v
retrieving revision 1.1
diff -u -r1.1 procsup.c
--- srclib/apr/threadproc/netware/procsup.c 2 Aug 2001 20:29:14 -0000 1.1
+++ srclib/apr/threadproc/netware/procsup.c 8 Jan 2002 07:36:40 -0000
@@ -54,25 +54,11 @@
#include "threadproc.h"
-apr_status_t apr_proc_detach(void)
+apr_status_t apr_proc_new_sessid(void)
{
#if 0
- int x;
pid_t pgrp;
- chdir("/");
-#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS)
-/* Don't detach for MPE because child processes can't survive the death of
- the parent. */
- if ((x = fork()) > 0)
- exit(0);
- else if (x == -1) {
- perror("fork");
- fprintf(stderr, "unable to fork new process\n");
- exit(1); /* we can't do anything here, so just exit. */
- }
-/* RAISE_SIGSTOP(DETACH);*/
-#endif
#if APR_HAVE_SETSID
if ((pgrp = setsid()) == -1) {
return errno;
@@ -90,6 +76,31 @@
#else
if ((pgrp = setpgid(0, 0)) == -1) {
return errno;
+ }
+#endif
+
+ return APR_SUCCESS;
+}
+apr_status_t apr_proc_detach(void)
+{
+#if 0
+ int x;
+
+ chdir("/");
+#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS)
+/* Don't detach for MPE because child processes can't survive the death of
+ the parent. */
+ if ((x = fork()) > 0)
+ exit(0);
+ else if (x == -1) {
+ perror("fork");
+ fprintf(stderr, "unable to fork new process\n");
+ exit(1); /* we can't do anything here, so just exit. */
+ }
+/* RAISE_SIGSTOP(DETACH);*/
+#endif
+ if ((x = apr_proc_new_sessid()) != APR_SUCCESS) {
+ return x;
}
#endif
Index: srclib/apr/threadproc/os2/proc.c
===================================================================
RCS file: /home/cvspublic/apr/threadproc/os2/proc.c,v
retrieving revision 1.47
diff -u -r1.47 proc.c
--- srclib/apr/threadproc/os2/proc.c 26 Oct 2001 02:31:04 -0000 1.47
+++ srclib/apr/threadproc/os2/proc.c 8 Jan 2002 07:36:40 -0000
@@ -618,9 +618,12 @@
return APR_SUCCESS;
}
+APR_DECLARE(apr_status_t) apr_proc_new_sessid(void)
+{
+ return APR_ENOTIMPL;
+}
-
-APR_DECLARE(apr_status_t) apr_proc_detach()
+APR_DECLARE(apr_status_t) apr_proc_detach(void)
{
return APR_ENOTIMPL;
}
Index: srclib/apr/threadproc/unix/procsup.c
===================================================================
RCS file: /home/cvspublic/apr/threadproc/unix/procsup.c,v
retrieving revision 1.33
diff -u -r1.33 procsup.c
--- srclib/apr/threadproc/unix/procsup.c 28 Dec 2001 19:03:48 -0000 1.33
+++ srclib/apr/threadproc/unix/procsup.c 8 Jan 2002 07:36:41 -0000
@@ -54,24 +54,10 @@
#include "threadproc.h"
-APR_DECLARE(apr_status_t) apr_proc_detach(void)
+APR_DECLARE(apr_status_t) apr_proc_new_sessid(void)
{
- int x;
pid_t pgrp;
- chdir("/");
-#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS)
-/* Don't detach for MPE because child processes can't survive the death of
- the parent. */
- if ((x = fork()) > 0)
- exit(0);
- else if (x == -1) {
- perror("fork");
- fprintf(stderr, "unable to fork new process\n");
- exit(1); /* we can't do anything here, so just exit. */
- }
-/* RAISE_SIGSTOP(DETACH);*/
-#endif
#ifdef HAVE_SETSID
if ((pgrp = setsid()) == -1) {
return errno;
@@ -91,6 +77,31 @@
return errno;
}
#endif
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_proc_detach(void)
+{
+ int x;
+
+ chdir("/");
+#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS)
+/* Don't detach for MPE because child processes can't survive the death of
+ the parent. */
+ if ((x = fork()) > 0)
+ exit(0);
+ else if (x == -1) {
+ perror("fork");
+ fprintf(stderr, "unable to fork new process\n");
+ exit(1); /* we can't do anything here, so just exit. */
+ }
+/* RAISE_SIGSTOP(DETACH);*/
+#endif
+
+ if ((x = apr_proc_new_sessid()) != APR_SUCCESS) {
+ return x;
+ }
/* close out the standard file descriptors */
if (freopen("/dev/null", "r", stdin) == NULL) {
--
Jos Backus _/ _/_/_/ Santa Clara, CA
_/ _/ _/
_/ _/_/_/
_/ _/ _/ _/
[EMAIL PROTECTED] _/_/ _/_/_/ use Std::Disclaimer;