You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/16 09:17:32 UTC

svn commit: r815638 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/windows/acr_arch_private.h os/win32/posix.c test/testsuite.c

Author: mturk
Date: Wed Sep 16 07:17:31 2009
New Revision: 815638

URL: http://svn.apache.org/viewvc?rev=815638&view=rev
Log:
Export getppid in test mode

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c
    commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h?rev=815638&r1=815637&r2=815638&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h Wed Sep 16 07:17:31 2009
@@ -203,7 +203,15 @@
 char    *x_strdup_utf8(const wchar_t *);
 LPWSTR   MbsToWcs(DWORD, LPCSTR, LPWSTR, DWORD);
 LPSTR    WcsToMbs(DWORD, LPCWSTR, LPSTR, DWORD);
+
+/**
+ * Functions from posix.c
+ */
+#if defined(ACR_ENABLE_TEST)
+ACR_DECLARE(int) getppid(void);
+#else
 int      getppid(void);
+#endif
 
 /**
  * Wide char envvar functions from env.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c?rev=815638&r1=815637&r2=815638&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c Wed Sep 16 07:17:31 2009
@@ -24,7 +24,11 @@
 
 /* Something that is missing from CRT
  */
+#if defined(ACR_ENABLE_TEST)
+ACR_DECLARE(int) getppid()
+#else
 int getppid()
+#endif
 {
     static int      ppid = -1;
     HANDLE          snap;
@@ -36,12 +40,10 @@
          */
         return ppid;
     }
-    snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,
-                                    GetCurrentProcessId());
+    snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
     if (IS_INVALID_HANDLE(snap))
         return -1;
 
-    CloseHandle(snap);
     e.dwSize = (DWORD)sizeof(PROCESSENTRY32W);
     if (!Process32FirstW(snap, &e)) {
         CloseHandle(snap);

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c?rev=815638&r1=815637&r2=815638&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Wed Sep 16 07:17:31 2009
@@ -532,9 +532,12 @@
         return ACR_EINVAL;
     }
     if (*argv[0] == 's') {
-        printf("Server waiting %d\n", getpid());
+        printf("Server waiting %d parent=%d\n", getpid(), getppid());
 #if defined(WIN32)
         Sleep(20000);
+#else
+        /* TODO: Add portable ACR_Sleep() from APR
+         */
 #endif
     }
     else {