You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/07/01 07:29:51 UTC

[lucy-commits] svn commit: r1141809 - in /incubator/lucy/branches/0.1: ./ core/Lucy/Util/ProcessID.c

Author: marvin
Date: Fri Jul  1 05:29:51 2011
New Revision: 1141809

URL: http://svn.apache.org/viewvc?rev=1141809&view=rev
Log:
LUCY-166 Prefer POSIX over Windows.h for process ID.

Use the POSIX interface for getting a PID when it is available, instead of the
windows.h interface.  This allows exec() to work properly under Cygwin and
fixes a failing test (t/109-shared_lock.t).

Modified:
    incubator/lucy/branches/0.1/   (props changed)
    incubator/lucy/branches/0.1/core/Lucy/Util/ProcessID.c

Propchange: incubator/lucy/branches/0.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul  1 05:29:51 2011
@@ -1 +1 @@
-/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140296,1140440,1140964
+/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140296,1140387,1140440,1140964

Modified: incubator/lucy/branches/0.1/core/Lucy/Util/ProcessID.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/core/Lucy/Util/ProcessID.c?rev=1141809&r1=1141808&r2=1141809&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/core/Lucy/Util/ProcessID.c (original)
+++ incubator/lucy/branches/0.1/core/Lucy/Util/ProcessID.c Fri Jul  1 05:29:51 2011
@@ -16,8 +16,34 @@
 
 #include "Lucy/Util/ProcessID.h"
 
+/********************************* UNIXEN *********************************/
+#if (defined(CHY_HAS_UNISTD_H) && defined(CHY_HAS_SIGNAL_H))
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+
+int
+lucy_PID_getpid(void) {
+    return getpid();
+}
+
+chy_bool_t
+lucy_PID_active(int pid) {
+    if (kill(pid, 0) == 0) {
+        return true; // signal succeeded, therefore pid active
+    }
+
+    if (errno != ESRCH) {
+        return true; // an error other than "pid not found", thus active
+    }
+
+    return false;
+}
+
 /********************************* WINDOWS ********************************/
-#if (defined(CHY_HAS_WINDOWS_H) && defined(CHY_HAS_PROCESS_H))
+#elif (defined(CHY_HAS_WINDOWS_H) && defined(CHY_HAS_PROCESS_H))
 
 #include <Windows.h>
 #include <process.h>
@@ -47,32 +73,6 @@ lucy_PID_active(int pid) {
     return false;
 }
 
-/********************************* UNIXEN *********************************/
-#elif (defined(CHY_HAS_UNISTD_H) && defined(CHY_HAS_SIGNAL_H))
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-int
-lucy_PID_getpid(void) {
-    return getpid();
-}
-
-chy_bool_t
-lucy_PID_active(int pid) {
-    if (kill(pid, 0) == 0) {
-        return true; // signal succeeded, therefore pid active
-    }
-
-    if (errno != ESRCH) {
-        return true; // an error other than "pid not found", thus active
-    }
-
-    return false;
-}
-
 #else
   #error "Can't find a known process ID API."
 #endif // OS switch.