Cygwin: processes: fix handling of native Windows processes

Since commit b5e1003722, native
Windows processes not started by Cygwin processes don't have a
Cygwin PID anymore.  This breaks ps -W and kill -f <WINPID>.

Introduce MAX_PID (65536 for now).

Cygwin processes as well as native Windows processes started
from a Cygwin process get a PID < MAX_PID.  All other native
Windows processes get a faked Cygwin PID >= MAX_PID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-02-02 12:23:39 +01:00
parent 231ad6941f
commit 448cf5aa4b
3 changed files with 11 additions and 5 deletions

View File

@@ -241,7 +241,7 @@ create_cygwin_pid ()
do
{
pid = ((uint32_t) InterlockedIncrement (&cygwin_shared->pid_src))
% 65536;
% MAX_PID;
}
while (pid < 2);
__small_swprintf (sym_name, L"cygpid.%u", pid);