lkml.org 
[lkml]   [1999]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Async notification for fifos possible?
On Thu, 18 Feb 1999, Marc Bechler wrote:

> Hi all!
>
> Several programming (and reading) hours after trying to find an answer to
> my question I decided to write to this newsgroup.
>
> I would like to know if the current kernel supports an asynchronous
> notification for FIFOs. I interpreted the collected information about this

[SNIPPED]


>
> Here is what I implement on server side:
> ...
> fd = open("/tmp/hello.fifo", O_RDWR);
> ioctl(fd, FIOASYNC, &arg); // arg is 0
> fcntl(fd, F_SETFD, FASYNC);
> fcntl(fd, F_SETSIG, SIGIO);
> signal(SIGIO, sig_io); // where sig_io prints s.th to the stdout.
> ...
>

I think all you have to do is:
int flags = 1;
ioctl(fd, FIONBIO, &flags); /* Make non blocking */
flags = fcntl(fd, F_GETFL);
flags |= (FNDELAY|FASYNC);
fcntl(fd, F_SETFL, flags);
fcntl(fd, F_SETOWN, getpid() ); /* Send signals to me */
... and it will work (no typos are checked).


Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.1 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.



-
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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:3.159 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site