how to put a program into a .plan file

Eric Peterson epeterso at houligan.encore.com
Fri Oct 5 04:37:36 AEST 1990


dwex at 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 at 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.



More information about the Comp.unix.programmer mailing list