Article View: comp.unix.programmer
Article #78SIGIO & sockets. is this right?
From: Kevin Wang aka The Scarecrow
Date: Wed, 22 Jul 1992 00:48
Date: Wed, 22 Jul 1992 00:48
46 lines
1898 bytes
1898 bytes
I am trying to use fcntl() to turn on O_ASYNC so that my program
will receive a SIGIO when any data comes in across any of its sockets.
However, it doesn't seem to be working.
system is AIX (yes, yes, I know) V 1.2.1
Here's how I turn it on:
void SIGIO_ON(int sock)
{
int hold;
hold = fcntl(sock, F_GETFL, 0);
hold = fcntl(sock, F_SETFL, hold | O_ASYNC);
if (-1 == hold)
{
perror("SIGIO_ON");
}
return;
}
and here's the code that's supposed to be interrupted by the SIGIO:
wakeupcall = FALSE;
signal(SIGALRM, AlarmHandler);
signal(SIGIO, AlarmHandler);
alarm(30); /* wake me up in 30 seconds */
loop = AcceptConnect(sock, addr, addrlen);
errsave = errno;
signal(SIGIO, SIG_IGN);
signal(SIGALRM, SIG_IGN); /* ignore alarms */
alarm(0); /* cancel alarm */
all that AlarmHandler does is sets wakeupcall, a global int to TRUE,
so that I know a signal occurred.
inside of AcceptConnect lies the accept() for sockets. the man pages
says it will return -1 if interrupted by a signal. why isn't it being
interrupted?
- Kevin Wang
...And now, for your local station identification, on the hour, every hour...
kwang@hermes.calpoly.edu or kwang@gauss.elee.calpoly.edu
---
A source is a source, of course of course, Unless, of course, the
source is a curse; And if, of course, the source is a curse, Then a
termcap entry's required.
Technical Details
Message-ID:
<1992Jul22.004846.220119@zeus.calpoly.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!csus.edu!beach.csulb.edu!nic.csu.net!koko.csustan.edu!rat!zeus!kwangShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!csus.edu!beach.csulb.edu!nic.csu.net!koko.csustan.edu!rat!zeus!kwang Newsgroups: comp.unix.programmer Subject: SIGIO & sockets. is this right? Message-ID: <1992Jul22.004846.220119@zeus.calpoly.edu> From: kwang@zeus.calpoly.edu (Kevin Wang aka The Scarecrow) Date: Wed, 22 Jul 1992 00:48:46 GMT Organization: The Outland Riders Lines: 46