Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: Kamen TOMOV <kamen@cybuild.com>
Subject: Re: howto register process
Date: 12 Nov 2004 19:32:40 +0200
Organization: CYBUILD
Lines: 57
Message-ID: <874qjvezwn.fsf@zlatenlist.homelinux.net>
References: <873bzfdyvh.fsf@zlatenlist.homelinux.net> <NUTMEG0ApIWXzNbrDYs000006c2@NUTMEG.CAM.ARTIMI.COM> <87sm7fxeza.fsf@zlatenlist.homelinux.net> <20041112154218.GI26737@trixie.casa.cgf.cx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: 212-104-100-183.cable.evrocom.net
X-Home-Page: http://www.cybuild.com
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
X-IsSubscribed: yes

On Fri, Nov 12 2004, Christopher Faylor wrote:

> On Fri, Nov 12, 2004 at 05:29:45PM +0200, Kamen TOMOV wrote:
>
> >That's a great idea. I'll stick with it and will rewrite the
> >application to start the daemons from the cygwin's shell. That
> >would make my life much easier because instead of rewriting the
> >cygwin's fork function to register processes in its own virtual
> >table (although I do not know if that is possible) they would be
> >instantly available. It was strange to me that fork do not make
> >them appear there but anyway... thank you very much!
> 
> I can't shake the feeling that we are dancing around a misconception
> here somewhere.
> 
> The bash shell doesn't do anything magical when it starts processes.
> If you are using cygwin's fork then you shouldn't be worrying about
> "windows pids".  If you are running a cygwin program which uses fork
> and exec then the processes that it creates are cygwin processes and
> you will be able to manipulate them using normal UNIX functions.
> 
> If you are calling cygwin_winpid_to_pid on a pid that you got from a
> fork(), or spawn*() call then that is not right.
> 
> cgf

It's for sure that there are some things that are not quite clear, but
in a nutshell:

We have a daemon compiled with cygwin's fork, kill, etc.

1st scenario: 

- the daemon gets started as a Windows service
- the daemon forks (calling the cygwin's version of fork()) and as a
result we have a few children.

The facts:

- neither the daemon, nor its children are seen by cygwins's ps.exe or
  could be killed with kill.exe, or kill().

- calling cygwin_winpid_to_pid on the parent's pid or any of its
  children's pid returns the error result: -1.

2nd scenario: 

- the daemon gets started from the bash's command line.

The facts:

- the daemon is seen in the list of processes given by ps.exe and
  could be killed with kill.exe.

Regards,
-- 
Kamen TOMOV


--
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/

