473,799 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending signals upstream

This is not strictly a C question, but groups such as comp.unix.wizar ds
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 1322
In article <11************ **********@g14g 2000cwa.googleg roups.com>,
bill <bi**********@g mail.com> wrote:
This is not strictly a C question, but groups such as comp.unix.wizar ds
seem to have died. Does anyone know the appropriate group for this
question?
comp.unix.progr amming

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
1683
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 scripts. they are both in the same group. these php scripts start background processes, i can communicate with using signals (sending with posix_kill, starting background processes via pcntl_fork). so i got severel background processes owned by my 2...
2
2061
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 halt a child process? Is there a more cross-platform way to start a child process (popen() is only on UNIX/Win32)? Thanks. Sarir
1
1658
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
3583
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 printer port. I've tried to help myself with this one but searching in the "Python Library Reference" that installed with my version, yielded nothing on the subject of either timing or parallel port.
0
1946
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 these DLL interoperate with managed code. Among others things, the managed code need to be able to register for notification with the boost signals. I've tried different approaches (trying to register a pinned delegate with the boost::signal, etc...),
4
12090
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 associate an event when a capture is done, then every frame of the webcam should be sent to the client. but I cannot find a way to send bitmap throught network, of course I found many method from internet, some doen't work, some work but it's never...
11
1841
by: vippstar | last post by:
What is the purpose of signals and why do they exist in C? thanks in advance
1
1286
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, to reduce size of ViewState etc). Does anyone use any compression solutions for reducing the amount of network traffic going upstream ?
5
4800
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 atmega32 so that the signals can be plotted through matlab?
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.