makeTTYPait for unixWare
authorpenk
Fri, 31 Jan 2003 10:27:32 +0100
changeset 6987 10a0dd0ac8c9
parent 6986 d2ef4d62861e
child 6988 c5c1ae285622
makeTTYPait for unixWare
UnixOperatingSystem.st
--- a/UnixOperatingSystem.st	Thu Jan 30 18:19:13 2003 +0100
+++ b/UnixOperatingSystem.st	Fri Jan 31 10:27:32 2003 +0100
@@ -6412,6 +6412,47 @@
 #endif /* IRIX5 */
 
 
+#ifdef SYSV4
+    int _fdM, _fdS, ttygid;
+    char *line;
+#   include <grp.h>
+    struct group *gr;
+
+    if ((gr = getgrnam("tty")) != NULL)
+        ttygid = gr->gr_gid;
+    else
+        ttygid = -1;
+
+    _fdM = open("/dev/ptmx", O_RDWR /* |O_NDELAY */ );
+
+    if (_fdM >= 0) {
+        grantpt(_fdM);
+        unlockpt(_fdM);
+        line = ptsname(_fdM);
+
+        if (line != NULL) {
+            _fdS = open(line, O_RDWR);
+            if (_fdS < 0) {
+                (void)close(_fdM);
+                _fdS = _fdM = -1;
+            } else {
+                (void) chown( line, getuid(), ttygid );
+                (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
+            }
+        } else {
+            (void)close(_fdM);
+            _fdS = _fdM = -1;
+        }
+    }
+
+    if ((_fdM >= 0) && (_fdS >= 0)) {
+         fdM = __MKSMALLINT(_fdM);
+         fdS = __MKSMALLINT(_fdS);
+    }
+#   define NO_PTY_TEMPL
+#endif /* SYSV4 */
+
+
 #ifdef LINUX
 #   define PTY_TEMPL    "/dev/ptyXX"
 #   define PT_INDEX      5
@@ -10507,7 +10548,7 @@
 !UnixOperatingSystem::FilePointerHandle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.134 2003-01-23 11:52:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.135 2003-01-31 09:27:32 penk Exp $'
 ! !
 
 !UnixOperatingSystem::FilePointerHandle methodsFor:'release'!
@@ -12175,7 +12216,7 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.134 2003-01-23 11:52:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.135 2003-01-31 09:27:32 penk Exp $'
 ! !
 
 UnixOperatingSystem initialize!