473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sending signals upstream

This is not strictly a C question, but groups such as comp.unix.wizards
seem to have died. Does anyone know the appropriate group for this
question?

I want to signal an upstream process. eg:
% a | b | c | d
and d wants to send a signal to a.
The problem is: how does d get a's pid. I see 4 solutions:
1) a writes its pid information into the pipe.
drawback) intermediate processes need to deal with it. This
makes it difficult to use them arbitrarily as the start of the pipe
as now:
% cat foo | b | c
is problematic. A simple solution for this
is to take a command line arg to indicate start of pipe: eg
% cat foo | b -s | c...

2) a writes its pid on stderr and I do something ugly like:
% ( a | b | c ) 2>&1 | d
drawback) ugly as sin, difficult to handle multiple upstream
data paths, and I lose stderr. (I could use fd 3 instead, eg "3>&1",
but this is going to get real ugly, real fast.)

3) a registers its pid in a pid file. eg /var/run/a.xxx where
xxx is the gid. This is pretty decent, but there are some
naming conflicts in a pipe that looks like
% a | b | c| d | a | b | c | d
as both instances of a have the same gid.
In all the instances I can think of at the moment, d will want
to signal the process that is closest to it in the pipe, so it
can parse the pid file and pick the one with the pid closest
to its own, but this is inherently inflexible. It also relies on the
pids being assigned montonically
(ie d > c > b > a), and I'm not sure that's reliable.

4) Write a controlling process that catches the signals and
farms them out appropriately. Unfortunately, I think that this
and solution 1 are the only things that will really work. But
writing the parent means I completely lose the ability to
simply enter commands at the shell prompt, and I really
want that. I can't see a good way to write it as a
shell script, as if we include the line:
a | b | c | d &
in the script, I don't know how to get a's pid.

I'm hoping someone can give me solution number 5...

Nov 15 '05 #1
1 1305
In article <11**********************@g14g2000cwa.googlegroups .com>,
bill <bi**********@gmail.com> wrote:
This is not strictly a C question, but groups such as comp.unix.wizards
seem to have died. Does anyone know the appropriate group for this
question?
comp.unix.programming

I want to signal an upstream process. eg:
% a | b | c | d
and d wants to send a signal to a.
The problem is: how does d get a's pid. I see 4 solutions:


[OT]

process groups
--
All is vanity. -- Ecclesiastes
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rs035 | last post by:
good morning, everybody i know, it seems more to be a problem according to unix but i got it while developing software with php: i have 2 different users on a hp-ux machine that execute php...
2
by: Sarir Khamsi | last post by:
I would like to start a child process (like w/ popen3(), or some such) and then be able to interrupt it by sending it a control-c. How do I do that in Python? Is there a better way to gracefully...
1
by: Leo Kirch | last post by:
Hello XSLT gurus, i've got a rather difficult problem. Some explanations first. theres a signal oriented xml-file - the graphical represantation looks like: | startsignal (signal00) \...
4
by: David | last post by:
I'm wondering if python is capable of fairly precise timing and also sending data out the parallel port. For example ; making a 7.5 KHz square wave come out of one of the data pins on the...
0
by: Arnaud Debaene | last post by:
Hello all. I've got a bunch of existing, non managed, C++ DLLs that export types with, among other things, public events implemented using the boost::signals library. Now, I need to have...
4
by: david | last post by:
hello, I have a client/server application. the server capture picture from webcam and send it to every client connected to it.the network part works good and the capture from webcam too. I...
11
by: vippstar | last post by:
What is the purpose of signals and why do they exist in C? thanks in advance
1
by: Moe Sisko | last post by:
Using ASP.NET 2.0. The HTTP compression that comes with IIS 6.0 is great for compression downstream. However, there doesn't seem to be any standard way of compressing upstream (eg. on postback,...
5
by: anju1401 | last post by:
I want to send the signal from atmega32 to pc and plot them through matlab. I am sending the signals from microcontroller to pc through RS232 link. Can anybody tell how to go about the coding of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.