run_erl problem on RedHat ES 4
Ernie Makris
ernie.makris@REDACTED
Wed Oct 12 22:33:57 CEST 2005
This is what I use. Can the otp team include this in the next release?
Fedora run_erl is broken out of the box.
Jouni Rynö originally sent a patch to me and I added a fix to it in order to
close the fds properly
as it wasn't working on redhat or fedora.
Here it is:
+++ run_erl.c 2005-10-07 15:19:00.000000000 -0400
@@ -45,6 +45,8 @@
#if !defined(NO_SYSLOG)
#include <syslog.h>
#endif
+#include <pty.h>
+#include <utmp.h>
#if defined(O_NONBLOCK)
# define DONT_BLOCK_PLEASE O_NONBLOCK
@@ -803,6 +805,7 @@
static int open_pty_master(char **ptyslave)
{
int mfd;
+ int sfd;
char *major, *minor;
static char majorchars[] = "pqrstuvwxyzabcdePQRSTUVWXYZABCDE";
@@ -818,6 +821,15 @@
/* http://www.xcf.berkeley.edu/~ali/K0D/UNIX/PTY/code/upty.h.html */
{
+ static char ttyname[] = " ";
+ if (0 == openpty(&mfd, &sfd, ttyname, NULL, NULL)) {
+ close(sfd);
+ *ptyslave = ttyname;
+ return mfd;
+ }
+ }
+
+ {
/* New style devpts or devfs /dev/pty/{m,s}{0,1....} */
static char ptyname[] = "/dev/pty/mX";
You also have to modify the Makefile to add -lutil for the compilation of
run_erl.
Thanks
Ernie
----- Original Message -----
From: "Serge Aleynikov" <serge@REDACTED>
To: "Erlang Questions" <erlang-questions@REDACTED>
Sent: Wednesday, October 12, 2005 2:29 PM
Subject: run_erl problem on RedHat ES 4
> OTP Team:
>
> We ran accross the following issue with run_erl:
>
> ~>cat /etc/redhat-release
> Red Hat Enterprise Linux ES release 4 (Nahant)
> ~>cat /proc/version
> Linux version 2.6.9-5.ELsmp (bhcompile@REDACTED) (gcc
> version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)) #1 SMP Wed Jan 5 19:30:39
> EST 2005
>
> >erts-5.4.9/bin/run_erl var/tmp/test var/log/test "ls"
> run_erl [17489] Wed Oct 12 14:25:11 2005
> Could not open pty master
>
> Apparently this version of Linux doesn't have any /dev/pty devices
> installed:
>
> >ls -l /dev/p*
> lrwxrwxrwx 1 root root 3 Aug 29 17:05 /dev/par0 -> lp0
> crw-rw---- 1 root lp 99, 0 Aug 29 13:04 /dev/parport0
> crw-rw---- 1 root lp 99, 1 Aug 29 13:04 /dev/parport1
> crw-rw---- 1 root lp 99, 2 Aug 29 13:04 /dev/parport2
> crw-rw---- 1 root lp 99, 3 Aug 29 13:04 /dev/parport3
> crw-r----- 1 root kmem 1, 4 Aug 29 13:03 /dev/port
> crw------- 1 root root 108, 0 Aug 29 13:04 /dev/ppp
> crw-rw-rw- 1 root tty 5, 2 Oct 12 14:26 /dev/ptmx
>
> /dev/pts:
> total 0
> crw--w---- 1 dkorsun tty 136, 0 Sep 20 18:02 0
> crw--w---- 1 dkorsun tty 136, 1 Oct 12 10:38 1
> crw--w---- 1 serge tty 136, 2 Oct 12 14:26 2
>
> Is this an oversight in run_erl, or you could recommend a work-around?
>
> Thanks.
>
> --
> Serge Aleynikov
> R&D Telecom, IDT Corp.
> Tel: (973) 438-3436
> Fax: (973) 438-1464
> serge@REDACTED
More information about the erlang-questions
mailing list