Bug 3928 - Pty.cxx frysk::sys::Pty::setUpPtyForConsole uses system() calls to set tty properties
Summary: Pty.cxx frysk::sys::Pty::setUpPtyForConsole uses system() calls to set tty p...
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andrew Cagney
Depends on:
Blocks: 2246
  Show dependency treegraph
Reported: 2007-01-26 19:02 UTC by Phil Muldoon
Modified: 2007-02-19 21:40 UTC (History)
0 users

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2007-01-26 19:02:57 UTC
This might call problems with SIGCHLD and Frysk. Code snippet below.

        char prefix[30] = "stty -F ";
        char *pts_name = ptsname(master);
        char cmd[60];
        if (pts_name != NULL)
                strcat(prefix, pts_name);
                strcpy(cmd, prefix);
                strcat(cmd, " -icanon min 1");
                strcpy(cmd, prefix);
                strcat(cmd, " -echo");
Comment 1 Chris Moller 2007-01-26 19:42:35 UTC
What the system() stuff below is doing is setting the way the tty works.  It
could be done w/o system() by using terminal control ops similar to the following:

  struct termios tio;

  if (0 > tcgetattr(fd, *tio)) return -1;

  tio.c_lflag |= ICANON | ECHO;
  tio.c_cc[VMIN] = 1;

  if (0 < tcsetattr(fd, TCSANOW, ,&tio)) return -1;

  return 0;

where fd is the file descriptor associated with pts_name.

There are a few other wrinkles that might be relevant, but they'd depend on what
else is going on.
Comment 2 Andrew Cagney 2007-02-19 21:40:06 UTC
Code deleted, instead use frysk.sys.termios to manipulate the terminal; for this
specific case, CLI already does the manipulations so call was redundant.

Index: frysk-gui/frysk/gui/monitor/ChangeLog
2007-02-19  Andrew Cagney  <cagney@redhat.com>

        * ConsoleWidget.java: Delete call to PseudoTerminal

Index: frysk-imports/frysk/sys/ChangeLog
2007-02-19  Andrew Cagney  <cagney@redhat.com>

        * PseudoTerminal.java (setUpForConsole): Delete.
        * cni/PseudoTerminal.cxx: Ditto.

        * termios/: New directory.