Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!compuram!pgd From: pgd@bbt.se Newsgroups: comp.unix.questions Subject: Re: wait on ipc message Message-ID: <1990Dec10.095247.9223@bbt.se> Date: 10 Dec 90 09:52:47 GMT References: <1990Dec9.091203.4188@bbt.se> <5335@rex.cs.tulane.edu> Lines: 31 In article <5335@rex.cs.tulane.edu> rawdon@rex.cs.tulane.edu (Michael Rawdon) writes: >In <1990Dec9.091203.4188@bbt.se> pgd@bbt.se writes: >>I want to stall a process, to wake up on a message received >>through a SYSV ipc message, or data available on any file. >>That is, i want a select/poll to also include messages received >>through an ipc channel. > >If I understand what you're asking correctly, I believe if you have the >following command format for receiving a message: > >msgrcv (msqid, msgp, msgsz, msgtyp, msgflg) > >then if you simply do *not* set IPC_NOWAIT in msgflg, the process will >block until a message of type 'msgtyp' appears on the message queue with >id 'msqid'. Yes, but i want the process to wake up on input from a selected normal file also. (Which in this case means the keyboard or a serial port). One way of doing it is to have a separate process reading the keyboard, send an ipc message to wake up the main process. But to avoid the extra overhead, I want to do both things in the same process. The os Xenix/386 has the poll() system call, but I have no manual page for poll. In the signal.h system file I find the SIGPOLL signal. Is it possible to make a poll() interrupt with SIGPOLL? Then the problem could be solved by issuing an interrupting poll(), and then a msgrcv(). If a message is coming in, the msgrcv() returns ok, if a poll is satisfied, the msgrcv() would return EINTR, and a character is available on one of the files (which could be checked out with another poll()).