Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Inglis2004-12-24 17:26:22 +0000
committerDavid Inglis2004-12-24 17:26:22 +0000
commite20f39193f9093965a715ff8a23da02fe5a670ae (patch)
tree87631c58f8aef7e023cfd081d399ff562a76a242 /core/org.eclipse.cdt.core.qnx
parent2f8b9abb4b4fb4c0706c4c24c72385ae3c2801c1 (diff)
downloadorg.eclipse.cdt-e20f39193f9093965a715ff8a23da02fe5a670ae.tar.gz
org.eclipse.cdt-e20f39193f9093965a715ff8a23da02fe5a670ae.tar.xz
org.eclipse.cdt-e20f39193f9093965a715ff8a23da02fe5a670ae.zip
fixed qnx spawner
Diffstat (limited to 'core/org.eclipse.cdt.core.qnx')
-rw-r--r--core/org.eclipse.cdt.core.qnx/build.properties3
-rw-r--r--core/org.eclipse.cdt.core.qnx/library/spawner/openpty.c104
-rw-r--r--core/org.eclipse.cdt.core.qnx/library/spawner/openpty.h10
-rw-r--r--core/org.eclipse.cdt.core.qnx/os/qnx/x86/libpty.sobin5412 -> 7151 bytes
-rw-r--r--core/org.eclipse.cdt.core.qnx/os/qnx/x86/libspawner.sobin9840 -> 12561 bytes
5 files changed, 116 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.qnx/build.properties b/core/org.eclipse.cdt.core.qnx/build.properties
index 5cd7cfcdef7..2649f3a5fc7 100644
--- a/core/org.eclipse.cdt.core.qnx/build.properties
+++ b/core/org.eclipse.cdt.core.qnx/build.properties
@@ -5,4 +5,5 @@ bin.includes = fragment.xml,\
cdt_qnx.jar
source.cdt_qnx.jar = src/
src.includes = about.html,\
- library/
+ library/,\
+ build.properties
diff --git a/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.c b/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.c
new file mode 100644
index 00000000000..b1660a13b78
--- /dev/null
+++ b/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.c
@@ -0,0 +1,104 @@
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+#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;
+}
diff --git a/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.h b/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.h
new file mode 100644
index 00000000000..fd7b7be1b2f
--- /dev/null
+++ b/core/org.eclipse.cdt.core.qnx/library/spawner/openpty.h
@@ -0,0 +1,10 @@
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+#ifndef _OPENPTY_H
+#define _OPENPTY_H
+int ptym_open (char *pts_name);
+int ptys_open (int fdm, char * pts_name);
+#endif
diff --git a/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libpty.so b/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libpty.so
index 7e8be555ff2..74a41b7d123 100644
--- a/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libpty.so
+++ b/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libpty.so
Binary files differ
diff --git a/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libspawner.so b/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libspawner.so
index 61f6c9d9ef6..0de48acc848 100644
--- a/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libspawner.so
+++ b/core/org.eclipse.cdt.core.qnx/os/qnx/x86/libspawner.so
Binary files differ

Back to the top