signalling upstream

From: bill pursell (bill.pursell_at_gmail.com)
Date: 11/11/05


Date: 11 Nov 2005 04:02:49 -0800

I would like to be able to do the following:
% a | b | c | d
and have the process d send a sigusr1 to process a. The only
reasonable way I can see of doing this is to have everyone in the pipe
pass along meta-information about the pipe. (ie, a writes its pid, b
reads it and writes out a's pid as well as its own, etc.)
Unfortunately, this prohibits the use of standard apps in the pipe, so
I want to avoid that if possible.

The second possible solution I see is to have d use its gid information
and look in /proc (or a registry that each process registers with, eg
in a file in /var/run) to determine a's pid. This leads to
difficulties when the pipe looks like this:
% a | b | c | a | b | d

I'm trying to avoid having a controlling process, since I really want
the flexibility of setting up the streams on the command line. Does
anyone know of implementations that have done something like this?
Feed-back in a data flow is pretty standard, but I'm having a hard time
fitting it in to the *-nix pipe philosophy. Can I pull this off
without writing meta-information into the pipe?



Relevant Pages

  • Re: Two-way pipes to a child process
    ... that both the parent and child processes are stuck in read. ... A pipe gets EOF on read only when *all* of the write ends of the ... Child PID: 5045, My PID: 5044 ... char *s, *argv0; ...
    (comp.unix.programmer)
  • Re: wait() and select()
    ... A thread in my C++ app needs to monitor sockets, but also child ... This baby program creates a pipe to itself. ... pid_t pid; ... int selfpipe; ...
    (comp.unix.programmer)
  • Perplexing buffering(?) problem
    ... pid = os.fork ... The child process dups the write end of the pipe to stdout, ... What I *expected* to happen was that the parent would immediately report ...
    (comp.lang.python)
  • Re: wget inklusive Pipe bei SIGINT =?UTF-8?Q?abschie=C3=9Fen=2E=2E=2E?=
    ... dann sendet dieses Programm an die PID des Scriptes ein SIGINT-Signal. ... trap INT ... Das ist im Falle einer Pipe ... immer der letzte Prozess. ...
    (de.comp.os.unix.shell)
  • Re: Communicate siginfo_t of SIGCHLD to parent
    ... >> signal pipe. ... There are also nasty problems lurking with PIPE_BUF and ... pid separation. ...
    (comp.unix.programmer)