lesstif mwm bug

Hans Werner Strube strube@physik3.gwdg.de
Tue May 7 00:22:00 GMT 2002


> From: Hans Werner Strube <strube@physik3.gwdg.de>

> The mwm from lesstif eats up 99 % of CPU time, both in the binary package
> and in a self-compiled version. I found that the select() calls in events.c
> do not wait but immediately fail with errno = EBADF, although fd_width is 256
> and x_fd is 3 or 4 (printed out in mwm.c). I have not yet found the reason,
> only a dirty workaround: Replace the select by usleep(10000).

Now I found the reason of the bug. Whereas fd_width is 256, FD_SETSIZE (the
number of bits in fd_set variables) is only 64, so that select() tests for
unpredictable file descriptors from 64 to 255. For mwm, as x_fd has low
values, it will be sufficient to limit fd_width in mwm.c:
if(fd_width > FD_SETSIZE) fd_width = FD_SETSIZE;
More generally, the value of FD_SETSIZE in /usr/include/sys/types.h should
be increased (as the comments say, to >= NOFILE from param.h)!



More information about the Cygwin-xfree mailing list