delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/11/19:26:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <419403DF.712E332F@dessent.net>
Date: Thu, 11 Nov 2004 16:29:19 -0800
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: howto register process
References: <87mzxoveei DOT fsf AT zlatenlist DOT homelinux DOT net> <NUTMEGadVe5HXC9xubf00000688 AT NUTMEG DOT CAM DOT ARTIMI DOT COM> <87vfccw8f5 DOT fsf AT zlatenlist DOT homelinux DOT net> <20041111182839 DOT GE14312 AT trixie DOT casa DOT cgf DOT cx> <87k6ssw7ub DOT fsf AT zlatenlist DOT homelinux DOT net>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Kamen TOMOV wrote:

> The parent process is started as a windows server. Then it executes
> cygwin's fork. When I try to kill any of these with kill() it returns
> "No such pid".

Are you sure you're not confusing Cygwin PIDs with Win32 PIDs?  In order
to make the fork() magic work, Cygwin maintains its own PIDs in parallel
to the actual windows PID.  All the Cygwin functions that take PIDs as
arguments expect Cygwin PIDs, and won't work if you give the windows
PID.  Example, my output of "ps -a" shows the following:

 PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
4340       1    4340       4340  con 1003 16:13:34 /usr/bin/rxvt
3548    4340    3548       7768    0 1003 16:13:34 /usr/bin/bash
4320       1    4320       4320    ?   18 16:13:39 /usr/bin/cygrunsrv
6684    4320    6684       5772    ?   18 16:13:39 /usr/sbin/cron
5824       1    5824       5824    ? 1003 16:13:40 /usr/bin/cygrunsrv
7752       1    7752       7752    ?   18 16:13:40 /usr/bin/cygrunsrv
5116       1    5116       5116    ?   18 16:13:40 /usr/bin/cygrunsrv
6832    5116    6832        216    ?   18 16:13:40 /usr/sbin/sshd
7928    5824    7928       7212    ? 1003 16:13:40 /usr/bin/autossh
2560    7752    2560       6760    ?   18 16:13:40 /usr/sbin/cygserver
4992    7928    7928       7900    ? 1003 16:13:40 /usr/bin/ssh
6896       1    6896       6896  con 1003 16:13:50 /usr/bin/rxvt
 164    6896     164       5452    1 1003 16:13:50 /usr/bin/bash
5984    3548    5984       2124    0 1003 16:13:59 /usr/bin/ssh
6628     164    6628       2432    1 1003 16:25:39 /usr/bin/ps

As you can see, PID and WINPID are sometimes the same, but often not.

Brian

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