[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dynamically generated files



On Mon, Apr 29, 2002 at 02:33:34PM -0700, Vineet Kumar wrote:
[snip]
> don't affect the other process. My only guess is that using tail -f
> is making it screwy somehow. Are you killing the tail with ^C ? Maybe
> the other process gets a SIGPIPE and for some reason this takes the
> gnome-terminal down with it. I've tried that in my setup as well, but
> nothing I do seems to kill the original process. I also don't see why
> you get multiple dates from a single 'tail' command.
> 
> It seems I don't fully understand this stuff either. =/ Maybe somebody
> more knowledgeable can speak up and help us out.
> 
> Of course, this is also OT, so maybe somebody will yell at us and tell
> us to go take it up in comp.os.unix.programming or some such.

Well, I'd say FIFO's are on-topic since they reside in the filesystem.

Some things to remember about FIFO's:

1.  FIFO's must be opened for reading or writing only.
2.  The open call for reading or writing a FIFO blocks if there is no 
    corresponding writer or reader, unless O_NONBLOCK is used.
3.  The read call will block if there is no data to read, or
    until the writer closes.  If there is no writer, it returns
    immediately.
4.  Attempts to write to a pipe that isn't open for reading
    will generate a SIGPIPE signal (an unhandled SIGPIPE will terminate
    the process).

Number 4 is the likely cause of the crashing shell since the reader
terminates while the writer is trying to do its thing.  Since the
actions aren't being run from a script, the shell itself isn't
protected from the signal (and apparently isn't handling it).  In a
script, the script would just terminate.  This SIGPIPE behavior is
stupid, but that's the standard...

The semantics of local sockets are generally easier to work with, IMHO.

-- 
Eric G. Miller <egm2@jps.net>


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: