diff --git a/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h index a199f1f5142..d487596c364 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h @@ -7,6 +7,18 @@ #ifdef __cplusplus extern "C" { #endif +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_NOOP +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_NOOP 0L +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_HUP +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_HUP 1L +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_KILL +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_KILL 9L +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_TERM +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_TERM 15L +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_INT +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_INT 2L +#undef org_eclipse_cdt_utils_spawner_Spawner_SIG_CTRLC +#define org_eclipse_cdt_utils_spawner_Spawner_SIG_CTRLC 1000L /* * Class: org_eclipse_cdt_utils_spawner_Spawner * Method: exec0 diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c index 0155ebe4fa1..4a6abd52f0c 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c @@ -228,28 +228,28 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * int status = -1; switch (sig) { - case 0: /* NOOP */ + case org_eclipse_cdt_utils_spawner_Spawner_SIG_NOOP: status = killpg(pid, 0); if (status == -1) { status = kill(pid, 0); } break; - case 2: /* INTERRUPT */ + case org_eclipse_cdt_utils_spawner_Spawner_SIG_INT: status = killpg(pid, SIGINT); if (status == -1) { status = kill(pid, SIGINT); } break; - case 9: /* KILL */ + case org_eclipse_cdt_utils_spawner_Spawner_SIG_KILL: status = killpg(pid, SIGKILL); if (status == -1) { status = kill(pid, SIGKILL); } break; - case 15: /* TERM */ + case org_eclipse_cdt_utils_spawner_Spawner_SIG_TERM: status = killpg(pid, SIGTERM); if (status == -1) { status = kill(pid, SIGTERM); @@ -257,9 +257,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * break; default: - status = killpg(pid, sig); /* WHAT ?? */ + status = killpg(pid, sig); if (status == -1) { - status = kill(pid, sig); /* WHAT ?? */ + status = kill(pid, sig); } break; } diff --git a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c index 12c4baf3008..7952842dce6 100644 --- a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c +++ b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c @@ -78,16 +78,6 @@ static void cleanUpProcBlock(pProcInfo_t pCurProcInfo); int interruptProcess(int pid); -// Signal codes -typedef enum { - SIG_NOOP, // - SIG_HUP, // - SIG_INT, // - SIG_KILL = 9, // - SIG_TERM = 15, // - CTRLC = 1000 // special, Windows only. Sends CTRL-C in all cases, even when inferior is a Cygwin program -} signals; - extern CRITICAL_SECTION cs; extern wchar_t path[MAX_PATH]; // Directory where spawner.dll is located @@ -619,7 +609,7 @@ extern "C" pProcInfo_t pCurProcInfo = findProcInfo(uid); if (!pCurProcInfo) { - if (SIG_INT == signal) { // Try another way + if (org_eclipse_cdt_utils_spawner_Spawner_SIG_INT == signal) { // Try another way return interruptProcess(uid); } return -1; @@ -636,15 +626,15 @@ extern "C" } switch (signal) { - case SIG_NOOP: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_NOOP: // Wait 0 msec -just check if the process has been still running ret = ((WAIT_TIMEOUT == WaitForSingleObject(hProc, 0)) ? 0 : -1); break; - case SIG_HUP: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_HUP: // Temporary do nothing ret = 0; break; - case SIG_TERM: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_TERM: if (isTraceEnabled(CDT_TRACE_SPAWNER)) { cdtTrace(L"Spawner received TERM signal for process %i\n", pCurProcInfo->pid); } @@ -655,7 +645,7 @@ extern "C" ret = 0; break; - case SIG_KILL: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_KILL: if (isTraceEnabled(CDT_TRACE_SPAWNER)) { cdtTrace(L"Spawner received KILL signal for process %i\n", pCurProcInfo->pid); } @@ -665,12 +655,12 @@ extern "C" } ret = 0; break; - case SIG_INT: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_INT: ResetEvent(pCurProcInfo->eventWait.handle); SetEvent(pCurProcInfo->eventBreak.handle); ret = (WaitForSingleObject(pCurProcInfo->eventWait.handle, 100) == WAIT_OBJECT_0); break; - case CTRLC: + case org_eclipse_cdt_utils_spawner_Spawner_SIG_CTRLC: ResetEvent(pCurProcInfo->eventWait.handle); SetEvent(pCurProcInfo->eventCtrlc.handle); ret = (WaitForSingleObject(pCurProcInfo->eventWait.handle, 100) == WAIT_OBJECT_0); diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java index 803d124b5f7..f799a9aa4dd 100644 --- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java +++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/spawner/Spawner.java @@ -29,10 +29,31 @@ import org.eclipse.osgi.util.NLS; public class Spawner extends Process { - public int NOOP = 0; - public int HUP = 1; - public int KILL = 9; - public int TERM = 15; + @Deprecated(forRemoval = true) + public int NOOP = SIG_NOOP; + + @Deprecated(forRemoval = true) + public int HUP = SIG_HUP; + + @Deprecated(forRemoval = true) + public int KILL = SIG_KILL; + + @Deprecated(forRemoval = true) + public int TERM = SIG_TERM; + + @Deprecated(forRemoval = true) + public int INT = SIG_INT; + + /** + * @since 5.2 + */ + @Deprecated(forRemoval = true) + public int CTRLC = SIG_CTRLC; + + private final static int SIG_NOOP = 0; + private final static int SIG_HUP = 1; + private final static int SIG_KILL = 9; + private final static int SIG_TERM = 15; /** * On Windows, what this does is far from easy to explain. @@ -51,17 +72,14 @@ public class Spawner extends Process { * * * On non-Windows, raising this just raises a POSIX SIGINT - * */ - public int INT = 2; + private final static int SIG_INT = 2; /** * A fabricated signal number for use on Windows only. Tells the starter program to send a CTRL-C * regardless of whether the process is a Cygwin one or not. - * - * @since 5.2 */ - public int CTRLC = 1000; // arbitrary high number to avoid collision + private final static int SIG_CTRLC = 1000; // arbitrary high number to avoid collision int pid = 0; int status; @@ -323,7 +341,7 @@ public class Spawner extends Process { * linux, interrupt it by raising a SIGINT. */ public int interrupt() { - return raise(pid, INT); + return raise(pid, SIG_INT); } /** @@ -334,26 +352,26 @@ public class Spawner extends Process { */ public int interruptCTRLC() { if (Platform.getOS().equals(Platform.OS_WIN32)) { - return raise(pid, CTRLC); + return raise(pid, SIG_CTRLC); } else { return interrupt(); } } public int hangup() { - return raise(pid, HUP); + return raise(pid, SIG_HUP); } public int kill() { - return raise(pid, KILL); + return raise(pid, SIG_KILL); } public int terminate() { - return raise(pid, TERM); + return raise(pid, SIG_TERM); } public boolean isRunning() { - return (raise(pid, NOOP) == 0); + return (raise(pid, SIG_NOOP) == 0); } private void exec(String[] cmdarray, String[] envp, String dirpath) throws IOException { diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll index ca657101007..f75a4749e9e 100755 Binary files a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll and b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll differ diff --git a/doc/org.eclipse.cdt.doc.isv/guide/deprecated_API_removals.html b/doc/org.eclipse.cdt.doc.isv/guide/deprecated_API_removals.html index 5b9d5e6d62b..175c0e490b8 100644 --- a/doc/org.eclipse.cdt.doc.isv/guide/deprecated_API_removals.html +++ b/doc/org.eclipse.cdt.doc.isv/guide/deprecated_API_removals.html @@ -68,6 +68,7 @@
@@ -500,7 +501,7 @@
- The following classes have been removed from the API. + The following classes will be removed from the API.
See Bug 505882.
+ ++ The following constants will be removed from the Spawner API. +
+