diff options
Diffstat (limited to 'winsup/cygwin/external.cc')
-rw-r--r-- | winsup/cygwin/external.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 3a9130efd..ae30695a1 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -63,19 +63,23 @@ fillout_pinfo (pid_t pid, int winpid) _pinfo *p = pids[i]; i++; + /* Native Windows process not started from Cygwin have no procinfo + attached. They don't have a real Cygwin PID either. We fake a + Cygwin PID beyond MAX_PID. */ if (!p) { - if (!nextpid && thispid != (DWORD) pid) + if (!nextpid && thispid + MAX_PID != (DWORD) pid) continue; - ep.pid = cygwin_pid (thispid); + ep.pid = thispid + MAX_PID; ep.dwProcessId = thispid; ep.process_state = PID_IN_USE; ep.ctty = -1; break; } - else if (nextpid || p->pid == pid || (winpid && thispid == (DWORD) pid)) + else if (nextpid || p->pid == pid) { - ep.ctty = (p->ctty < 0 || iscons_dev (p->ctty)) ? p->ctty : device::minor (p->ctty); + ep.ctty = (p->ctty < 0 || iscons_dev (p->ctty)) + ? p->ctty : device::minor (p->ctty); ep.pid = p->pid; ep.ppid = p->ppid; ep.dwProcessId = p->dwProcessId; |