select(), standard input, and X11

David Arnstein arnstein@pobox.com
Fri Oct 28 20:00:00 GMT 2005


I see a problem with calling select(). The problem occurs when I
select on a single read file descriptor 0 (standard input) and no
write file descriptors.



The return value of select() indicates that data is ready. But when I
call read(), its return value is either 0 or -1. Because I am
controlling standard input, I know in fact that there is no data ready.



The problem occurs when standard input is connected to an xterm or an
rxvt. It does NOT occur when standard input is connected to a cygwin
command window (the one that behaves like a "DOS box.").

I discovered this problem running minicom 2.1. The problem renders
minicom unusable in xterms and rxvts.



If you would like to compile minicom in Cygwin, here is an easy recipe:

1.  Obtain tarball from http://alioth.debian.org/projects/minicom/.
     The tarball is named minicom-2.1.tar.gz.

2.  Create a managed mount point under cygwin to hold the source files
     The above minicom tarball creates a directory named "aux." "Aux" has
     special significance to Windows OS and wil cause tar to fail. The
     "managed" option of Cygwin's mount prevents this failure. For
     example:
     a.  ( Place the tar file minicom-2.1.tar.gz in C:/anywhere/ )
     b.  mkdir C:/special
     c.  mkdir /special
     d.  mount C:/special /special -o managed
     e.  cd /special
     f.  gzcat C:/anywhere/minicom-2.1.tar.gz | tar xf -

3.  Avoid file protection problems involving lock files
     By default, minicom tries to write a lock file in /var/lock. It
     fails due to insufficient privilege (on my Cygwin installation, at
     least). I prefer not to alter the properties of /var/lock, which
     might cause problems for other software packages. So I do the
     following:
     a. Create a directory /var/lock/unpriv/ that I have privelege to
        read and write.
     b. When running the ./configure script for minicom, use this option:
            --enable-lock-dir=/var/lock/unpriv

4.  Default serial port to use.
     When building minicom, I cause /dev/com1 to be the default serial
     port. Otherwise, minicom will use /dev/ttyS1. I don't know if this
     is necessary. I use this option to the ./configure script for
     minicom:
         --enable-dfl-port=/dev/com1

5.  Build minicom as directed by the INSTALL file
     a.  Run ./configure with the options given above.
     b.  make
     c.  make install

6.  Configure minicom
     Execute
         minicom -s
     and navigate its menus to set default options. Save your settings
     via the menu system. Note that minicom will fail if run from an
     xterm or an rxvt.

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



More information about the Cygwin mailing list