mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 393455 - Terminal sessions broken on AIX
This commit is contained in:
parent
dc114aff98
commit
d0c99408cd
14 changed files with 140 additions and 50 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %fragmentName.aix
|
Bundle-Name: %fragmentName.aix
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.aix; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.core.aix; singleton:=true
|
||||||
Bundle-Version: 5.1.1.qualifier
|
Bundle-Version: 5.3.0.qualifier
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Fragment-Host: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)"
|
Fragment-Host: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)"
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -7,14 +7,21 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/* Inaccessible static: hasPTY */
|
|
||||||
/*
|
/*
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTY
|
* Class: org_eclipse_cdt_utils_pty_PTY
|
||||||
* Method: openMaster
|
* Method: openMaster
|
||||||
* Signature: ()Ljava/lang/String;
|
* Signature: (Z)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
|
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
|
||||||
(JNIEnv *, jobject);
|
(JNIEnv *, jobject, jboolean);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_eclipse_cdt_utils_pty_PTY
|
||||||
|
* Method: change_window_size
|
||||||
|
* Signature: (III)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
|
||||||
|
(JNIEnv *, jobject, jint, jint, jint);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
|
||||||
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;I)I
|
* 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
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint);
|
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint, jboolean);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -16,7 +17,13 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
extern pid_t exec0(const char *path, char *const argv[],
|
extern pid_t exec0(const char *path, char *const argv[],
|
||||||
char *const envp[], const char *dirpath,
|
char *const envp[], const char *dirpath,
|
||||||
int channels[3] );
|
int channels[3]);
|
||||||
|
|
||||||
|
|
||||||
|
extern pid_t exec_pty(const char *path, char *const argv[],
|
||||||
|
char *const envp[], const char *dirpath,
|
||||||
|
int channels[3], const char *pts_name, int fdm,
|
||||||
|
int console);
|
||||||
|
|
||||||
extern int wait0(pid_t pid);
|
extern int wait0(pid_t pid);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004 QNX Software Systems and others.
|
* Copyright (c) 2004, 2013 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
|
@ -20,11 +21,11 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
/* from pfind.c */
|
/* from pfind.c */
|
||||||
extern char *pfind(const char *name);
|
extern char *pfind(const char *name, char * const envp[]);
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
exec_pty(const char *path, char *const argv[], char *const envp[],
|
exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
const char *dirpath, int channels[3], const char *pts_name, int fdm)
|
const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
|
||||||
{
|
{
|
||||||
int pipe2[2];
|
int pipe2[2];
|
||||||
pid_t childpid;
|
pid_t childpid;
|
||||||
|
@ -34,7 +35,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
* We use pfind() to check that the program exists and is an executable.
|
* We use pfind() to check that the program exists and is an executable.
|
||||||
* If not pass the error up. Also execve() wants a full path.
|
* If not pass the error up. Also execve() wants a full path.
|
||||||
*/
|
*/
|
||||||
full_path = pfind(path);
|
full_path = pfind(path, envp);
|
||||||
if (full_path == NULL) {
|
if (full_path == NULL) {
|
||||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -43,7 +44,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
/*
|
/*
|
||||||
* Make sure we can create our pipes before forking.
|
* Make sure we can create our pipes before forking.
|
||||||
*/
|
*/
|
||||||
if (channels != NULL) {
|
if (channels != NULL && console) {
|
||||||
if (pipe(pipe2) < 0) {
|
if (pipe(pipe2) < 0) {
|
||||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||||
free(full_path);
|
free(full_path);
|
||||||
|
@ -64,6 +65,11 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
if (channels != NULL) {
|
if (channels != NULL) {
|
||||||
int fds;
|
int fds;
|
||||||
|
|
||||||
|
if (!console && setsid() < 0) {
|
||||||
|
perror("setsid()");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
fds = ptys_open(fdm, pts_name);
|
fds = ptys_open(fdm, pts_name);
|
||||||
if (fds < 0) {
|
if (fds < 0) {
|
||||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||||
|
@ -71,17 +77,28 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the read end of pipe2 */
|
/* Close the read end of pipe2 */
|
||||||
if (close(pipe2[0]) == -1)
|
if (console && close(pipe2[0]) == -1)
|
||||||
perror("close(pipe2[0]))");
|
perror("close(pipe2[0]))");
|
||||||
|
|
||||||
/* close the master, no need in the child */
|
/* close the master, no need in the child */
|
||||||
close(fdm);
|
close(fdm);
|
||||||
|
|
||||||
set_noecho(fds);
|
if (console) {
|
||||||
|
set_noecho(fds);
|
||||||
|
if (setpgid(getpid(), getpid()) < 0) {
|
||||||
|
perror("setpgid()");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* redirections */
|
/* redirections */
|
||||||
dup2(fds, STDIN_FILENO); /* dup stdin */
|
dup2(fds, STDIN_FILENO); /* dup stdin */
|
||||||
dup2(fds, STDOUT_FILENO); /* dup stdout */
|
dup2(fds, STDOUT_FILENO); /* dup stdout */
|
||||||
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
if (console) {
|
||||||
|
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
||||||
|
} else {
|
||||||
|
dup2(fds, STDERR_FILENO); /* dup stderr */
|
||||||
|
}
|
||||||
close(fds); /* done with fds. */
|
close(fds); /* done with fds. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,16 +121,20 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
|
|
||||||
} else if (childpid != 0) { /* parent */
|
} else if (childpid != 0) { /* parent */
|
||||||
|
|
||||||
set_noecho(fdm);
|
if (console) {
|
||||||
|
set_noecho(fdm);
|
||||||
|
}
|
||||||
if (channels != NULL) {
|
if (channels != NULL) {
|
||||||
/* close the write end of pipe1 */
|
|
||||||
if (close(pipe2[1]) == -1)
|
|
||||||
perror("close(pipe2[1])");
|
|
||||||
|
|
||||||
channels[0] = fdm; /* Input Stream. */
|
channels[0] = fdm; /* Input Stream. */
|
||||||
channels[1] = fdm; /* Output Stream. */
|
channels[1] = fdm; /* Output Stream. */
|
||||||
channels[2] = pipe2[0]; /* stderr Stream. */
|
if (console) {
|
||||||
/*channels[2] = fdm; Input Stream. */
|
/* close the write end of pipe1 */
|
||||||
|
if (close(pipe2[1]) == -1)
|
||||||
|
perror("close(pipe2[1])");
|
||||||
|
channels[2] = pipe2[0]; /* stderr Stream. */
|
||||||
|
} else {
|
||||||
|
channels[2] = fdm; /* Error Stream. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(full_path);
|
free(full_path);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* from pfind.c */
|
/* from pfind.c */
|
||||||
extern char *pfind(const char *name);
|
extern char *pfind(const char *name, char * const envp[]);
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
exec0(const char *path, char *const argv[], char *const envp[],
|
exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
|
@ -33,7 +34,7 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
* We use pfind() to check that the program exists and is an executable.
|
* We use pfind() to check that the program exists and is an executable.
|
||||||
* If not pass the error up. Also execve() wants a full path.
|
* If not pass the error up. Also execve() wants a full path.
|
||||||
*/
|
*/
|
||||||
full_path = pfind(path);
|
full_path = pfind(path, envp);
|
||||||
if (full_path == NULL) {
|
if (full_path == NULL) {
|
||||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -91,6 +92,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
close(fd++);
|
close(fd++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setpgid(getpid(), getpid());
|
||||||
|
|
||||||
if (envp[0] == NULL) {
|
if (envp[0] == NULL) {
|
||||||
execv(full_path, argv);
|
execv(full_path, argv);
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,9 +138,19 @@ int wait0(pid_t pid)
|
||||||
int status;
|
int status;
|
||||||
int val = -1;
|
int val = -1;
|
||||||
|
|
||||||
if (pid < 0 || waitpid(pid, &status, 0) < 0)
|
if (pid < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (waitpid(pid, &status, 0) < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
// interrupted system call - retry
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
val = WEXITSTATUS(status);
|
val = WEXITSTATUS(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ptym_open (char *pts_name);
|
int ptym_open (char *pts_name);
|
||||||
int ptys_open (int fdm, char * pts_name);
|
int ptys_open (int fdm, const char * pts_name);
|
||||||
void set_noecho(int fd);
|
void set_noecho(int fd);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,11 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#ifndef _OPENPTY_H
|
#ifndef _OPENPTY_H
|
||||||
#define _OPENPTY_H
|
#define _OPENPTY_H
|
||||||
int ptym_open (char *pts_name);
|
int ptym_open (char *pts_name);
|
||||||
int ptys_open (int fdm, char * pts_name);
|
int ptys_open (int fdm, const char * pts_name);
|
||||||
void set_noecho(int fd);
|
void set_noecho(int fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -23,8 +24,25 @@
|
||||||
#define PATH_MAX 1024
|
#define PATH_MAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PATH_DEF "PATH="
|
||||||
|
const int path_def_len = 5; /* strlen(PATH_DEF); */
|
||||||
|
char * path_val(char * const envp[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (envp == NULL || envp[0] == NULL)
|
||||||
|
return getenv("PATH" );
|
||||||
|
|
||||||
|
for(i = 0; envp[i] != NULL; i++){
|
||||||
|
char* p = envp[i];
|
||||||
|
if(!strncmp(PATH_DEF, p, path_def_len)){
|
||||||
|
return p + path_def_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char * pfind(const char *name)
|
char * pfind(const char *name, char * const envp[])
|
||||||
{
|
{
|
||||||
char *tok;
|
char *tok;
|
||||||
char *sp;
|
char *sp;
|
||||||
|
@ -46,7 +64,7 @@ char * pfind(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search in the PATH environment. */
|
/* Search in the PATH environment. */
|
||||||
path = getenv("PATH" );
|
path = path_val( envp );
|
||||||
|
|
||||||
if (path == NULL || strlen(path) <= 0) {
|
if (path == NULL || strlen(path) <= 0) {
|
||||||
fprintf(stderr, "Unable to get $PATH.\n");
|
fprintf(stderr, "Unable to get $PATH.\n");
|
||||||
|
@ -79,7 +97,7 @@ int main(int argc, char **argv)
|
||||||
char *fullpath;
|
char *fullpath;
|
||||||
|
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
fullpath = pfind(argv[i]);
|
fullpath = pfind(argv[i], NULL);
|
||||||
if (fullpath == NULL)
|
if (fullpath == NULL)
|
||||||
printf("Unable to find %s in $PATH.\n", argv[i]);
|
printf("Unable to find %s in $PATH.\n", argv[i]);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,8 +8,9 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include "PTY.h"
|
#include "PTY.h"
|
||||||
#include "openpty.h"
|
#include "openpty.h"
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
* Signature: ()I
|
* Signature: ()I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboolean console) {
|
||||||
jfieldID fid; /* Store the field ID */
|
jfieldID fid; /* Store the field ID */
|
||||||
jstring jstr = NULL;
|
jstring jstr = NULL;
|
||||||
int master = -1;
|
int master = -1;
|
||||||
|
@ -30,8 +31,10 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
||||||
|
|
||||||
master = ptym_open(line);
|
master = ptym_open(line);
|
||||||
if (master >= 0) {
|
if (master >= 0) {
|
||||||
/* turn off echo */
|
// turn off echo
|
||||||
set_noecho(master);
|
if (console) {
|
||||||
|
set_noecho(master);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get a reference to the obj's class */
|
/* Get a reference to the obj's class */
|
||||||
cls = (*env)->GetObjectClass(env, jobj);
|
cls = (*env)->GetObjectClass(env, jobj);
|
||||||
|
@ -48,3 +51,22 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
||||||
}
|
}
|
||||||
return jstr;
|
return jstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
|
||||||
|
(JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
|
||||||
|
{
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
struct winsize win;
|
||||||
|
|
||||||
|
win.ws_col = width;
|
||||||
|
win.ws_row = height;
|
||||||
|
win.ws_xpixel = 0;
|
||||||
|
win.ws_ypixel = 0;
|
||||||
|
|
||||||
|
return ioctl(fdm, TIOCSWINSZ, &win);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -90,13 +91,13 @@ static void free_c_array(char **c_array)
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
|
(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
|
||||||
jstring jslaveName, jint masterFD)
|
jstring jslaveName, jint masterFD, jboolean console)
|
||||||
{
|
{
|
||||||
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
|
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
int fd[3];
|
int fd[3];
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
fprintf(stderr, "pts_name: %s\n", pts_name);
|
fprintf(stderr, "pts_name: %s\n", pts_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD);
|
pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
goto bail_out;
|
goto bail_out;
|
||||||
|
|
||||||
|
@ -147,8 +148,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
|
||||||
jstring jdir)
|
jstring jdir)
|
||||||
{
|
{
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
cmd = alloc_c_array(env, jcmd);
|
cmd = alloc_c_array(env, jcmd);
|
||||||
|
@ -194,8 +195,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
|
||||||
{
|
{
|
||||||
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
int fd[3];
|
int fd[3];
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>5.1.1-SNAPSHOT</version>
|
<version>5.3.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.core.aix</artifactId>
|
<artifactId>org.eclipse.cdt.core.aix</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue