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/06/28 06:28:52 UTC

[lucy-commits] svn commit: r1140432 - /incubator/lucy/trunk/core/Lucy/Util/ProcessID.c

Author: marvin
Date: Tue Jun 28 04:28:52 2011
New Revision: 1140432

URL: http://svn.apache.org/viewvc?rev=1140432&view=rev
Log:
LUCY-161 Don't use CreateHardLink under Cygwin. 

Unlike other Windows environments, Cygwin actually provides link() in unistd.h
-- so use it instead of CreateHardLink().

Modified:
    incubator/lucy/trunk/core/Lucy/Util/ProcessID.c

Modified: incubator/lucy/trunk/core/Lucy/Util/ProcessID.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Util/ProcessID.c?rev=1140432&r1=1140431&r2=1140432&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Util/ProcessID.c (original)
+++ incubator/lucy/trunk/core/Lucy/Util/ProcessID.c Tue Jun 28 04:28:52 2011
@@ -16,34 +16,8 @@
 
 #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 ********************************/
-#elif (defined(CHY_HAS_WINDOWS_H) && defined(CHY_HAS_PROCESS_H))
+#if (defined(CHY_HAS_WINDOWS_H) && defined(CHY_HAS_PROCESS_H) && !defined(__CYGWIN__))
 
 #include <Windows.h>
 #include <process.h>
@@ -73,6 +47,33 @@ 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.