mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Remove o.e.cdt.core.linux.ai64 and o.e.cdt.core.qnx
Remove the entire two plugins and the two references I could find to them. Change-Id: I0ab7f24503b737f5cf711616a1eabd1f59d092f0
This commit is contained in:
parent
bb0ba6fd91
commit
df63a59b53
44 changed files with 1 additions and 1636 deletions
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>org.eclipse.cdt.core.linux.ia64</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,8 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: %fragmentName.linux.ia64
|
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.linux.ia64;singleton:=true
|
|
||||||
Bundle-Version: 5.2.0.qualifier
|
|
||||||
Bundle-Vendor: %providerName
|
|
||||||
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[5.7.0,6.0.0)"
|
|
||||||
Bundle-Localization: plugin
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
|
||||||
|
|
||||||
<body lang="EN-US">
|
|
||||||
<h2>About This Content</h2>
|
|
||||||
|
|
||||||
<p>June 22, 2007</p>
|
|
||||||
<h3>License</h3>
|
|
||||||
|
|
||||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
|
||||||
indicated below, the Content is provided to you under the terms and conditions of the
|
|
||||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
|
||||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
|
||||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
|
||||||
|
|
||||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
|
||||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
|
||||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
|
||||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
|
||||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
|
||||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
|
||||||
|
|
||||||
</body></html>
|
|
|
@ -1,14 +0,0 @@
|
||||||
###############################################################################
|
|
||||||
# Copyright (c) 2005, 2009 IBM Corporation and others.
|
|
||||||
# All rights reserved. This program and the accompanying materials
|
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
# which accompanies this distribution, and is available at
|
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
#
|
|
||||||
# Contributors:
|
|
||||||
# IBM Corporation - initial API and implementation
|
|
||||||
###############################################################################
|
|
||||||
bin.includes = os/,\
|
|
||||||
about.html,\
|
|
||||||
META-INF/
|
|
||||||
src.includes = about.html
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.eclipse.cdt</groupId>
|
|
||||||
<artifactId>cdt-parent</artifactId>
|
|
||||||
<version>9.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<version>5.2.0-SNAPSHOT</version>
|
|
||||||
<artifactId>org.eclipse.cdt.core.linux.ia64</artifactId>
|
|
||||||
<packaging>eclipse-plugin</packaging>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
|
||||||
<artifactId>target-platform-configuration</artifactId>
|
|
||||||
<version>${tycho-version}</version>
|
|
||||||
<configuration>
|
|
||||||
<resolver>p2</resolver>
|
|
||||||
<pomDependencies>consider</pomDependencies>
|
|
||||||
<environments>
|
|
||||||
<environment>
|
|
||||||
<os>linux</os>
|
|
||||||
<ws>gtk</ws>
|
|
||||||
<arch>ia64</arch>
|
|
||||||
</environment>
|
|
||||||
</environments>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
|
||||||
<artifactId>tycho-source-plugin</artifactId>
|
|
||||||
<version>${tycho-version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>plugin-source</id>
|
|
||||||
<phase>none</phase>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>attach-source</id>
|
|
||||||
<phase>none</phase>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1 +0,0 @@
|
||||||
bin
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>org.eclipse.cdt.core.qnx</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,36 +0,0 @@
|
||||||
2004-03-25 David Inglis
|
|
||||||
|
|
||||||
Added platform attribute to processlist extension
|
|
||||||
|
|
||||||
* plugin.xml
|
|
||||||
|
|
||||||
2002-11-12 Alain Magloire
|
|
||||||
|
|
||||||
Fix Pr 26005
|
|
||||||
* library/spawner/spawner.c (waitFor):
|
|
||||||
The waitFor(int) JNI on QNX is returning the PID of the
|
|
||||||
process rather then the status of the process
|
|
||||||
on exit.
|
|
||||||
Patch from Chris Mckillop.
|
|
||||||
|
|
||||||
2002-11-04 Alain Magloire
|
|
||||||
|
|
||||||
* library/pty/pty.c: New file.
|
|
||||||
* library/pty/ptyio.c: New file.
|
|
||||||
* library/pty/openpty.c: New file.
|
|
||||||
* library/pty/openpty.h: New file.
|
|
||||||
* library/pty/PTY.h: new File.
|
|
||||||
* library/pty/PTYInputStream.h: new File.
|
|
||||||
* library/pty/PTYOutputStream.h: new File.
|
|
||||||
|
|
||||||
2002-10-17 Alain Magloire
|
|
||||||
|
|
||||||
* os/qnx/x86/libspawner.so: Regenarated.
|
|
||||||
Thanks to Alex Chapiro.
|
|
||||||
|
|
||||||
2002-10-17 Alain Magloire
|
|
||||||
|
|
||||||
* library/spawner.c (exec0) : This function was
|
|
||||||
leaking memory at every call, the environment array
|
|
||||||
and the argument array was not free(). There is no
|
|
||||||
need to do the strdup() of cwd.
|
|
|
@ -1,10 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: %fragmentName.qnx
|
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.qnx; singleton:=true
|
|
||||||
Bundle-Version: 5.2.0.qualifier
|
|
||||||
Bundle-ClassPath: cdt_qnx.jar
|
|
||||||
Bundle-Vendor: %providerName
|
|
||||||
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[5.7.0,6.0.0)"
|
|
||||||
Bundle-Localization: plugin
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
|
||||||
|
|
||||||
<body lang="EN-US">
|
|
||||||
<h2>About This Content</h2>
|
|
||||||
|
|
||||||
<p>June 22, 2007</p>
|
|
||||||
<h3>License</h3>
|
|
||||||
|
|
||||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
|
||||||
indicated below, the Content is provided to you under the terms and conditions of the
|
|
||||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
|
||||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
|
||||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
|
||||||
|
|
||||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
|
||||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
|
||||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
|
||||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
|
||||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
|
||||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
|
||||||
|
|
||||||
</body></html>
|
|
|
@ -1,19 +0,0 @@
|
||||||
###############################################################################
|
|
||||||
# Copyright (c) 2005, 2007 IBM Corporation and others.
|
|
||||||
# All rights reserved. This program and the accompanying materials
|
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
# which accompanies this distribution, and is available at
|
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
#
|
|
||||||
# Contributors:
|
|
||||||
# IBM Corporation - initial API and implementation
|
|
||||||
###############################################################################
|
|
||||||
bin.includes = fragment.xml,\
|
|
||||||
about.html,\
|
|
||||||
os/,\
|
|
||||||
cdt_qnx.jar,\
|
|
||||||
META-INF/
|
|
||||||
source.cdt_qnx.jar = src/
|
|
||||||
src.includes = about.html,\
|
|
||||||
library/,\
|
|
||||||
build.properties
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<?eclipse version="3.0"?>
|
|
||||||
<fragment>
|
|
||||||
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.cdt.core.ProcessList">
|
|
||||||
<processList
|
|
||||||
platform="qnx"
|
|
||||||
class="org.eclipse.cdt.internal.core.qnx.ProcessList">
|
|
||||||
</processList>
|
|
||||||
</extension>
|
|
||||||
</fragment>
|
|
|
@ -1,3 +0,0 @@
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
*.a
|
|
|
@ -1,8 +0,0 @@
|
||||||
LIST=ALL
|
|
||||||
ifndef QRECURSE
|
|
||||||
QRECURSE=recurse.mk
|
|
||||||
ifdef QCONFIG
|
|
||||||
QRDIR=$(dir $(QCONFIG))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
include $(QRDIR)$(QRECURSE)
|
|
|
@ -1,8 +0,0 @@
|
||||||
LIST=CPU
|
|
||||||
ifndef QRECURSE
|
|
||||||
QRECURSE=recurse.mk
|
|
||||||
ifdef QCONFIG
|
|
||||||
QRDIR=$(dir $(QCONFIG))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
include $(QRDIR)$(QRECURSE)
|
|
|
@ -1,22 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class org_eclipse_cdt_utils_pty_PTY */
|
|
||||||
|
|
||||||
#ifndef _Included_org_eclipse_cdt_utils_pty_PTY
|
|
||||||
#define _Included_org_eclipse_cdt_utils_pty_PTY
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/* Inaccessible static: hasPTY */
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTY
|
|
||||||
* Method: openMaster
|
|
||||||
* Signature: ()Ljava/lang/String;
|
|
||||||
*/
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
|
|
||||||
(JNIEnv *, jobject);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class org_eclipse_cdt_utils_pty_PTYInputStream */
|
|
||||||
|
|
||||||
#ifndef _Included_org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
#define _Included_org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#undef org_eclipse_cdt_utils_pty_PTYInputStream_SKIP_BUFFER_SIZE
|
|
||||||
#define org_eclipse_cdt_utils_pty_PTYInputStream_SKIP_BUFFER_SIZE 2048L
|
|
||||||
/* Inaccessible static: skipBuffer */
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
* Method: read0
|
|
||||||
* Signature: (I[BI)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
|
|
||||||
(JNIEnv *, jobject, jint, jbyteArray, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0
|
|
||||||
(JNIEnv *, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,29 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class org_eclipse_cdt_utils_pty_PTYOutputStream */
|
|
||||||
|
|
||||||
#ifndef _Included_org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
#define _Included_org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
* Method: write0
|
|
||||||
* Signature: (I[BI)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0
|
|
||||||
(JNIEnv *, jobject, jint, jbyteArray, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0
|
|
||||||
(JNIEnv *, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,14 +0,0 @@
|
||||||
ifndef QCONFIG
|
|
||||||
QCONFIG=qconfig.mk
|
|
||||||
endif
|
|
||||||
include $(QCONFIG)
|
|
||||||
|
|
||||||
include $(MKFILES_ROOT)/qtargets.mk
|
|
||||||
|
|
||||||
ifeq ($(OS),nto)
|
|
||||||
ifeq ($(IVEHOME),)
|
|
||||||
IVEHOME:=/opt/vame/ive/bin
|
|
||||||
endif
|
|
||||||
EXTRA_INCVPATH+=$(IVEHOME)/include
|
|
||||||
endif
|
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <grp.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is taken from R. W. Stevens book.
|
|
||||||
* Alain Magloire.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ptym_open (char *pts_name);
|
|
||||||
int ptys_open (int fdm, char * pts_name);
|
|
||||||
|
|
||||||
int
|
|
||||||
openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
|
|
||||||
{
|
|
||||||
char line[20];
|
|
||||||
line[0]=0;
|
|
||||||
*amaster = ptym_open(line);
|
|
||||||
if (*amaster < 0)
|
|
||||||
return -1;
|
|
||||||
*aslave = ptys_open(*amaster, line);
|
|
||||||
if (*aslave < 0) {
|
|
||||||
close(*amaster);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (name)
|
|
||||||
strcpy(name, line);
|
|
||||||
#ifndef TCSAFLUSH
|
|
||||||
#define TCSAFLUSH TCSETAF
|
|
||||||
#endif
|
|
||||||
if (termp)
|
|
||||||
(void) tcsetattr(*aslave, TCSAFLUSH, termp);
|
|
||||||
#ifdef TIOCSWINSZ
|
|
||||||
if (winp)
|
|
||||||
(void) ioctl(*aslave, TIOCSWINSZ, (char *)winp);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ptym_open(char * pts_name)
|
|
||||||
{
|
|
||||||
char *ptr1, *ptr2;
|
|
||||||
int fdm;
|
|
||||||
|
|
||||||
strcpy(pts_name, "/dev/ptyXY");
|
|
||||||
/* array index: 012345689 (for references in following code) */
|
|
||||||
for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++) {
|
|
||||||
pts_name[8] = *ptr1;
|
|
||||||
for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++) {
|
|
||||||
pts_name[9] = *ptr2;
|
|
||||||
/* try to open master */
|
|
||||||
fdm = open(pts_name, O_RDWR);
|
|
||||||
if (fdm < 0) {
|
|
||||||
if (errno == ENOENT) {/* different from EIO */
|
|
||||||
return -1; /* out of pty devices */
|
|
||||||
} else {
|
|
||||||
continue; /* try next pty device */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pts_name[5] = 't'; /* chage "pty" to "tty" */
|
|
||||||
return fdm; /* got it, return fd of master */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1; /* out of pty devices */
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ptys_open(int fdm, char * pts_name)
|
|
||||||
{
|
|
||||||
int gid, fds;
|
|
||||||
struct group *grptr;
|
|
||||||
|
|
||||||
grptr = getgrnam("tty");
|
|
||||||
if (grptr != NULL) {
|
|
||||||
gid = grptr->gr_gid;
|
|
||||||
} else {
|
|
||||||
gid = -1; /* group tty is not in the group file */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* following two functions don't work unless we're root */
|
|
||||||
chown(pts_name, getuid(), gid);
|
|
||||||
chmod(pts_name, S_IRUSR | S_IWUSR | S_IWGRP);
|
|
||||||
fds = open(pts_name, O_RDWR);
|
|
||||||
if (fds < 0) {
|
|
||||||
close(fdm);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return fds;
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#ifndef _OPENPTY_H
|
|
||||||
#define _OPENPTY_H
|
|
||||||
int ptym_open (char *pts_name);
|
|
||||||
int ptys_open (int fdm, char * pts_name);
|
|
||||||
#endif
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#include "PTY.h"
|
|
||||||
#include "openpty.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTY
|
|
||||||
* Method: forkpty
|
|
||||||
* Signature: ()I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jstring JNICALL
|
|
||||||
Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
|
||||||
jfieldID fid; /* Store the field ID */
|
|
||||||
jstring jstr = NULL;
|
|
||||||
int master = -1;
|
|
||||||
char line[1024]; /* FIXME: Should be enough */
|
|
||||||
jclass cls;
|
|
||||||
|
|
||||||
line[0] = '\0';
|
|
||||||
|
|
||||||
master = ptym_open(line);
|
|
||||||
if (master >= 0) {
|
|
||||||
/* Get a reference to the obj's class */
|
|
||||||
cls = (*env)->GetObjectClass(env, jobj);
|
|
||||||
|
|
||||||
/* Set the master fd. */
|
|
||||||
fid = (*env)->GetFieldID(env, cls, "master", "I");
|
|
||||||
if (fid == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
(*env)->SetIntField(env, jobj, fid, (jint)master);
|
|
||||||
|
|
||||||
/* Create a new String for the slave. */
|
|
||||||
jstr = (*env)->NewStringUTF(env, line);
|
|
||||||
}
|
|
||||||
return jstr;
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#include <jni.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <PTYInputStream.h>
|
|
||||||
#include <PTYOutputStream.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
/* Header for class _org_eclipse_cdt_utils_pty_PTYInputStream */
|
|
||||||
/* Header for class _org_eclipse_cdt_utils_pty_PTYOutputStream */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
* Method: read0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv * env,
|
|
||||||
jobject jobj,
|
|
||||||
jint jfd,
|
|
||||||
jbyteArray buf,
|
|
||||||
jint buf_len)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int status;
|
|
||||||
jbyte *data;
|
|
||||||
int data_len;
|
|
||||||
|
|
||||||
data = (*env)->GetByteArrayElements(env, buf, 0);
|
|
||||||
data_len = buf_len;
|
|
||||||
fd = jfd;
|
|
||||||
|
|
||||||
status = read( fd, data, data_len );
|
|
||||||
(*env)->ReleaseByteArrayElements(env, buf, data, 0);
|
|
||||||
|
|
||||||
if (status == 0) {
|
|
||||||
/* EOF. */
|
|
||||||
status = -1;
|
|
||||||
} else if (status == -1) {
|
|
||||||
/* Error, toss an exception */
|
|
||||||
jclass exception = (*env)->FindClass(env, "java/io/IOException");
|
|
||||||
if (exception == NULL) {
|
|
||||||
/* Give up. */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
(*env)->ThrowNew(env, exception, "read error");
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv * env,
|
|
||||||
jobject jobj,
|
|
||||||
jint fd)
|
|
||||||
{
|
|
||||||
return close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
* Method: write0
|
|
||||||
* Signature: (II)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv * env,
|
|
||||||
jobject jobj,
|
|
||||||
jint jfd,
|
|
||||||
jbyteArray buf,
|
|
||||||
jint buf_len)
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
int fd;
|
|
||||||
jbyte *data;
|
|
||||||
int data_len;
|
|
||||||
|
|
||||||
data = (*env)->GetByteArrayElements(env, buf, 0);
|
|
||||||
data_len = buf_len;
|
|
||||||
fd = jfd;
|
|
||||||
|
|
||||||
status = write(fd, data, data_len);
|
|
||||||
(*env)->ReleaseByteArrayElements(env, buf, data, 0);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv * env,
|
|
||||||
jobject jobj,
|
|
||||||
jint fd)
|
|
||||||
{
|
|
||||||
return close(fd);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
LIST=VARIANT
|
|
||||||
ifndef QRECURSE
|
|
||||||
QRECURSE=recurse.mk
|
|
||||||
ifdef QCONFIG
|
|
||||||
QRDIR=$(dir $(QCONFIG))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
include $(QRDIR)$(QRECURSE)
|
|
|
@ -1 +0,0 @@
|
||||||
include ../../common.mk
|
|
|
@ -1,8 +0,0 @@
|
||||||
LIST=CPU
|
|
||||||
ifndef QRECURSE
|
|
||||||
QRECURSE=recurse.mk
|
|
||||||
ifdef QCONFIG
|
|
||||||
QRDIR=$(dir $(QCONFIG))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
include $(QRDIR)$(QRECURSE)
|
|
|
@ -1,53 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class org_eclipse_cdt_utils_spawner_Spawner */
|
|
||||||
|
|
||||||
#ifndef _Included_org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
#define _Included_org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
* Method: exec0
|
|
||||||
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
|
|
||||||
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
* Method: exec1
|
|
||||||
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
|
|
||||||
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
* Method: exec2
|
|
||||||
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
|
||||||
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
* Method: raise
|
|
||||||
* Signature: (II)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
|
|
||||||
(JNIEnv *, jobject, jint, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
|
||||||
* Method: waitFor
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
|
|
||||||
(JNIEnv *, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class com_qnx_tools_utils_spawner_SpawnerInputStream */
|
|
||||||
|
|
||||||
#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
|
|
||||||
#define _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#undef com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE
|
|
||||||
#define com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE 2048L
|
|
||||||
/* Inaccessible static: skipBuffer */
|
|
||||||
/*
|
|
||||||
* Class: org_elipse_cdt_utils_spawner_SpawnerInputStream
|
|
||||||
* Method: read0
|
|
||||||
* Signature: (I[BI)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
|
|
||||||
(JNIEnv *, jobject, jint, jbyteArray, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
|
|
||||||
(JNIEnv *, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,29 +0,0 @@
|
||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class com_qnx_tools_utils_spawner_SpawnerOutputStream */
|
|
||||||
|
|
||||||
#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
|
|
||||||
#define _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
|
|
||||||
* Method: write0
|
|
||||||
* Signature: (I[BI)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
|
|
||||||
(JNIEnv *, jobject, jint, jbyteArray, jint);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
|
|
||||||
(JNIEnv *, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,14 +0,0 @@
|
||||||
ifndef QCONFIG
|
|
||||||
QCONFIG=qconfig.mk
|
|
||||||
endif
|
|
||||||
include $(QCONFIG)
|
|
||||||
|
|
||||||
include $(MKFILES_ROOT)/qtargets.mk
|
|
||||||
|
|
||||||
ifeq ($(OS),nto)
|
|
||||||
ifeq ($(IVEHOME),)
|
|
||||||
IVEHOME:=/opt/vame/ive/bin
|
|
||||||
endif
|
|
||||||
EXTRA_INCVPATH+=$(IVEHOME)/include
|
|
||||||
endif
|
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
/* iostream.c
|
|
||||||
*
|
|
||||||
* This is a JNI implementation of access to standard i/o streams
|
|
||||||
*/
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "SpawnerInputStream.h"
|
|
||||||
#include "SpawnerOutputStream.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "jni.h"
|
|
||||||
|
|
||||||
|
|
||||||
void ThrowByName(JNIEnv *env, const char *name, const char *msg);
|
|
||||||
|
|
||||||
#define BUFF_SIZE (1024)
|
|
||||||
|
|
||||||
/* Inaccessible static: skipBuffer */
|
|
||||||
/*
|
|
||||||
* Class: SpawnerInputStream
|
|
||||||
* Method: read0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
|
|
||||||
(JNIEnv * env, jobject proc, jint fd, jbyteArray buf, jint len)
|
|
||||||
{
|
|
||||||
unsigned char tmpBuf[BUFF_SIZE];
|
|
||||||
int nBuffOffset = 0;
|
|
||||||
// printf("Come to read0\n");
|
|
||||||
while(len > nBuffOffset)
|
|
||||||
{
|
|
||||||
int nReadLen = min(len - nBuffOffset, BUFF_SIZE);
|
|
||||||
int nread;
|
|
||||||
nread = read(fd, tmpBuf, nReadLen);
|
|
||||||
if(nread > 0)
|
|
||||||
(*env) -> SetByteArrayRegion(env, buf, nBuffOffset, nReadLen, tmpBuf);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
nBuffOffset += nread;
|
|
||||||
if(nread != nReadLen)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// printf("Leave read with %i bytes read\n", nBuffOffset);
|
|
||||||
return nBuffOffset; // This is a real full readed length
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: SpawnerInputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
|
|
||||||
(JNIEnv * env, jobject proc, jint fd)
|
|
||||||
{
|
|
||||||
return close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: SpawnerOutputStream
|
|
||||||
* Method: write0
|
|
||||||
* Signature: (I[BI)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
|
|
||||||
(JNIEnv * env, jobject proc, jint fd, jbyteArray buf, jint len)
|
|
||||||
{
|
|
||||||
unsigned char tmpBuf[BUFF_SIZE];
|
|
||||||
int nBuffOffset = 0;
|
|
||||||
// int rc = 0;
|
|
||||||
// printf("Come to write0, len = %i\n", len);
|
|
||||||
while(len > nBuffOffset)
|
|
||||||
{
|
|
||||||
int nWriteLen = min(len - nBuffOffset, BUFF_SIZE);
|
|
||||||
(*env) -> GetByteArrayRegion(env, buf, nBuffOffset, nWriteLen, tmpBuf);
|
|
||||||
// printf("Write %i bytes; last byte = %#x\n", nWriteLen, (int)tmpBuf[nWriteLen - 1]);
|
|
||||||
if(nWriteLen != write(fd, tmpBuf, nWriteLen))
|
|
||||||
{
|
|
||||||
// printf("Error: written %i bytes; errno = %i, fd = %i, len = %i ", nWriteLen, errno, fd, rc);
|
|
||||||
ThrowByName(env, "java/io/IOException", strerror(errno));
|
|
||||||
}
|
|
||||||
nBuffOffset += nWriteLen;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: SpawnerOutputStream
|
|
||||||
* Method: close0
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
|
|
||||||
(JNIEnv * env, jobject proc, jint fd)
|
|
||||||
{
|
|
||||||
return close(fd);
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <grp.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is taken from R. W. Stevens book.
|
|
||||||
* Alain Magloire.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ptym_open (char *pts_name);
|
|
||||||
int ptys_open (int fdm, char * pts_name);
|
|
||||||
|
|
||||||
int
|
|
||||||
openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
|
|
||||||
{
|
|
||||||
char line[20];
|
|
||||||
line[0]=0;
|
|
||||||
*amaster = ptym_open(line);
|
|
||||||
if (*amaster < 0)
|
|
||||||
return -1;
|
|
||||||
*aslave = ptys_open(*amaster, line);
|
|
||||||
if (*aslave < 0) {
|
|
||||||
close(*amaster);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (name)
|
|
||||||
strcpy(name, line);
|
|
||||||
#ifndef TCSAFLUSH
|
|
||||||
#define TCSAFLUSH TCSETAF
|
|
||||||
#endif
|
|
||||||
if (termp)
|
|
||||||
(void) tcsetattr(*aslave, TCSAFLUSH, termp);
|
|
||||||
#ifdef TIOCSWINSZ
|
|
||||||
if (winp)
|
|
||||||
(void) ioctl(*aslave, TIOCSWINSZ, (char *)winp);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ptym_open(char * pts_name)
|
|
||||||
{
|
|
||||||
char *ptr1, *ptr2;
|
|
||||||
int fdm;
|
|
||||||
|
|
||||||
strcpy(pts_name, "/dev/ptyXY");
|
|
||||||
/* array index: 012345689 (for references in following code) */
|
|
||||||
for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++) {
|
|
||||||
pts_name[8] = *ptr1;
|
|
||||||
for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++) {
|
|
||||||
pts_name[9] = *ptr2;
|
|
||||||
/* try to open master */
|
|
||||||
fdm = open(pts_name, O_RDWR);
|
|
||||||
if (fdm < 0) {
|
|
||||||
if (errno == ENOENT) {/* different from EIO */
|
|
||||||
return -1; /* out of pty devices */
|
|
||||||
} else {
|
|
||||||
continue; /* try next pty device */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pts_name[5] = 't'; /* chage "pty" to "tty" */
|
|
||||||
return fdm; /* got it, return fd of master */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1; /* out of pty devices */
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ptys_open(int fdm, char * pts_name)
|
|
||||||
{
|
|
||||||
int gid, fds;
|
|
||||||
struct group *grptr;
|
|
||||||
|
|
||||||
grptr = getgrnam("tty");
|
|
||||||
if (grptr != NULL) {
|
|
||||||
gid = grptr->gr_gid;
|
|
||||||
} else {
|
|
||||||
gid = -1; /* group tty is not in the group file */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* following two functions don't work unless we're root */
|
|
||||||
chown(pts_name, getuid(), gid);
|
|
||||||
chmod(pts_name, S_IRUSR | S_IWUSR | S_IWGRP);
|
|
||||||
fds = open(pts_name, O_RDWR);
|
|
||||||
if (fds < 0) {
|
|
||||||
close(fdm);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return fds;
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#ifndef _OPENPTY_H
|
|
||||||
#define _OPENPTY_H
|
|
||||||
int ptym_open (char *pts_name);
|
|
||||||
int ptys_open (int fdm, char * pts_name);
|
|
||||||
#endif
|
|
|
@ -1,397 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <spawn.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#include "Spawner.h"
|
|
||||||
|
|
||||||
typedef JNIEXPORT void * (JNICALL * JVM_GetThreadInterruptEvent)();
|
|
||||||
typedef JNIEXPORT char * (JNICALL * JVM_NativePath)(const char *);
|
|
||||||
|
|
||||||
void ThrowByName(JNIEnv *env, const char *name, const char *msg);
|
|
||||||
void * GetJVMProc(char * vmlib, char * procName);
|
|
||||||
|
|
||||||
static void * hVM = NULL; /* Java Virtual Machine handler. */
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
|
|
||||||
(JNIEnv * env, jobject proc, jobjectArray cmdArray, jobjectArray envp, jstring dir, jintArray channels)
|
|
||||||
{
|
|
||||||
int fd_map[3]; /* File descriptors. */
|
|
||||||
int fd_ret[3]; /* File descriptors that we return to Java. */
|
|
||||||
int fd[2]; /* Pipe open structure. */
|
|
||||||
int i;
|
|
||||||
int nParms = 0;/* Number of parameters. */
|
|
||||||
int nEnvs = 0;/* Number of environment variables. */
|
|
||||||
char ** pParms = NULL; /* Parameters. */
|
|
||||||
char ** pEnvs = NULL; /* Environment variables. */
|
|
||||||
char * pCommand = NULL; /* Command to execute. */
|
|
||||||
char cwd[PATH_MAX + 1]; /* Current working directory. */
|
|
||||||
pid_t pid; /* Process ID. */
|
|
||||||
struct inheritance inherit;
|
|
||||||
|
|
||||||
if ((cmdArray == NULL) || ((nParms = (*env)->GetArrayLength(env, cmdArray)) == 0))
|
|
||||||
ThrowByName(env, "java/lang/IOException", "No command line specified");
|
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
if (EOK != pipe(fd))
|
|
||||||
ThrowByName(env, "java/io/IOException", "Cannot create pipe for spawner");
|
|
||||||
if (0 == i) {
|
|
||||||
fd_map[i] = fd[0];
|
|
||||||
fd_ret[i] = fd[1];
|
|
||||||
} else {
|
|
||||||
fd_map[i] = fd[1];
|
|
||||||
fd_ret[i] = fd[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nParms > 0) {
|
|
||||||
pParms = malloc(sizeof(char *) * (nParms + 1));
|
|
||||||
for (i = 0; i < nParms; ++i) {
|
|
||||||
jobject item = (*env)->GetObjectArrayElement(env, cmdArray, i);
|
|
||||||
const char *str = (*env)->GetStringUTFChars(env, item, 0);
|
|
||||||
if (i == 0)
|
|
||||||
pCommand = strdup(str);
|
|
||||||
pParms[i] = strdup(str);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pParms[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nEnvs = (*env) -> GetArrayLength(env, envp);
|
|
||||||
if (nEnvs > 0) {
|
|
||||||
pEnvs = malloc(sizeof(char *) * (nEnvs + 1));
|
|
||||||
for (i = 0; i < nEnvs; ++i) {
|
|
||||||
jobject item = (*env)->GetObjectArrayElement(env, envp, i);
|
|
||||||
const char *str = (*env)->GetStringUTFChars(env, item, 0);
|
|
||||||
pEnvs[i] = strdup(str);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pEnvs[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dir != 0) {
|
|
||||||
char *item = (char *)(*env)->GetStringUTFChars(env, dir, 0);
|
|
||||||
getcwd(cwd, sizeof(cwd));
|
|
||||||
chdir(item);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, dir, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nothing for now. */
|
|
||||||
memset(&inherit, 0, sizeof(inherit));
|
|
||||||
inherit.flags = SPAWN_SETGROUP;
|
|
||||||
inherit.pgroup = SPAWN_NEWPGROUP;
|
|
||||||
|
|
||||||
pid = spawnp(pCommand, 3, fd_map, &inherit, pParms, pEnvs);
|
|
||||||
|
|
||||||
if (dir != 0) /* Restore working directory. */
|
|
||||||
chdir(cwd);
|
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
close(fd_map[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-1 == pid) { /* Failed - close pipes. */
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
close(fd_ret[i]);
|
|
||||||
}
|
|
||||||
} else { /* Success - return pipes to Java. */
|
|
||||||
(*env) -> SetIntArrayRegion(env, channels, 0, 3, fd_ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Parameters. */
|
|
||||||
if (pParms != NULL) {
|
|
||||||
int j;
|
|
||||||
for (j = 0; pParms[j] != NULL; j++) {
|
|
||||||
if (pParms[j] != NULL) {
|
|
||||||
free(pParms[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(pParms);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Environment variables. */
|
|
||||||
if (pEnvs != NULL) {
|
|
||||||
int j;
|
|
||||||
for (j = 0; pEnvs[j] != NULL; j++) {
|
|
||||||
if (pEnvs[j] != NULL) {
|
|
||||||
free(pEnvs[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(pEnvs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Command to execute. */
|
|
||||||
if (pCommand != NULL) {
|
|
||||||
free(pCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pid;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
|
|
||||||
(JNIEnv * env, jobject proc, jobjectArray cmdArray, jobjectArray envp, jstring dir)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int nParms = 0;// Number of parameters
|
|
||||||
int nEnvs = 0;// Number of environment variables
|
|
||||||
char ** pParms = NULL; // Parameters
|
|
||||||
char ** pEnvs = NULL; // Environment variables
|
|
||||||
char * pCommand = NULL; // Command to execute
|
|
||||||
char * pwd = 0; // Process working directory
|
|
||||||
char cwd[PATH_MAX + 1]; // Current working directory
|
|
||||||
pid_t pid; // Process ID
|
|
||||||
struct inheritance inherit;
|
|
||||||
|
|
||||||
if ((cmdArray == 0) || ((nParms = (*env) -> GetArrayLength(env, cmdArray)) == 0))
|
|
||||||
ThrowByName(env, "java/lang/NullPointerException", "No command line specified");
|
|
||||||
|
|
||||||
if(nParms > 0)
|
|
||||||
{
|
|
||||||
pParms = malloc(sizeof(char *) * (nParms + 1));
|
|
||||||
for(i = 0; i < nParms; ++i)
|
|
||||||
{
|
|
||||||
jobject item = (*env) -> GetObjectArrayElement(env, cmdArray, i);
|
|
||||||
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
|
|
||||||
if(i == 0)
|
|
||||||
pCommand = strdup(str);
|
|
||||||
pParms[i] = strdup(str);
|
|
||||||
(*env) -> ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pParms[i] = NULL;
|
|
||||||
}
|
|
||||||
nEnvs = (*env) -> GetArrayLength(env, envp);
|
|
||||||
if(nEnvs > 0)
|
|
||||||
{
|
|
||||||
pEnvs = malloc(sizeof(char *) * (nEnvs + 1));
|
|
||||||
for(i = 0; i < nEnvs; ++i)
|
|
||||||
{
|
|
||||||
jobject item = (*env) -> GetObjectArrayElement(env, envp, i);
|
|
||||||
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
|
|
||||||
pEnvs[i] = strdup(str);
|
|
||||||
(*env) -> ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pEnvs[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dir != 0)
|
|
||||||
{
|
|
||||||
char * item;
|
|
||||||
pwd = strdup(item = (char *)(*env) -> GetStringUTFChars(env, dir, 0));
|
|
||||||
getcwd(cwd, sizeof(cwd));
|
|
||||||
chdir(pwd);
|
|
||||||
(*env) -> ReleaseStringUTFChars(env, dir, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nothing for now
|
|
||||||
memset(&inherit, 0, sizeof(inherit));
|
|
||||||
inherit.flags = SPAWN_SETGROUP;
|
|
||||||
inherit.pgroup = SPAWN_NEWPGROUP;
|
|
||||||
|
|
||||||
|
|
||||||
pid = spawnp(pCommand, 0, NULL, &inherit, pParms, pEnvs);
|
|
||||||
|
|
||||||
|
|
||||||
if(dir != 0) // Restore working directory
|
|
||||||
chdir(cwd);
|
|
||||||
|
|
||||||
return pid;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
|
||||||
(JNIEnv * env, jobject proc, jobjectArray cmdArray, jobjectArray envp, jstring dir, jintArray channels, jstring jslave, jint master)
|
|
||||||
{
|
|
||||||
int fd_map[3]; /* File descriptors. */
|
|
||||||
int fd_ret[3]; /* File descriptors that we return to Java. */
|
|
||||||
int fd[2]; /* Pipe open structure. */
|
|
||||||
int i;
|
|
||||||
int nParms = 0;/* Number of parameters. */
|
|
||||||
int nEnvs = 0;/* Number of environment variables. */
|
|
||||||
char ** pParms = NULL; /* Parameters. */
|
|
||||||
char ** pEnvs = NULL; /* Environment variables. */
|
|
||||||
char * pCommand = NULL; /* Command to execute. */
|
|
||||||
char cwd[PATH_MAX + 1]; /* Current working directory. */
|
|
||||||
pid_t pid; /* Process ID. */
|
|
||||||
struct inheritance inherit;
|
|
||||||
|
|
||||||
if ((cmdArray == NULL) || ((nParms = (*env)->GetArrayLength(env, cmdArray)) == 0)) {
|
|
||||||
ThrowByName(env, "java/lang/IOException", "No command line specified");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
char *pts_name = (char *)(*env)->GetStringUTFChars(env, jslave, 0);
|
|
||||||
int fds = ptys_open(master, pts_name);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, jslave, pts_name);
|
|
||||||
if (fds == -1) {
|
|
||||||
ThrowByName(env, "java/io/IOException", "Cannot create pipe for spawner");
|
|
||||||
}
|
|
||||||
if (EOK != pipe(fd)) {
|
|
||||||
ThrowByName(env, "java/io/IOException", "Cannot create pipe for spawner");
|
|
||||||
}
|
|
||||||
fd_map[0] = fd_map[1] = fds;
|
|
||||||
fd_map[2] = fd[1];
|
|
||||||
fd_ret[0] = fd_ret[1] = master;
|
|
||||||
fd_ret[3] = fd[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nParms > 0) {
|
|
||||||
pParms = malloc(sizeof(char *) * (nParms + 1));
|
|
||||||
for (i = 0; i < nParms; ++i) {
|
|
||||||
jobject item = (*env)->GetObjectArrayElement(env, cmdArray, i);
|
|
||||||
const char *str = (*env)->GetStringUTFChars(env, item, 0);
|
|
||||||
if (i == 0)
|
|
||||||
pCommand = strdup(str);
|
|
||||||
pParms[i] = strdup(str);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pParms[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nEnvs = (*env) -> GetArrayLength(env, envp);
|
|
||||||
if (nEnvs > 0) {
|
|
||||||
pEnvs = malloc(sizeof(char *) * (nEnvs + 1));
|
|
||||||
for (i = 0; i < nEnvs; ++i) {
|
|
||||||
jobject item = (*env)->GetObjectArrayElement(env, envp, i);
|
|
||||||
const char *str = (*env)->GetStringUTFChars(env, item, 0);
|
|
||||||
pEnvs[i] = strdup(str);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, item, str);
|
|
||||||
}
|
|
||||||
pEnvs[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dir != 0) {
|
|
||||||
char *item = (char *)(*env)->GetStringUTFChars(env, dir, 0);
|
|
||||||
getcwd(cwd, sizeof(cwd));
|
|
||||||
chdir(item);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, dir, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nothing for now. */
|
|
||||||
memset(&inherit, 0, sizeof(inherit));
|
|
||||||
inherit.flags = SPAWN_SETGROUP;
|
|
||||||
inherit.pgroup = SPAWN_NEWPGROUP;
|
|
||||||
|
|
||||||
pid = spawnp(pCommand, 3, fd_map, &inherit, pParms, pEnvs);
|
|
||||||
|
|
||||||
if (dir != 0) /* Restore working directory. */
|
|
||||||
chdir(cwd);
|
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
close(fd_map[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-1 == pid) { /* Failed - close pipes. */
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
close(fd_ret[i]);
|
|
||||||
}
|
|
||||||
} else { /* Success - return pipes to Java. */
|
|
||||||
(*env) -> SetIntArrayRegion(env, channels, 0, 3, fd_ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Parameters. */
|
|
||||||
if (pParms != NULL) {
|
|
||||||
int j;
|
|
||||||
for (j = 0; pParms[j] != NULL; j++) {
|
|
||||||
if (pParms[j] != NULL) {
|
|
||||||
free(pParms[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(pParms);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Environment variables. */
|
|
||||||
if (pEnvs != NULL) {
|
|
||||||
int j;
|
|
||||||
for (j = 0; pEnvs[j] != NULL; j++) {
|
|
||||||
if (pEnvs[j] != NULL) {
|
|
||||||
free(pEnvs[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(pEnvs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free Command to execute. */
|
|
||||||
if (pCommand != NULL) {
|
|
||||||
free(pCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pid;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_qnx_tools_utils_spawner_Spawner
|
|
||||||
* Method: raise
|
|
||||||
* Signature: (II)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
|
|
||||||
(JNIEnv * env, jobject proc, jint pid, jint sig)
|
|
||||||
{
|
|
||||||
return kill(pid, sig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_qnx_tools_utils_spawner_Spawner
|
|
||||||
* Method: waitFor
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
|
|
||||||
(JNIEnv * env, jobject proc, jint pid)
|
|
||||||
{
|
|
||||||
int ret, stat_loc;
|
|
||||||
int val = -1;
|
|
||||||
|
|
||||||
ret = waitpid(pid, &stat_loc, WEXITED);
|
|
||||||
if (ret == -1 && errno == EINTR) {
|
|
||||||
// Throw an exception here.
|
|
||||||
}
|
|
||||||
if (WIFEXITED(stat_loc)) {
|
|
||||||
val = WEXITSTATUS(stat_loc);
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Utilities
|
|
||||||
|
|
||||||
void ThrowByName(JNIEnv *env, const char *name, const char *msg)
|
|
||||||
{
|
|
||||||
jclass cls = (*env)->FindClass(env, name);
|
|
||||||
|
|
||||||
if (cls != 0) /* Otherwise an exception has already been thrown */
|
|
||||||
(*env)->ThrowNew(env, cls, msg);
|
|
||||||
|
|
||||||
/* It's a good practice to clean up the local references. */
|
|
||||||
(*env)->DeleteLocalRef(env, cls);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void * GetJVMProc(char * vmlib, char * procName)
|
|
||||||
{
|
|
||||||
if(NULL == vmlib)
|
|
||||||
vmlib = "libj9vm14.so";
|
|
||||||
if((NULL == hVM) || (NULL == procName))
|
|
||||||
{
|
|
||||||
if(NULL == (hVM = dlopen(vmlib, 0)))
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return dlsym(hVM, procName);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
LIST=VARIANT
|
|
||||||
ifndef QRECURSE
|
|
||||||
QRECURSE=recurse.mk
|
|
||||||
ifdef QCONFIG
|
|
||||||
QRDIR=$(dir $(QCONFIG))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
include $(QRDIR)$(QRECURSE)
|
|
|
@ -1 +0,0 @@
|
||||||
include ../../common.mk
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,55 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.qnx;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IProcessInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author alain
|
|
||||||
*
|
|
||||||
* To change this generated comment edit the template variable "typecomment":
|
|
||||||
* Window>Preferences>Java>Templates.
|
|
||||||
* To enable and disable the creation of type comments go to
|
|
||||||
* Window>Preferences>Java>Code Generation.
|
|
||||||
*/
|
|
||||||
public class ProcessInfo implements IProcessInfo {
|
|
||||||
|
|
||||||
int pid;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
public ProcessInfo(String pidString, String name) {
|
|
||||||
try {
|
|
||||||
pid = Integer.parseInt(pidString);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProcessInfo(int pid, String name) {
|
|
||||||
this.pid = pid;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.core.IProcessInfo#getName()
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.core.IProcessInfo#getPid()
|
|
||||||
*/
|
|
||||||
public int getPid() {
|
|
||||||
return pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.qnx;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IProcessInfo;
|
|
||||||
import org.eclipse.cdt.core.IProcessList;
|
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert the type's description here.
|
|
||||||
* @see IProcessList
|
|
||||||
*/
|
|
||||||
public class ProcessList implements IProcessList {
|
|
||||||
|
|
||||||
ProcessInfo[] empty = new ProcessInfo[0];
|
|
||||||
|
|
||||||
public ProcessList() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert the method's description here.
|
|
||||||
* @see IProcessList#getProcessList
|
|
||||||
*/
|
|
||||||
public IProcessInfo [] getProcessList() {
|
|
||||||
Process pidin;
|
|
||||||
BufferedReader pidinOutput;
|
|
||||||
String[] args = {"pidin", "-fan" }; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
try {
|
|
||||||
pidin = ProcessFactory.getFactory().exec(args);
|
|
||||||
pidinOutput = new BufferedReader(new InputStreamReader(pidin.getInputStream()));
|
|
||||||
} catch(Exception e) {
|
|
||||||
return getProcessListPureJava();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Read the output and parse it into an array list
|
|
||||||
ArrayList procInfo = new ArrayList();
|
|
||||||
|
|
||||||
String pidStr, nameStr, lastline;
|
|
||||||
try {
|
|
||||||
while((lastline = pidinOutput.readLine()) != null) {
|
|
||||||
//The format of the output should be
|
|
||||||
//PID a/slash/delimited/name
|
|
||||||
|
|
||||||
StringTokenizer tok = new StringTokenizer(lastline.trim());
|
|
||||||
pidStr = tok.nextToken();
|
|
||||||
if(pidStr == null || pidStr.charAt(0) < '0' || pidStr.charAt(0) > '9') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
nameStr = tok.nextToken();
|
|
||||||
|
|
||||||
int index = nameStr.lastIndexOf('/');
|
|
||||||
if(index != -1) {
|
|
||||||
nameStr = nameStr.substring(index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
procInfo.add(new ProcessInfo(pidStr, nameStr));
|
|
||||||
}
|
|
||||||
pidinOutput.close();
|
|
||||||
pidin.destroy();
|
|
||||||
} catch(Exception e) {
|
|
||||||
/* Ignore */
|
|
||||||
} finally {
|
|
||||||
pidin.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (IProcessInfo [])procInfo.toArray(new IProcessInfo[procInfo.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is our current backup strategy for getting the pid list
|
|
||||||
* (reading /proc directly). Currently the exename is not implemented
|
|
||||||
* so the names will all show up as unknown, but at least you get a
|
|
||||||
* pid list.
|
|
||||||
*/
|
|
||||||
private IProcessInfo [] getProcessListPureJava() {
|
|
||||||
File proc = new File("/proc"); //$NON-NLS-1$
|
|
||||||
File[] pidFiles = null;
|
|
||||||
|
|
||||||
// We are only interrested in the pid so filter the rest out.
|
|
||||||
try {
|
|
||||||
FilenameFilter filter = new FilenameFilter() {
|
|
||||||
public boolean accept(File dir, String name) {
|
|
||||||
boolean isPID = false;
|
|
||||||
try {
|
|
||||||
Integer.parseInt(name);
|
|
||||||
isPID = true;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
|
||||||
return isPID;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
pidFiles = proc.listFiles(filter);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessInfo[] processInfo = empty;
|
|
||||||
if (pidFiles != null) {
|
|
||||||
processInfo = new ProcessInfo[pidFiles.length];
|
|
||||||
for (int i = 0; i < pidFiles.length; i++) {
|
|
||||||
File cmdLine = new File(pidFiles[i], "exename"); //$NON-NLS-1$
|
|
||||||
StringBuffer line = new StringBuffer();
|
|
||||||
try {
|
|
||||||
FileReader reader = new FileReader(cmdLine);
|
|
||||||
int c;
|
|
||||||
while ((c = reader.read()) > 0) {
|
|
||||||
line.append((char)c);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
String name = line.toString();
|
|
||||||
if (name.length() == 0) {
|
|
||||||
name = "Unknown"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
processInfo[i] = new ProcessInfo(pidFiles[i].getName(), name);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pidFiles = new File[0];
|
|
||||||
}
|
|
||||||
return processInfo;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue