aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/unix/run_erl.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-10-04 15:42:10 +0200
committerBjörn Gustavsson <[email protected]>2010-10-04 15:42:15 +0200
commit29a550156d88eb2899bceaa07c46369f97539336 (patch)
tree35f19c258715618840c32df551a6d333615d302c /erts/etc/unix/run_erl.c
parentb1fe80997e876cac751401724830a9fdadf7152d (diff)
parent94399ba3a34e90a95a03117b3a6c8daf63090235 (diff)
downloadotp-29a550156d88eb2899bceaa07c46369f97539336.tar.gz
otp-29a550156d88eb2899bceaa07c46369f97539336.tar.bz2
otp-29a550156d88eb2899bceaa07c46369f97539336.zip
Merge branch 'rt/solaris-pty-handling-fixes' into dev
* rt/solaris-pty-handling-fixes: Add corrected support for Solaris PTYs to run_erl Fix a typo that leads to syntax errors with DEBUG defined in run_erl OTP-8878
Diffstat (limited to 'erts/etc/unix/run_erl.c')
-rw-r--r--erts/etc/unix/run_erl.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c
index 4bb148df98..cadff12c6f 100644
--- a/erts/etc/unix/run_erl.c
+++ b/erts/etc/unix/run_erl.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2010. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -75,6 +75,9 @@
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
+#if defined(__sun) && defined(__SVR4)
+# include <stropts.h>
+#endif
#include "run_erl.h"
#include "safe_string.h" /* sn_printf, strn_cpy, strn_cat, etc */
@@ -864,8 +867,12 @@ static int open_pty_master(char **ptyslave)
/* Use the posix_openpt if working, as this guarantees creation of the
slave device properly. */
-#ifdef HAVE_WORKING_POSIX_OPENPT
+#if defined(HAVE_WORKING_POSIX_OPENPT) || (defined(__sun) && defined(__SVR4))
+# ifdef HAVE_WORKING_POSIX_OPENPT
if ((mfd = posix_openpt(O_RDWR)) >= 0) {
+# elif defined(__sun) && defined(__SVR4)
+ if ((mfd = open("/dev/ptmx", O_RDWR)) >= 0) {
+# endif
if ((*ptyslave = ptsname(mfd)) != NULL &&
grantpt(mfd) == 0 &&
unlockpt(mfd) == 0) {
@@ -981,8 +988,28 @@ static int open_pty_slave(char *name)
return -1;
}
+#if defined(__sun) && defined(__SVR4)
+ /* Load the necessary STREAMS modules for Solaris */
+ if ((ioctl(sfd, I_FIND, "ldterm")) < 0) {
+ ERROR0(LOG_ERR, "Failed to find ldterm STREAMS module");
+ return -1;
+ }
+ if (ioctl(sfd, I_PUSH, "ptem") < 0) {
+ ERROR0(LOG_ERR, "Failed to push ptem STREAMS module");
+ return -1;
+ }
+ if (ioctl(sfd, I_PUSH, "ldterm") < 0) {
+ ERROR0(LOG_ERR, "Failed to push ldterm STREAMS module");
+ return -1;
+ }
+ if (ioctl(sfd, I_PUSH, "ttcompat") < 0) {
+ ERROR0(LOG_ERR, "Failed to push ttcompat STREAMS module");
+ return -1;
+ }
+#endif
+
#ifdef DEBUG
- if (tcgetattr(sfd, &tty_rmode) , 0) {
+ if (tcgetattr(sfd, &tty_rmode) < 0) {
fprintf(stderr, "Cannot get terminals current mode\n");
exit(-1);
}