Re: Signals lost when using asynchronous IO

From: Mikael Vidstedt (mikeee@stacken.kth.se)
Date: Wed Jul 12 2000 - 10:59:53 EST


On Wed, 12 Jul 2000, Dan Kegel wrote:

> So your program runs in the kernel? Is it a loadable module?

No it does not run in the kernel.

Basically, what it does is this (but with many more sockets):

-----8<------
void data_available(int sig, struct siginfo* si, void* context)
{
   printf("Data is available\n");
   read(data);
}

int
main(void)
{
   int fd = socket(AF_INET, SOCK_STREAM, 0);
   struct sigaction sa_io;

   fcntl(fh, F_SETOWN, getpid());
   fcntl(fh, F_SETSIG, 32);
   fcntl(fh, F_SETFL, O_NONBLOCK | O_ASYNC);

   sa_io.sa_sigaction = (void*) ioSignalHandler;
   sa_io.sa_flags = SA_SIGINFO | SA_RESTART | SA_NOMASK;
   sigemptyset(&sa_io.sa_mask);
   sigaction(32, &sa_io, NULL)

   while (true)
   {
       /* Accept connections here */
   }

   return;
}

-----8<------

But data_available is not called when the socket is closed.

> Can you try a different kernel, say Red Hat 6.2 or even 2.4.0-test3?
> Who knows, maybe the Red Hat 6.0 kernel you're using has a bug that's
> since been fixed...

No other kernel major version has been tried out (yet), since the
application is developed for the stable kernel version.

/Mikael

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:14 EST