You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/10/22 06:02:18 UTC

svn commit: r1534481 - in /subversion/branches/1.8.x: ./ STATUS build.conf subversion/libsvn_subr/sysinfo.c

Author: svn-role
Date: Tue Oct 22 04:02:18 2013
New Revision: 1534481

URL: http://svn.apache.org/r1534481
Log:
Merge r1534102 from trunk:

 * r1534102
   On Windows: stop linking agains psapi.dll.
   Justification:
     Removes a 100% dependency on Windows components that are usually not loaded.
     Affects initial performance of svn.exe invocations.
   Votes:
     +1: rhuijben, ivan, stefan2     

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/build.conf
    subversion/branches/1.8.x/subversion/libsvn_subr/sysinfo.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1534102

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1534481&r1=1534480&r2=1534481&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Tue Oct 22 04:02:18 2013
@@ -118,14 +118,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1534102
-   On Windows: stop linking agains psapi.dll.
-   Justification:
-     Removes a 100% dependency on Windows components that are usually not loaded.
-     Affects initial performance of svn.exe invocations.
-   Votes:
-     +1: rhuijben, ivan, stefan2     
-
  * r1527103, r1527105
    Fix OOM with concurrent requests right after threaded server start.
    Justification:

Modified: subversion/branches/1.8.x/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/build.conf?rev=1534481&r1=1534480&r2=1534481&view=diff
==============================================================================
--- subversion/branches/1.8.x/build.conf (original)
+++ subversion/branches/1.8.x/build.conf Tue Oct 22 04:02:18 2013
@@ -325,7 +325,7 @@ install = fsmod-lib
 path = subversion/libsvn_subr
 libs = aprutil apriconv apr xml zlib apr_memcache sqlite magic
 msvc-libs = kernel32.lib advapi32.lib shfolder.lib ole32.lib
-            crypt32.lib version.lib psapi.lib
+            crypt32.lib version.lib
 msvc-export = 
         svn_auth.h svn_base64.h svn_cache_config.h svn_checksum.h svn_cmdline.h
         svn_compat.h svn_config.h svn_ctype.h svn_dirent_uri.h svn_dso.h 

Modified: subversion/branches/1.8.x/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/sysinfo.c?rev=1534481&r1=1534480&r2=1534481&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_subr/sysinfo.c Tue Oct 22 04:02:18 2013
@@ -546,7 +546,7 @@ linux_release_name(apr_pool_t *pool)
 
 #ifdef WIN32
 typedef DWORD (WINAPI *FNGETNATIVESYSTEMINFO)(LPSYSTEM_INFO);
-typedef BOOL (WINAPI *FNENUMPROCESSMODULES) (HANDLE, HMODULE, DWORD, LPDWORD);
+typedef BOOL (WINAPI *FNENUMPROCESSMODULES) (HANDLE, HMODULE*, DWORD, LPDWORD);
 
 /* Get system and version info, and try to tell the difference
    between the native system type and the runtime environment of the
@@ -763,16 +763,36 @@ win32_release_name(apr_pool_t *pool)
 static HMODULE *
 enum_loaded_modules(apr_pool_t *pool)
 {
+  HMODULE psapi_dll = 0;
   HANDLE current = GetCurrentProcess();
   HMODULE dummy[1];
   HMODULE *handles;
   DWORD size;
+  FNENUMPROCESSMODULES EnumProcessModules_;
 
-  if (!EnumProcessModules(current, dummy, sizeof(dummy), &size))
+  psapi_dll = GetModuleHandleA("psapi.dll");
+
+  if (!psapi_dll)
+    {
+      /* Load and never unload, just like static linking */
+      psapi_dll = LoadLibraryA("psapi.dll");
+    }
+
+  if (!psapi_dll)
+      return NULL;
+
+  EnumProcessModules_ = (FNENUMPROCESSMODULES)
+                              GetProcAddress(psapi_dll, "EnumProcessModules");
+
+  /* Before Windows XP psapi was an optional module */
+  if (! EnumProcessModules_)
+    return NULL;
+
+  if (!EnumProcessModules_(current, dummy, sizeof(dummy), &size))
     return NULL;
 
   handles = apr_palloc(pool, size + sizeof *handles);
-  if (!EnumProcessModules(current, handles, size, &size))
+  if (! EnumProcessModules_(current, handles, size, &size))
     return NULL;
   handles[size / sizeof *handles] = NULL;
   return handles;