delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/03/12:49:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 3 Feb 2004 12:44:32 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: =?iso-8859-1?Q?Lutz_H=F6rl?= <lhoerl AT thorlabs DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Re Re: Is there a translation from windows events to cygwin signals ?
In-Reply-To: <C2F0FC2A5C4B3E44ADF4327E699486A50A0EEE@mail2.de.thorlabs.local>
Message-ID: <Pine.GSO.4.56.0402031238070.24268@slinky.cs.nyu.edu>
References: <C2F0FC2A5C4B3E44ADF4327E699486A50A0EEE AT mail2 DOT de DOT thorlabs DOT local>
MIME-Version: 1.0
Note-from-DJ: This may be spam

On Tue, 3 Feb 2004, Lutz Hörl wrote:

> -----Ursprüngliche Nachricht-----
> Von: Igor Pechtchanski [mailto:pechtcha<at>cs<dot>nyu<dot>edu]

Please don't quote raw e-mail addresses in your replies.  Let's not make
the spam harvesters' life any easier.

> Gesendet: Dienstag, 3. Februar 2004 16:55
> An: Lutz Hörl
> Cc: cygwin<at>cygwin<dot>com
> Betreff: Re: Is there a translation from windows events to cygwin signals ?
>
> On Tue, 3 Feb 2004, Lutz Hörl wrote:
>
> > Hello,
> >
> > My problem:
> >
> > I have to send a signal to a running cygwin application, but I can not
> > use the cygwin API for this purpose.
>
> This doesn't make sense.  You can always do system("c:/cygwin/bin/kill -HUP <cygwin_pid>").
>
> > This signal (e.g. SIGHUP) can be cought by my cywin application, the
> > application can react on it in a proper way.
> >
> > Until now I found only documentation that states that the cygwin
> > signals rely on windows events but no documentation on how to use this
> > mechanism.
> >
> > Is there a 'translation' from windows events into signals ? Is there a
> > way to use then Win32 "BroadcastSystemMessage()" function to send a
> > Signal to cygwin application ?
> >
> > Thank you all
> > Lutz Hoerl
>
> Cygwin signals use Windows events under the covers, but there's more to
> Cygwin signals than just Windows events.  There's no one-to-one mapping.
> Use "kill".
>         Igor

BTW, your quoting method caused pine (and will probably cause any
signature_prefix-respecting browser) to cut off your reply (because it
follows my signature).

> Thank you Igor!
> I know it sounds ugly, but let me go a little more into detail.
>
> I want to do the following:
> Start a native Win32 application, let us call it the 'frontend'.

> This frontend starts and stops some cygwin applications. Start is no
> problem, I can do this with the Win32's CreateProcess() function.
> Therefrom I get the applications HANDLE. For stopping the application I
> want to use this HANDLE but I do not want to use the Win32's
> TerminateProcess() function to stop the process because that gives the
> (cygwin-) applications no time to save anything. That is the reason why
> I am looking for a SIGNAL-sending capability from Win32 applications.
>
> When I listen to your answer I can imagine what to do in my Win32 App.:
> 1. start the cygwin application via CreateProcess(), get a HANDLE
> 2. obtain the process' Win32-PID from the obtain HANDLE
> 3. use the cygwin win_pid to cygwin_pid function
> 4. use the cygwin kill() function with this pid to send a signal to the
> cygwin application
> 5. wait for the cygwin application to exit
>
> That means to compile the Win32 application with a DLL that does steps 2
> to 5.
>
> Can you confirm that this is the way ?
> I would be happy to read about a shorter way.
>
> Thank you again
> Lutz Hoerl

FWIW, Cygwin's kill() understands Win32 PIDs, so you can at least skip
step 3.  I suggest looking at Cygwin's implementation of /bin/kill (in CVS
as winsup/utils/kill.cc).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019