stoddard 01/05/17 05:20:03
Modified: . CHANGES apr.dsp libapr.dsp
include apr.hw
misc/unix otherchild.c
Log:
Add APR_HAS_OTHER_CHILD support to Win32
Revision Changes Path
1.106 +1 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- CHANGES 2001/05/16 19:14:39 1.105
+++ CHANGES 2001/05/17 12:19:45 1.106
@@ -1,4 +1,5 @@
Changes with APR b1
+ *) Add other child support to Win32 [Bill Stoddard]
*) Other-child registrations are automatically removed when the
associated pool is destroyed. This avoids garbage in the list
1.70 +9 -6 apr/apr.dsp
Index: apr.dsp
===================================================================
RCS file: /home/cvs/apr/apr.dsp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- apr.dsp 2001/04/08 08:06:15 1.69
+++ apr.dsp 2001/05/17 12:19:47 1.70
@@ -26,6 +26,7 @@
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
+RSC=rc.exe
!IF "$(CFG)" == "apr - Win32 Release"
@@ -39,11 +40,10 @@
# PROP Output_Dir "LibR"
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
-RSC=rc.exe
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD
/c
# ADD CPP /nologo /MD /W3 /O2 /I "./include" /I "./include/arch" /I
"./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D
"APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibR\apr" /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -64,11 +64,10 @@
# PROP Intermediate_Dir "LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
-RSC=rc.exe
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "./include" /I "./include/arch" /I
"./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D
"APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibD\apr" /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -179,6 +178,10 @@
# Begin Source File
SOURCE=.\misc\win32\names.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\misc\unix\otherchild.c
# End Source File
# Begin Source File
1.29 +4 -0 apr/libapr.dsp
Index: libapr.dsp
===================================================================
RCS file: /home/cvs/apr/libapr.dsp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- libapr.dsp 2001/04/11 17:01:50 1.28
+++ libapr.dsp 2001/05/17 12:19:49 1.29
@@ -187,6 +187,10 @@
# End Source File
# Begin Source File
+SOURCE=.\misc\unix\otherchild.c
+# End Source File
+# Begin Source File
+
SOURCE=.\misc\win32\rand.c
# End Source File
# Begin Source File
1.66 +1 -1 apr/include/apr.hw
Index: apr.hw
===================================================================
RCS file: /home/cvs/apr/include/apr.hw,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- apr.hw 2001/05/16 05:33:26 1.65
+++ apr.hw 2001/05/17 12:19:56 1.66
@@ -198,7 +198,7 @@
#define APR_HAS_FORK 0
#define APR_HAS_RANDOM 1
#define APR_HAS_XLATE 0
-#define APR_HAS_OTHER_CHILD 0
+#define APR_HAS_OTHER_CHILD 1
#define APR_HAS_DSO 1
#define APR_HAS_UNICODE_FS 1
#define APR_HAS_USER 1
1.24 +39 -1 apr/misc/unix/otherchild.c
Index: otherchild.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/otherchild.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- otherchild.c 2001/05/16 20:55:55 1.23
+++ otherchild.c 2001/05/17 12:20:01 1.24
@@ -102,10 +102,18 @@
ocr->maintenance = maintenance;
ocr->data = data;
if (write_fd == NULL) {
- ocr->write_fd = -1;
+ ocr->write_fd = (apr_os_file_t) -1;
}
else {
+#ifdef WIN32
+ /* This should either go away as part of eliminating
apr_proc_probe_writable_fds
+ * or write_fd should point to an apr_file_t
+ */
+ ocr->write_fd = write_fd->filehand;
+#else
ocr->write_fd = write_fd->filedes;
+#endif
+
}
ocr->next = other_children;
other_children = ocr;
@@ -145,7 +153,36 @@
}
return APR_CHILD_NOTDONE;
}
+#ifdef WIN32
+/*
+ * Run the list of Other Children and restart the ones that have died.
+ * ToDo: APR'ize this function so it will serve Unix and Win32.
+ * Not clear to me how to make the Win32 function behave exactly like
+ * the non-win32 branch. wgs
+ */
+APR_DECLARE(void) apr_proc_other_child_check(void)
+{
+ apr_other_child_rec_t *ocr, *nocr;
+ apr_status_t rv;
+
+ /* Todo:
+ * Implement code to detect if a pipe is still alive on Windows.
+ */
+ if (other_children == NULL)
+ return;
+
+ for (ocr = other_children; ocr; ocr = nocr) {
+ nocr = ocr->next;
+ if (ocr->id == -1)
+ continue;
+ rv = WaitForSingleObject((HANDLE) ocr->id, 0);
+ if (rv != WAIT_TIMEOUT) {
+ (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1);
+ }
+ }
+}
+#else /* Win32 */
APR_DECLARE(void) apr_proc_other_child_check(void)
{
apr_other_child_rec_t *ocr, *nocr;
@@ -172,5 +209,6 @@
}
}
}
+#endif
#endif /* APR_HAS_OTHER_CHILD */