You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/06/01 04:33:40 UTC

svn commit: r543365 - /apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h

Author: wrowe
Date: Thu May 31 19:33:39 2007
New Revision: 543365

URL: http://svn.apache.org/viewvc?view=rev&rev=543365
Log:
include/arch/win32/apr_arch_inherit.h defines macros that are used to implement
apr_mutex_inherit_set and unset and several other similar methods.  The current
header file will call SetHandleInformation in a block for Unicode supporting
versions of Windows and has a fallback for Win 9x.  The patch defines the macros
as just the Win9x compatible implementation for WinCE and leaves the other
definition for all other Windows variants.

PR: 39886
Submitted by: Curt Arnold <carnold apache.org>
Reviewed by: Davi Arnaut
Backport: 543363

Modified:
    apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h

Modified: apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h?view=diff&rev=543365&r1=543364&r2=543365
==============================================================================
--- apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h (original)
+++ apr/apr/branches/0.9.x/include/arch/win32/apr_arch_inherit.h Thu May 31 19:33:39 2007
@@ -21,6 +21,33 @@
 
 #define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
 
+#if defined(_WIN32_WCE)
+#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
+APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
+{                                                                   \
+        HANDLE temp, hproc = GetCurrentProcess();                   \
+        if (!DuplicateHandle(hproc, the##name->filehand,            \
+                             hproc, &temp, 0, TRUE,                 \
+                             DUPLICATE_SAME_ACCESS))                \
+            return apr_get_os_error();                              \
+        CloseHandle(the##name->filehand);                           \
+        the##name->filehand = temp;                                 \
+    return APR_SUCCESS;                                             \
+}
+
+#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
+APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\
+{                                                                   \
+        HANDLE temp, hproc = GetCurrentProcess();                   \
+        if (!DuplicateHandle(hproc, the##name->filehand,            \
+                             hproc, &temp, 0, FALSE,                \
+                             DUPLICATE_SAME_ACCESS))                \
+            return apr_get_os_error();                              \
+        CloseHandle(the##name->filehand);                           \
+        the##name->filehand = temp;                                 \
+    return APR_SUCCESS;                                             \
+}
+#else
 #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
 APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
 {                                                                   \
@@ -75,5 +102,6 @@
 {                                                                   \
     apr_##name##_inherit_unset(the##name);                          \
 }
+#endif
 
 #endif	/* ! INHERIT_H */