bug in finalizer?

Godmar Back gback at cs.utah.edu
Wed Oct 14 17:49:40 PDT 1998


> 
> Godmar Back writes:
> >  What happens is that some systems (FreeBSD, for instance) don't deliver a 
> > SIGIO is a file descriptor that overran its output queue becomes again
> > writable.  It works fine if something can be read from it:  so pressing a
> 
> Is this a bug in FreeBSD? If so then we can fix it there too.
> 

 I think it could be qualified as a bug.  The fix is to insert a psignal
at the appropriate place in the terminal driver.  Here's a program that 
reproduces it under FreeBSD:

----
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <sys/ioctl.h>

void h() { }

main()
{
        sigset_t ma;
        int on = 1;
        sigemptyset(&ma);

        fcntl(1, F_SETFL, O_NONBLOCK);
        ioctl(1, FIOASYNC, &on);
        signal(SIGIO, h); 

        for (;;) {
                int w = write(1, "!@#$%", 5);
                if (w < 0 && errno == EWOULDBLOCK) {
                        sigsuspend(&ma);
                        write(1, " resumed ", 7);
                }
        }
}
----

It will write, then stop, and if you hit return, it will continue
writing (because of the SIGIO caused by readability, not writability).

	- Godmar



More information about the kaffe mailing list