*BSD News Article 29776


Return to BSD News archive

Xref: sserve comp.unix.bsd:13779 comp.unix.sys5.r4:7120
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!ames!koriel!rutgers!njitgw.njit.edu!earth!dileep
From: dileep@earth.njit.edu (Katz)
Newsgroups: comp.unix.bsd,comp.unix.sys5.r4
Subject: Asynchronous I/O
Keywords: pipe, FIFO, signals
Message-ID: <1994Apr28.154047.4957@njitgw.njit.edu>
Date: 28 Apr 94 15:40:47 GMT
References: <2ov4ov$gg4@news.hal.COM>
Sender: news@njit.edu
Distribution: usa
Organization: New Jersey Institute of Technology
Lines: 54
Nntp-Posting-Host: earth-gw.njit.edu


Hi everyone,

	A novice question.

I would like to be informed asynchronously about a file
descriptor being ready for reading. 

Could anyone suggest ways of doing that?

I am trying this way:
I believe SIGPOLL could be used to monitor only for streams,
but that R4 would allow monitoring for any  open desc.s
I tried using SIGPOLL, and even SIGIO,
ofcourse having set the process for the descriptor with I_SETSIG.

Strangely, the handler is invoked for the input activity just once.
Never after that.

Could anyone give me any pointers on this.

Please respond to

dkatta@encore.com
----------------------------------------
The relevant code follows:


void iohandler(int sig)
{
  fd_set readfds;
  FD_ZERO(&readfds);
  FD_SET(low_infd, &readfds);
  if ( (select(low_infd+1, &readfds, NULL, NULL, NULL) != 0) ){
                if (FD_ISSET(low_infd, &readfds) != 0)
		/***Do the rea***/
        }
}


main()
{
.....


  ioctl(low_infd, I_SETSIG, S_INPUT|S_HIPRI);
  sigset(SIGIO, iohandler);
.....


}


Dileep