delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/14/10:27:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <003c01c409d8$d20ed5b0$6501a8c0@AMD2000>
From: "Rob van Aarle" <robaarle AT sci DOT kun DOT nl>
To: "cygwin" <cygwin AT cygwin DOT com>
Subject: XITE under CYGWIN gives pty errors
Date: Sun, 14 Mar 2004 16:27:11 +0100
MIME-Version: 1.0
X-AtHome-MailScanner-Information: Neem contact op met support AT home DOT nl voor meer informatie
X-AtHome-MailScanner: Found to be clean
X-IsSubscribed: yes

Hello,

As a project we need to run XITE
(http://www.ifi.uio.no/forskning/grupper/dsb/Programvare/Xite/) under
Windows. All sources of XITE can be compiled with Visual Studio, except the
ones that use a GUI. So we decided to use Cygwin to run XITE. The
installation of XITE was not without problems, but with some adaptation of
the installation scripts we succeeded.
XITE is a collection of console based functions which performs
transformations to images. There is one application, xshow, that uses a GUI
to perform these transformations. It just calls the other function with the
right params. This is where it goes wrong, when calling such a function
xshow gives this error:

xshow error: getpty: No free ptys.

Of course we searched on this on Google, but we could not find an answer to
solve this. So tried to find the code which generates this error. This is
what we found:

#ifdef GETPTY
/* SGI has a library function called _getpty() */
  char *_getpty(int *, int, mode_t, int);
  int filedes[2];
  char *line;

  ENTER_FUNCTION_DEBUG("Xpty.c: getpty");

  line = _getpty(filedes, O_RDWR, 0600, 0);
  if (line == NULL) {
    Error(2, "getpty: Couldn't find pty, %s.\n", strerror(errno));
    return(-1);
  }
  if ((filedes[1] = open(line, O_RDWR)) < 0 ) {
    Error(2, "getpty: Couldn't open slave read/write, %s.\n",
strerror(errno));
    close(filedes[0]);
    return(-1);
  }
  *master = filedes[0];
  *slave  = filedes[1];

  LEAVE_FUNCTION_DEBUG("Xpty.c: getpty");

  return(0);

#else /* GETPTY */
  int first;

  ENTER_FUNCTION_DEBUG("Xpty.c: getpty");

  first = 0;
  for(; *ptyl1_s; ptyl1_s[1] ? ptyl1_s++ : (ptyl1_s = PTYCHAR1)) {
    ttydev_s[tlen_s-2] = ptydev_s[plen_s-2] = *ptyl1_s;

    for(ptyl2_s = *ptyl2_s ? ptyl2_s : PTYCHAR2; *ptyl2_s; ptyl2_s++) {
      ttydev_s[tlen_s-1] = ptydev_s[plen_s-1] = *ptyl2_s;
      *master = open(ptydev_s, O_RDWR);

      if (*master >= 0) {

 if (access(ttydev_s, R_OK|W_OK) == 0) {
   FPRINTF3("    ttydev_s: %s ptydev_s: %s\n",
     ttydev_s, ptydev_s);
   *slave = open(ttydev_s, O_RDWR);
   if (*slave < 0) {
     Error(2, "getpty: Couldn't open slave %s read/write, %s.\n",
    ttydev_s, strerror(errno));
   }
   LEAVE_FUNCTION_DEBUG("Xpty.c: getpty");

   return(0);
 } else {
   FPRINTF3("getpty: Couldn't access slave %s read/write, %s.\n",
  ttydev_s, strerror(errno));
   close(*master);
 }
      } else {
 FPRINTF3("getpty: Couldn't open master %s read/write, %s.\n",
       ptydev_s, strerror(errno));
      }
    }
    first ++;
    if (first > strlen(PTYCHAR1)) break;
  }
  Error(2, "getpty: No free ptys.\n");

  return(-1);

#endif /* GETPTY */

with these relevant comments:
'XptyStartProgram' allocates a pty (pseudo terminal) (either
  by calling system function '_getpty' (if source is compiled
  with GETPTY defined)) or by trying to open devices /dev/ptyxy
  (master) and /dev/ttyxy (slave) (where "x" is one of the
  characters "pqrstuvwxyz", "y" is one of the characters
  "0123456789abcdef").

As we are not hardcore UNIX/LINUX users, we don't know much about pty.
Searching with google gave us the definition 'pseudo terminal' and
apparently there are limited available of these. Because we get the error
'No free ptys' and looking at the code it seems GETPTY is not defined, so
according to the comments this code is trying to open /dev/ttyxy and
/dev/ptyxy. But there is no /dev directory at our Cygwin installation (so
there isn't a ttyxy or ptyxy either).

So our question is, which package should we install to get these files? And
will this solve our problem, or does someone have an other suggestion to
solve this?



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019