diff options
author | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-05-24 23:44:50 +0000 |
---|---|---|
committer | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-05-24 23:44:50 +0000 |
commit | d1b9dcab41778fa27f0fd86775472c97a51c3ab1 (patch) | |
tree | f688978e72bc91e7fbd8f5e135a48061ad9cd086 | |
parent | 6ac88a55f4018fc6018e9b381325ac9f6d14b3f2 (diff) | |
download | libapr-d1b9dcab41778fa27f0fd86775472c97a51c3ab1.tar.gz |
Win32: Convert ap_proc_t to tranparent type.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60096 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | apr.dsp | 5 | ||||
-rw-r--r-- | aprlib.def | 10 | ||||
-rw-r--r-- | aprlib.dsp | 5 | ||||
-rw-r--r-- | aprlibdll.dsp | 11 | ||||
-rw-r--r-- | include/arch/win32/threadproc.h | 6 | ||||
-rw-r--r-- | lib/apr_pools.c | 4 | ||||
-rw-r--r-- | libapr.def | 10 | ||||
-rw-r--r-- | libapr.dsp | 11 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 4 | ||||
-rw-r--r-- | threadproc/win32/proc.c | 98 | ||||
-rw-r--r-- | threadproc/win32/signals.c | 4 | ||||
-rw-r--r-- | threadproc/win32/threadproc.h | 6 |
12 files changed, 46 insertions, 128 deletions
@@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="aprlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 @@ -22,6 +22,7 @@ CFG=aprlib - Win32 Debug !MESSAGE # Begin Project +# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe @@ -65,7 +66,7 @@ LIB32=link.exe -lib # 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 /MDd /W3 /Gm /GX /Zi /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 diff --git a/aprlib.def b/aprlib.def index 845ac04b9..36fe4868c 100644 --- a/aprlib.def +++ b/aprlib.def @@ -92,9 +92,9 @@ EXPORTS ap_setprocattr_cmdtype @83 ap_setprocattr_detach @84 ap_create_process @85 - ap_get_childin @86 - ap_get_childout @87 - ap_get_childerr @88 +; ap_get_childin @86 +; ap_get_childout @87 +; ap_get_childerr @88 ap_wait_proc @89 ap_kill @90 ap_create_threadattr @91 @@ -113,9 +113,9 @@ EXPORTS ap_set_threaddata @104 ap_get_threadkeydata @105 ap_set_threadkeydata @106 - ap_get_procdata @107 +; ap_get_procdata @107 ; ap_set_procdata @108 - ap_get_os_proc @109 +; ap_get_os_proc @109 ap_get_os_thread @110 ap_get_os_threadkey @111 ap_os_systemcase_filename @112 diff --git a/aprlib.dsp b/aprlib.dsp index c0203ff77..8cf6c603a 100644 --- a/aprlib.dsp +++ b/aprlib.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="aprlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 @@ -22,6 +22,7 @@ CFG=aprlib - Win32 Debug !MESSAGE # Begin Project +# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe @@ -65,7 +66,7 @@ LIB32=link.exe -lib # 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 /MDd /W3 /Gm /GX /Zi /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 diff --git a/aprlibdll.dsp b/aprlibdll.dsp index e51f740f3..05c8fe9e0 100644 --- a/aprlibdll.dsp +++ b/aprlibdll.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="aprlibdll" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 @@ -17,13 +17,12 @@ CFG=aprlibdll - Win32 Debug !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "aprlibdll - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "aprlibdll - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") +!MESSAGE "aprlibdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "aprlibdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project +# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe @@ -71,7 +70,7 @@ LINK32=link.exe # 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 /MDd /W3 /Gm /GX /Zi /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" diff --git a/include/arch/win32/threadproc.h b/include/arch/win32/threadproc.h index 274626f61..936747783 100644 --- a/include/arch/win32/threadproc.h +++ b/include/arch/win32/threadproc.h @@ -92,11 +92,5 @@ struct ap_procattr_t { ap_int32_t detached; }; -struct ap_proc_t { - ap_pool_t *cntxt; - PROCESS_INFORMATION pi; - struct ap_procattr_t *attr; -}; - #endif /* ! THREAD_PROC_H */ diff --git a/lib/apr_pools.c b/lib/apr_pools.c index 488af83bf..c8976ba54 100644 --- a/lib/apr_pools.c +++ b/lib/apr_pools.c @@ -1302,10 +1302,8 @@ static void free_proc_chain(struct process_chain *procs) * Do we need an APR function to clean-up a proc_t? */ { - PROCESS_INFORMATION pi; for (p = procs; p; p = p->next) { - ap_get_os_proc(&pi, p->pid); - CloseHandle(pi.hProcess); + CloseHandle(p->pid->pid); } } #endif /* WIN32 */ diff --git a/libapr.def b/libapr.def index 845ac04b9..36fe4868c 100644 --- a/libapr.def +++ b/libapr.def @@ -92,9 +92,9 @@ EXPORTS ap_setprocattr_cmdtype @83 ap_setprocattr_detach @84 ap_create_process @85 - ap_get_childin @86 - ap_get_childout @87 - ap_get_childerr @88 +; ap_get_childin @86 +; ap_get_childout @87 +; ap_get_childerr @88 ap_wait_proc @89 ap_kill @90 ap_create_threadattr @91 @@ -113,9 +113,9 @@ EXPORTS ap_set_threaddata @104 ap_get_threadkeydata @105 ap_set_threadkeydata @106 - ap_get_procdata @107 +; ap_get_procdata @107 ; ap_set_procdata @108 - ap_get_os_proc @109 +; ap_get_os_proc @109 ap_get_os_thread @110 ap_get_os_threadkey @111 ap_os_systemcase_filename @112 diff --git a/libapr.dsp b/libapr.dsp index e51f740f3..05c8fe9e0 100644 --- a/libapr.dsp +++ b/libapr.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="aprlibdll" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 @@ -17,13 +17,12 @@ CFG=aprlibdll - Win32 Debug !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "aprlibdll - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "aprlibdll - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") +!MESSAGE "aprlibdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "aprlibdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project +# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe @@ -71,7 +70,7 @@ LINK32=link.exe # 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 /MDd /W3 /Gm /GX /Zi /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32" /I "misc/win32" /I "network_io/win32" /I "threadproc/win32" /I "time/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 488af83bf..c8976ba54 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -1302,10 +1302,8 @@ static void free_proc_chain(struct process_chain *procs) * Do we need an APR function to clean-up a proc_t? */ { - PROCESS_INFORMATION pi; for (p = procs; p; p = p->next) { - ap_get_os_proc(&pi, p->pid); - CloseHandle(pi.hProcess); + CloseHandle(p->pid->pid); } } #endif /* WIN32 */ diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 6d40919b9..4d22458c0 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -67,8 +67,7 @@ ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) { - (*new) = (ap_procattr_t *)ap_palloc(cont, - sizeof(ap_procattr_t)); + (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -183,7 +182,7 @@ ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t det) return APR_SUCCESS; } -ap_status_t ap_create_process(ap_proc_t **new, const char *progname, +ap_status_t ap_create_process(ap_proc_t *new, const char *progname, char *const args[], char **env, ap_procattr_t *attr, ap_pool_t *cont) { @@ -195,15 +194,11 @@ ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *envstr; char *pEnvBlock, *pNext; ap_status_t rv; + PROCESS_INFORMATION pi; - (*new) = (ap_proc_t *)ap_palloc(cont, sizeof(ap_proc_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->attr = attr; + new->in = attr->parent_in; + new->err = attr->parent_err; + new->out = attr->parent_out; attr->si.cb = sizeof(attr->si); if (attr->detached) { @@ -246,7 +241,7 @@ ap_status_t ap_create_process(ap_proc_t **new, const char *progname, cmdline = ap_pstrcat(cont, attr->currdir, progname, NULL); } else { - cmdline = ap_pstrcat(cont, attr->currdir, "\\", progname, NULL); + cmdline = ap_pstrcat(cont, attr->currdir, "\\", progname, NULL); } } } @@ -351,7 +346,10 @@ ap_status_t ap_create_process(ap_proc_t **new, const char *progname, if (CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, pEnvBlock, attr->currdir, - &attr->si, &(*new)->pi)) { + &attr->si, &pi)) { + + new->pid = pi.hProcess; + if (attr->child_in) { ap_close(attr->child_in); } @@ -361,39 +359,21 @@ ap_status_t ap_create_process(ap_proc_t **new, const char *progname, if (attr->child_err) { ap_close(attr->child_err); } - CloseHandle((*new)->pi.hThread); + CloseHandle(pi.hThread); + return APR_SUCCESS; } return GetLastError(); } -ap_status_t ap_get_childin(ap_file_t **new, ap_proc_t *proc) -{ - (*new) = proc->attr->parent_in; - return APR_SUCCESS; -} - -ap_status_t ap_get_childout(ap_file_t **new, ap_proc_t *proc) -{ - (*new) = proc->attr->parent_out; - return APR_SUCCESS; -} - -ap_status_t ap_get_childerr(ap_file_t **new, ap_proc_t *proc) -{ - (*new) = proc->attr->parent_err; - return APR_SUCCESS; -} - -ap_status_t ap_wait_proc(ap_proc_t *proc, - ap_wait_how_e wait) +ap_status_t ap_wait_proc(ap_proc_t *proc, ap_wait_how_e wait) { DWORD stat; if (!proc) return APR_ENOPROC; if (wait == APR_WAIT) { - if ((stat = WaitForSingleObject(proc->pi.hProcess, INFINITE)) == WAIT_OBJECT_0) { + if ((stat = WaitForSingleObject(proc->pid, INFINITE)) == WAIT_OBJECT_0) { return APR_CHILD_DONE; } else if (stat == WAIT_TIMEOUT) { @@ -401,7 +381,7 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, } return GetLastError(); } - if ((stat = WaitForSingleObject(proc->pi.hProcess, 0)) == WAIT_OBJECT_0) { + if ((stat = WaitForSingleObject(proc->pid, 0)) == WAIT_OBJECT_0) { return APR_CHILD_DONE; } else if (stat == WAIT_TIMEOUT) { @@ -410,49 +390,3 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, return GetLastError(); } -ap_status_t ap_get_procdata(char *key, void *data, ap_proc_t *proc) -{ - if (proc != NULL) { - return ap_get_userdata(data, key, proc->cntxt); - } - else { - data = NULL; - return APR_ENOPROC; - } -} - -ap_status_t ap_set_procdata(void *data, char *key, - ap_status_t (*cleanup) (void *), - ap_proc_t *proc) -{ - if (proc != NULL) { - return ap_set_userdata(data, key, cleanup, proc->cntxt); - } - else { - data = NULL; - return APR_ENOPROC; - } -} - -ap_status_t ap_get_os_proc(ap_os_proc_t *theproc, ap_proc_t *proc) -{ - if (proc == NULL) { - return APR_ENOPROC; - } - *theproc = proc->pi; - return APR_SUCCESS; -} - -ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, - ap_pool_t *cont) -{ - if (cont == NULL) { - return APR_ENOPOOL; - } - if ((*proc) == NULL) { - (*proc) = (ap_proc_t *)ap_palloc(cont, sizeof(ap_proc_t)); - (*proc)->cntxt = cont; - } - (*proc)->pi = *theproc; - return APR_SUCCESS; -} diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c index 08119b78d..0de2653f1 100644 --- a/threadproc/win32/signals.c +++ b/threadproc/win32/signals.c @@ -66,8 +66,8 @@ /* Windows only really support killing process, but that will do for now. */ ap_status_t ap_kill(ap_proc_t *proc, int signal) { - if (TerminateProcess(proc->pi.hProcess, signal) == 0) { - return errno; + if (TerminateProcess(proc->pid, signal) == 0) { + return GetLastError(); } return APR_SUCCESS; } diff --git a/threadproc/win32/threadproc.h b/threadproc/win32/threadproc.h index 274626f61..936747783 100644 --- a/threadproc/win32/threadproc.h +++ b/threadproc/win32/threadproc.h @@ -92,11 +92,5 @@ struct ap_procattr_t { ap_int32_t detached; }; -struct ap_proc_t { - ap_pool_t *cntxt; - PROCESS_INFORMATION pi; - struct ap_procattr_t *attr; -}; - #endif /* ! THREAD_PROC_H */ |