rbb 99/06/29 08:52:14
Modified: apr/include apr_win.h
apr/misc/win32 misc.def misc.dsp start.c
apr/network_io/win32 network_io.dsp
apr/test client.dsp server.dsp test.dsw testfile.dsp
testproc.dsp testsock.dsp timetest.dsp
apr/threadproc/win32 proc.c
include apr_general.h
Added: apr/signal/win32 signal.c signal.def signal.dsp
apr/test testsig.c
Log:
The abstracts out asynchsignals on Windows. This is NOT safe code to put in
a production
server yet, but it works, and that's more than it was doing earlier today.
Revision Changes Path
1.5 +37 -1 apache-apr/apr/include/apr_win.h
Index: apr_win.h
===================================================================
RCS file: /home/cvs/apache-apr/apr/include/apr_win.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apr_win.h 1999/06/18 19:10:58 1.4
+++ apr_win.h 1999/06/29 15:52:07 1.5
@@ -65,9 +65,42 @@
typedef enum {APR_WIN_NT, APR_WIN_95, APR_WIN_98} ap_oslevel_e;
+#define SIGHUP 1
+/* 2 is used for SIGINT on windows */
+#define SIGQUIT 3
+/* 4 is used for SIGILL on windows */
+#define SIGTRAP 5
+#define SIGIOT 6
+#define SIGBUS 7
+/* 8 is used for SIGFPE on windows */
+#define SIGKILL 9
+#define SIGUSR1 10
+/* 11 is used for SIGSEGV on windows */
+#define SIGUSR2 12
+#define SIGPIPE 13
+#define SIGALRM 14
+/* 15 is used for SIGTERM on windows */
+#define SIGSTKFLT 16
+#define SIGCHLD 17
+#define SIGCONT 18
+#define SIGSTOP 19
+#define SIGTSTP 20
+/* 21 is used for SIGBREAK on windows */
+/* 22 is used for SIGABRT on windows */
+#define SIGTTIN 23
+#define SIGTTOU 24
+#define SIGURG 25
+#define SIGXCPU 26
+#define SIGXFSZ 27
+#define SIGVTALRM 28
+#define SIGPROF 29
+#define SIGWINCH 30
+#define SIGIO 31
+
typedef _off_t off_t;
typedef int pid_t;
-typedef void Sigfunc(int);
+typedef void (Sigfunc)(int);
+typedef int ap_signum_t;
#define __attribute__(__x)
#define APR_INLINE
@@ -82,6 +115,9 @@
#define sleep(t) Sleep(t * 1000)
time_t WinTimeToUnixTime(FILETIME *);
+unsigned __stdcall SignalHandling(void *);
+
+int thread_ready(void);
#endif /*APR_WIN_H*/
#endif /*WIN32*/
1.4 +2 -1 apache-apr/apr/misc/win32/misc.def
Index: misc.def
===================================================================
RCS file: /home/cvs/apache-apr/apr/misc/win32/misc.def,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- misc.def 1999/06/23 15:00:08 1.3
+++ misc.def 1999/06/29 15:52:08 1.4
@@ -14,4 +14,5 @@
WinTimeToUnixTime @7
ap_get_oslevel @8
ap_get_userdata @9
- ap_set_userdata @10
\ No newline at end of file
+ ap_set_userdata @10
+ ap_initialize @11
\ No newline at end of file
1.3 +1 -1 apache-apr/apr/misc/win32/misc.dsp
Index: misc.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/misc/win32/misc.dsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- misc.dsp 1999/06/15 17:43:14 1.2
+++ misc.dsp 1999/06/29 15:52:08 1.3
@@ -77,7 +77,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib ws2_32.lib ..\..\lib\Debug\lib.lib /nologo /subsystem:windows /dll
/debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib ws2_32.lib ..\..\lib\Debug\lib.lib
..\..\signal\win32\Debug\signal.lib /nologo /subsystem:windows /dll /debug
/machine:I386 /pdbtype:sept
!ENDIF
1.6 +16 -0 apache-apr/apr/misc/win32/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/misc/win32/start.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- start.c 1999/06/23 15:00:08 1.5
+++ start.c 1999/06/29 15:52:08 1.6
@@ -60,6 +60,7 @@
#include "apr_pools.h"
#include "apr_lib.h"
#include <string.h>
+#include <process.h>
ap_status_t clean_cont(void *data)
{
@@ -194,3 +195,18 @@
return APR_ENOCONT;
}
+/* This puts one thread in a Listen for signals mode */
+ap_status_t ap_initialize(void)
+{
+ unsigned tid;
+
+ if (_beginthreadex(NULL, 0, SignalHandling, NULL, 0, &tid) == 0) {
+ return APR_EEXIST;
+ }
+
+ while (thread_ready() != 1) {
+ sleep(1);
+ }
+
+ return APR_SUCCESS;
+}
1.2 +1 -1 apache-apr/apr/network_io/win32/network_io.dsp
Index: network_io.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/network_io/win32/network_io.dsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- network_io.dsp 1999/06/14 19:11:16 1.1
+++ network_io.dsp 1999/06/29 15:52:09 1.2
@@ -79,7 +79,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib ws2_32.lib ..\..\lib\Debug\lib.lib
..\..\misc\win32\Debug\misc.lib /nologo /subsystem:windows /dll /debug
/machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib ws2_32.lib ..\..\lib\Debug\lib.lib ..\..\misc\win32\Debug\misc.lib
/nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
1.1 apache-apr/apr/signal/win32/signal.c
Index: signal.c
===================================================================
/* ====================================================================
* Copyright (c) 1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
*/
#include "apr_lib.h"
#include "apr_general.h"
#include "apr_win.h"
#include "apr_errno.h"
#include <windows.h>
#include <process.h>
static char *NewEvent;
static Sigfunc *sig_handler;
volatile int ready = 0;
ap_status_t ap_create_signal(ap_context_t *cont, ap_signum_t signum)
{
char *EventName;
int ppid;
char pidstr[10];
char sigstr[4];
SECURITY_ATTRIBUTES sa;
ppid = _getpid();
_itoa(ppid, pidstr, 10);
_itoa(signum, sigstr, 10);
EventName = ap_pstrcat(cont, "APR", pidstr, sigstr, NULL);
sa.nLength = sizeof(sa);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
if (CreateEvent(&sa, TRUE, FALSE, EventName) == NULL) {
return APR_EEXIST;
}
return APR_SUCCESS;
}
ap_status_t ap_signal(ap_context_t *cont, ap_signum_t signum)
{
HANDLE event;
char *EventName;
char *sigstr;
int ppid;
char pidstr[10];
ppid = _getpid();
_itoa(ppid, pidstr, 10);
_itoa(signum, sigstr, 10);
EventName = ap_pstrcat(cont, "APR", pidstr, sigstr, NULL);
event = OpenEvent(EVENT_ALL_ACCESS, FALSE, EventName);
if (event == NULL) {
return APR_EEXIST;
}
if (SetEvent(event) == 0) {
return APR_EEXIST;
}
return APR_SUCCESS;
}
ap_status_t ap_setup_signal(ap_context_t *cont, ap_signum_t signum, Sigfunc
*func)
{
HANDLE event;
char ppid[20];
char *sigstr;
event = OpenEvent(EVENT_ALL_ACCESS, FALSE, "EventRegister");
if (GetEnvironmentVariable("parentpid", ppid, 20) == 0) {
return APR_EEXIST;
}
sigstr = (char *)ap_palloc(cont, sizeof(int) * 10);
_itoa(signum, sigstr, 10);
NewEvent = ap_pstrcat(cont, "APR", ppid, sigstr, NULL);
sig_handler = func;
if (event == NULL) {
return APR_EEXIST;
}
if (SetEvent(event)) {
return APR_SUCCESS;
}
return APR_EEXIST;
}
unsigned int __stdcall SignalHandling(void *data)
{
int i = 1;
HANDLE eventlist[MAXIMUM_WAIT_OBJECTS];
Sigfunc *funclist[MAXIMUM_WAIT_OBJECTS];
DWORD rv;
if ((eventlist[0] = CreateEvent(NULL, TRUE, FALSE, "EventRegister")) ==
NULL) {
return APR_EEXIST;
}
sig_handler = NULL;
while (1) {
ready = 1;
rv = WaitForMultipleObjects(i, eventlist, FALSE, INFINITE);
if (rv == WAIT_FAILED) {
exit(-1);
}
else if (rv == WAIT_OBJECT_0){
eventlist[i] = OpenEvent(EVENT_ALL_ACCESS, TRUE, NewEvent);
funclist[i] = sig_handler;
i++;
ResetEvent(eventlist[0]);
}
else {
funclist[rv - WAIT_OBJECT_0](0);
ResetEvent(eventlist[rv - WAIT_OBJECT_0]);
}
}
}
int thread_ready(void)
{
return ready;
}
1.1 apache-apr/apr/signal/win32/signal.def
Index: signal.def
===================================================================
; signal.def :
LIBRARY signal
DESCRIPTION ''
EXPORTS
; Add new API calls to the end of this list.
ap_create_signal @1
ap_setup_signal @2
SignalHandling @3
ap_signal @4
thread_ready @5
1.1 apache-apr/apr/signal/win32/signal.dsp
Index: signal.dsp
===================================================================
# Microsoft Developer Studio Project File - Name="signal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=signal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "signal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "signal.mak" CFG="signal - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "signal - Win32 Release" (based on "Win32 (x86) Dynamic-Link
Library")
!MESSAGE "signal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "signal - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"
/YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX
/FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "signal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /I
"..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib ..\..\lib\Debug\lib.lib /nologo /subsystem:windows /dll /debug
/machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "signal - Win32 Release"
# Name "signal - Win32 Debug"
# Begin Source File
SOURCE=.\signal.c
# End Source File
# Begin Source File
SOURCE=.\signal.def
# End Source File
# End Target
# End Project
1.5 +1 -1 apache-apr/apr/test/client.dsp
Index: client.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/client.dsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- client.dsp 1999/06/24 14:16:15 1.4
+++ client.dsp 1999/06/29 15:52:11 1.5
@@ -73,7 +73,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.5 +1 -1 apache-apr/apr/test/server.dsp
Index: server.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/server.dsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- server.dsp 1999/06/24 14:16:17 1.4
+++ server.dsp 1999/06/29 15:52:11 1.5
@@ -73,7 +73,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.4 +12 -0 apache-apr/apr/test/test.dsw
Index: test.dsw
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/test.dsw,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- test.dsw 1999/06/18 19:11:00 1.3
+++ test.dsw 1999/06/29 15:52:11 1.4
@@ -51,6 +51,18 @@
###############################################################################
+Project: "testsig"=".\testsig.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "testsock"=".\testsock.dsp" - Package Owner=<4>
Package=<5>
1.7 +1 -1 apache-apr/apr/test/testfile.dsp
Index: testfile.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/testfile.dsp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- testfile.dsp 1999/06/24 14:16:18 1.6
+++ testfile.dsp 1999/06/29 15:52:11 1.7
@@ -74,7 +74,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.6 +1 -1 apache-apr/apr/test/testproc.dsp
Index: testproc.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/testproc.dsp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- testproc.dsp 1999/06/24 14:16:18 1.5
+++ testproc.dsp 1999/06/29 15:52:11 1.6
@@ -74,7 +74,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.5 +1 -1 apache-apr/apr/test/testsock.dsp
Index: testsock.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/testsock.dsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- testsock.dsp 1999/06/24 14:16:18 1.4
+++ testsock.dsp 1999/06/29 15:52:11 1.5
@@ -74,7 +74,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.4 +1 -1 apache-apr/apr/test/timetest.dsp
Index: timetest.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/timetest.dsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- timetest.dsp 1999/06/24 14:16:18 1.3
+++ timetest.dsp 1999/06/29 15:52:12 1.4
@@ -74,7 +74,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
-# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\locks\win32\debug\locks.lib ..\lib\Debug\lib.lib
..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib
..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib
..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib
..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
/pdbtype:sept
!ENDIF
1.1 apache-apr/apr/test/testsig.c
Index: testsig.c
===================================================================
/* ====================================================================
* Copyright (c) 1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
*/
#include "apr_thread_proc.h"
#include "apr_errno.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "errno.h"
#ifndef WIN32
#include <unistd.h>
#endif
#include <stdio.h>
#include <signal.h>
#include <string.h>
int time_to_die = 0;
void hup_handler(int sig)
{
fprintf(stdout, "I got the signal\n");
time_to_die++;
}
int main(int argc, char *argv[])
{
ap_context_t *context;
ap_proc_t *newproc;
ap_procattr_t *attr;
char *args[3];
ap_initialize();
ap_create_context(NULL, NULL, &context);
if (argc > 1) {
ap_setup_signal(context, APR_SIGHUP, hup_handler);
while(time_to_die == 0) {
sleep(1);
}
return (1);
}
fprintf(stdout, "Creating new signal.......");
if (ap_create_signal(context, APR_SIGHUP) != APR_SUCCESS) {
fprintf(stderr, "Could not create attr\n");
exit(-1);
}
fprintf(stdout, "OK\n");
if (ap_createprocattr_init(context, &attr) != APR_SUCCESS) {
fprintf(stderr, "Could not create attr\n");
exit(-1);;
}
ap_setprocattr_detach(attr, FALSE);
args[0] = ap_pstrdup(context, "testsig");
args[1] = ap_pstrdup(context, "-X");
args[2] = NULL;
if (ap_create_process(context, "../testproc", args, NULL, attr, &newproc)
!= APR_SUCCESS) {
fprintf(stderr, "Could not create the new process\n");
exit(-1);
}
/* sleep(100); /* Just wait a bit to let the child catch up. Not a great
idea, but
* this is just a test program, so it's okay in my book. :)
*/
fprintf(stdout, "Sending the signal.......");
ap_signal(context, APR_SIGHUP);
ap_wait_proc(newproc, APR_WAIT);
return(1);
}
1.5 +41 -2 apache-apr/apr/threadproc/win32/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/threadproc/win32/proc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- proc.c 1999/06/24 14:16:19 1.4
+++ proc.c 1999/06/29 15:52:13 1.5
@@ -62,6 +62,7 @@
#include "apr_lib.h"
#include <signal.h>
#include <string.h>
+#include <process.h>
ap_status_t ap_createprocattr_init(ap_context_t *cont, struct procattr_t
**new)
{
@@ -140,11 +141,16 @@
char *const args[], char **env,
struct procattr_t *attr, struct proc_t **new)
{
- int i;
+ int i, iEnvBlockLen;
char *cmdline;
HANDLE hCurrentProcess;
HANDLE hParentindup, hParentoutdup,hParenterrdup;
+ char ppid[20];
+ char *envstr;
+ char *pEnvBlock, *pNext;
+
+
(*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
if ((*new) == NULL) {
@@ -233,8 +239,41 @@
attr->parent_err->filehand = hParenterrdup;
}
}
+
+ _itoa(_getpid(), ppid, 10);
+ if (env) {
+
+ envstr = ap_pstrcat(cont, "parentpid=", ppid, NULL);
+ /*
+ * Win32's CreateProcess call requires that the environment
+ * be passed in an environment block, a null terminated block of
+ * null terminated strings.
+ */
+ i = 0;
+ iEnvBlockLen = 1;
+ while (env[i]) {
+ iEnvBlockLen += strlen(env[i]) + 1;
+ i++;
+ }
+
+ pEnvBlock = (char *)ap_pcalloc(cont, iEnvBlockLen + strlen(envstr));
+
+ i = 0;
+ pNext = pEnvBlock;
+ while (env[i]) {
+ strcpy(pNext, env[i]);
+ pNext = pNext + strlen(pNext) + 1;
+ i++;
+ }
+ strcpy(pNext, envstr);
+ }
+ else {
+ SetEnvironmentVariable("parentpid", ppid);
+ pEnvBlock = NULL;
+ }
+
- if (CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, env,
attr->currdir,
+ if (CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, pEnvBlock,
attr->currdir,
&attr->si, &(*new)->pi)) {
if (attr->detached) {
CloseHandle((*new)->pi.hProcess);
1.19 +99 -0 apache-apr/include/apr_general.h
Index: apr_general.h
===================================================================
RCS file: /home/cvs/apache-apr/include/apr_general.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- apr_general.h 1999/06/21 17:45:53 1.18
+++ apr_general.h 1999/06/29 15:52:14 1.19
@@ -70,6 +70,7 @@
#include <sys/types.h>
#endif
#ifdef WIN32
+#include "apr_win.h"
#include <windows.h>
#endif
#include "apr_errno.h"
@@ -84,6 +85,8 @@
#define TRUE 1
#define FALSE 0
+#define MAXIMUM_WAIT_OBJECTS 64
+
typedef short ap_int16_t;
typedef unsigned short ap_uint16_t;
typedef int ap_int32_t;
@@ -106,6 +109,97 @@
typedef struct context_t ap_context_t;
+#if SIGHUP
+#define APR_SIGHUP SIGHUP
+#endif
+#ifdef SIGINT
+#define APR_SIGINT SIGINT
+#endif
+#ifdef SIGQUIT
+#define APR_SIGQUIT SIGQUIT
+#endif
+#ifdef SIGILL
+#define APR_SIGILL SIGILL
+#endif
+#ifdef SIGTRAP
+#define APR_SIGTRAP SIGTRAP
+#endif
+#ifdef SIGABRT
+#define APR_SIGABRT SIGABRT
+#endif
+#ifdef SIGIOT
+#define APR_SIGIOT SIGIOT
+#endif
+#ifdef SIGBUS
+#define APR_SIGBUS SIGBUS
+#endif
+#ifdef SIGFPE
+#define APR_SIGFPE SIGFPE
+#endif
+#ifdef SIGKILL
+#define APR_SIGKILL SIGKILL
+#endif
+#ifdef SIGUSR1
+#define APR_SIGUSR1 SIGUSR1
+#endif
+#ifdef SIGSEGV
+#define APR_SIGSEGV SIGSEGV
+#endif
+#ifdef SIGUSR2
+#define APR_SIGUSR2 SIGUSR2
+#endif
+#ifdef SIGPIPE
+#define APR_SIGPIPE SIGPIPE
+#endif
+#ifdef SIGALRM
+#define APR_SIGALRM SIGALRM
+#endif
+#ifdef SIGTERM
+#define APR_SIGTERM SIGTERM
+#endif
+#ifdef SIGSTKFLT
+#define APR_SIGSTKFLT SIGSTKFLT
+#endif
+#ifdef SIGCHLD
+#define APR_SIGCHLD SIGCHLD
+#endif
+#ifdef SIGCONT
+#define APR_SIGCONT SIGCONT
+#endif
+#ifdef SIGSTOP
+#define APR_SIGSTOP SIGSTOP
+#endif
+#ifdef SIGTSTP
+#define APR_SIGTSTP SIGTSTP
+#endif
+#ifdef SIGTTIN
+#define APR_SIGTTIN SIGTTIN
+#endif
+#ifdef SIGTTOU
+#define APR_SIGTTOU SIGTTOU
+#endif
+#ifdef SIGURG
+#define APR_SIGURG SIGURG
+#endif
+#ifdef SIGXCPU
+#define APR_SIGXCPU SIGXCPU
+#endif
+#ifdef SIGXFSZ
+#define APR_SIGXFSZ SIGXFSZ
+#endif
+#ifdef SIGVTALRM
+#define APR_SIGVTALRM SIGVTALRM
+#endif
+#ifdef SIGPROF
+#define APR_SIGPROF SIGPROF
+#endif
+#ifdef SIGWINCH
+#define APR_SIGWINCH SIGWINCH
+#endif
+#ifdef SIGIO
+#define APR_SIGIO SIGIO
+#endif
+
/* Context functions */
ap_status_t ap_create_context(ap_context_t *, void *, ap_context_t **);
ap_status_t ap_set_signal_safe(ap_context_t *, ap_int16_t);
@@ -113,6 +207,11 @@
ap_status_t ap_exit(ap_context_t *);
ap_status_t ap_set_userdata(ap_context_t *, void *);
ap_status_t ap_get_userdata(ap_context_t *, void **);
+ap_status_t ap_initialize(void);
+
+ap_status_t ap_create_signal(ap_context_t *, ap_signum_t);
+ap_status_t ap_signal(ap_context_t *, ap_signum_t);
+ap_status_t ap_setup_signal(ap_context_t *, ap_signum_t, Sigfunc *);
#ifdef __cplusplus
}