Article View: comp.unix.programmer
Article #160Re: SIGIO & sockets. is this right?
From: Joe Palumbos
Date: Tue, 28 Jul 1992 16:11
Date: Tue, 28 Jul 1992 16:11
34 lines
1344 bytes
1344 bytes
kwang@zeus.calpoly.edu (Kevin Wang aka The Scarecrow) writes:
: 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:
: [.....]
After your fcntl() call to make the socket Async, you need
another call:
fcntl (sock, F_SETOWN, getpid());
This will allow your pid (or group; see fcntl(2)) to receive SIGIO.
--
Joe Palumbos jmp@moscom.com {rit,tropix,ur-valhalla}!moscom!jmp
Technical Details
Message-ID:
<3834@moscom.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!rutgers!ub!galileo.cc.rochester.edu!ee.rochester.edu!moscom!jmpReferences:
<1992Jul22.004846.220119@zeus.calpoly.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!rutgers!ub!galileo.cc.rochester.edu!ee.rochester.edu!moscom!jmp From: jmp@moscom.UUCP (Joe Palumbos) Newsgroups: comp.unix.programmer Subject: Re: SIGIO & sockets. is this right? Message-ID: <3834@moscom.UUCP> Date: 28 Jul 92 16:11:09 GMT References: <1992Jul22.004846.220119@zeus.calpoly.edu> Organization: Moscom Corp., Pittsford, NY Lines: 34 X-Newsreader: Tin 1.1 PL3