Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!husc6!encore!houligan!epeterso From: epeterso@houligan.encore.com (Eric Peterson) Newsgroups: comp.unix.programmer Subject: Re: how to put a program into a .plan file Message-ID: Date: 4 Oct 90 18:37:36 GMT References: <978@bbt.UUCP> <1990Sep26.201406.12663@athena.mit.edu> <1990Sep28.154733.26346@cbnewsj.att.com> Sender: news@Encore.COM Reply-To: epeterson@encore.com (Eric Peterson) Organization: Encore Computer Corporation, Diagnostic Development Lines: 39 News-Software: NN 6.4.10 dwex@cbnewsj.att.com (david.e.wexelblat) writes: | Or, in System V, quoting from the open(2) man page: | | When opening a FIFO with O_RDONLY or O_WRONLY set: | | If O_NDELAY is clear: | An open for reading-only will block until a process | opens the file for writing. An open for writing-only | will block until a process opens the file for reading. | | So all you have to do is make .plan a FIFO, and have a program open | it for writing (the program will have to be in an infinite loop, though). I've found an interesting problem ... here's my situation. Rich's code works all fine and well, but running it from the command line caused it to die as soon as I log off. So I modified the program to fork(2) and return immediately (for my convenience in starting it) as well as to ignore SIGHUP so it would stay running after logoff. The problem is that the program works fine while I'm logged in, displaying only one fortune per finger. However, when I log off and the process is inhereted by the system, it does NOT block on the write to the pipe, but rather performs the write and buffers the output in the pipe. The upshot of all this is that while I'm logged out and the plan proc is running, huge amounts of fortunes accumulate in my .plan FIFO. Is this behavior normal? Or is there a problem with my flavor of System V? Thanks ... Eric -- Eric Peterson <> epeterson@encore.com <> uunet!encore!epeterson Encore Computer Corp. * Ft. Lauderdale, Florida * (305) 587-2900 x 5208 Why did Constantinople get the works? Gung'f abobql'f ohfvarff ohg gur Ghexf.