This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XITE under CYGWIN gives pty errors


At 10:27 AM 3/14/2004, you wrote:
>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.


How are you running this?  From where?  Are you in X or not?  What X server
are you running?  So far, you haven't really given much detail to what you've
done to produce this result.


>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).


You missed some important Cygwin documentation at:

<http://cygwin.com/cygwin-ug-net/using-specialnames.html#AEN806>

So, ptty support does exist in Cygwin.  This may also be of interest:

<http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>


>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?


As the User's Guide points out, you're not missing these files.  If the 
information I've pointed you to doesn't help and you need to consult the
list again, please the reporting guidelines enumerated here:


>Problem reports:       http://cygwin.com/problems.html


This will help folks on the list pinpoint your problem better.



--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]