Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2006-04-27 16:16:09 +0000
committerMarkus Schorn2006-04-27 16:16:09 +0000
commit8272805b36b67b9ff569349292cb36493c207acc (patch)
tree8ce7840c92b011e6fd06a9884b0051bc47041a11 /core/org.eclipse.cdt.core.linux
parent488356be7df7f9ab91bf4ce3bb58ad28061554db (diff)
downloadorg.eclipse.cdt-8272805b36b67b9ff569349292cb36493c207acc.tar.gz
org.eclipse.cdt-8272805b36b67b9ff569349292cb36493c207acc.tar.xz
org.eclipse.cdt-8272805b36b67b9ff569349292cb36493c207acc.zip
Changes to source to fix 119618, binaries to be compiled.
Diffstat (limited to 'core/org.eclipse.cdt.core.linux')
-rw-r--r--core/org.eclipse.cdt.core.linux/library/io.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.linux/library/io.c b/core/org.eclipse.cdt.core.linux/library/io.c
index 6070f33f29b..f63fca77104 100644
--- a/core/org.eclipse.cdt.core.linux/library/io.c
+++ b/core/org.eclipse.cdt.core.linux/library/io.c
@@ -14,6 +14,10 @@
#include <SpawnerOutputStream.h>
#include <unistd.h>
+#define INT_MAX 2147483647
+
+JNIEXPORT jint JNICALL JVM_Available(jint fd, jlong *pbytes);
+
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerOutputStream */
@@ -71,6 +75,30 @@ Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv * env,
return close(fd);
}
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0(JNIEnv * env,
+ jobject jobj,
+ jint fd)
+{
+ jlong ret;
+
+ if (JVM_Available(fd, &ret)) {
+ if (ret > INT_MAX) {
+ ret = (jlong) INT_MAX;
+ }
+ return (jint)ret;
+ }
+
+ /* Error, toss an exception */
+ jclass exception = (*env)->FindClass(env, "java/io/IOException");
+ if (exception == NULL) {
+ /* Give up. */
+ return -1;
+ }
+ (*env)->ThrowNew(env, exception, NULL);
+ return 0;
+}
+
/*
* Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
* Method: write0

Back to the top