Subject: Command Line error on Sun4 CLISP

From: [email-masked]
Date: Fri, 2 Dec 1994 15:41:59 +0000

Hi,
  I've compiled an old (29/08/93) version of CLISP for use with a 
commercial toolkit. Everything seemed to be fine (except for lots
of warnings :-) until I tried to run the 'lisp.run' command. This
generated the following error continuously:
*** - UNIX error 35 (EWOULDBLOCK): Operation would block

Running using the '-x' option (i.e. ./lisp.run -x '(print 2)') works
fine, so I'm assuming this is something to do with the readline
library. Has anyone encountered this problem before?

I am running on a Sun4 SunOS 4.1.3.

Thanks,

David Arnold.

-- 
-=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=-
David Arnold                             ([email-masked])
Dept. Computer Science                   +44 (0)970-622449
University of Wales,Aberystwyth, Dyfed SY23 3DB, UK.
http://www.dcs.aber.ac.uk/~daa93
GCS -d+ p c++@ !l e++ m+++(*) s+/- n+ h(-) f !g w- t+@ y? 
-=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -= -=- -=-- -=- -=-

---

From: haible (Bruno Haible)
Date: Fri, 2 Dec 94 17:28:24 +0100

> ... the 'lisp.run' command. This

> Has anyone encountered this problem before?

Mr Hans Groschwitz <[email-masked]> reported the
same error. In his case it was related to using a pty on standard input/
output, and went away when he linked without the readline library.

Can you investigate a bit more the circumstances that lead to the error
in your case?

                    Bruno Haible
                    [email-masked]

---

From: [email-masked]
Date: Tue, 6 Dec 1994 16:02:49 +0000

On Dec 2,  5:33pm, you wrote:
> Subject: Re: Command Line error on Sun4 CLISP
>-- End of excerpt from Bruno Haible

O.K. I've run the program through a debugger and the code that generates
the error is in the file 'stream.d' lines 931-936:
      #else # non-blocking I/O ` la SYSV
      { var reg2 int fcntl_flags;
        if (( fcntl_flags = fcntl(handle,F_GETFL,0) )<0) { OS_error(); }
        if ( fcntl(handle,F_SETFL,fcntl_flags|O_NDELAY) <0) { OS_error(); }
-->     ergebnis = read(handle,&c,1); # Zeichen lesen versuchen
        if ( fcntl(handle,F_SETFL,fcntl_flags) <0) { OS_error(); }
      }

The 'read' command generates the EWOULDBLOCK error. I think the error
must be linked to terminal I/O since the program runs fine when the
standard input is a pipe.

>From the 'unixconf.h' file the following are defined:
/* CL_IOCTL */
/* Define as the type of `request' in ioctl() declaration. */
#define IOCTL_REQUEST_T int
/* Define if the declaration of ioctl() needs dots. */
#undef IOCTL_DOTS
/* Define if you have the FIONREAD ioctl(). */
#undef HAVE_FIONREAD
/* Define if you need <sys/filio.h> for using ioctl's like FIONREAD. */
#undef NEED_SYS_FILIO_H
/* Define if you need <sys/ioctl.h> for using ioctl's like FIONREAD. */
#undef NEED_SYS_IOCTL_H

I am slightly confused as to why it is executing NON-BLOCKING code
if the system does actually BLOCK but have to confess that my knowledge
of UNIX system I/O is extremely limited.

I hope this is some help, if you require more information let me know.

David Arnold

---

From: haible (Bruno Haible)
Date: Tue, 6 Dec 94 19:02:22 +0100

David Arnold <[email-masked]> found the reason for the EWOULDBLOCK error:
> I've run the program through a debugger and the code that generates
> The 'read' command generates the EWOULDBLOCK error.

Well done, your investigation! A couple of lines below that, the error
code is checked:
        if (errno==EAGAIN)
Change this to
        if ((errno==EAGAIN)||(errno==EWOULDBLOCK))

Thank you.

                    Bruno Haible