diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2017-04-24 17:34:31 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-04-24 17:34:31 +0200 |
commit | 5ef0399ddd44e2f2e36d1a944f39e07544be8bbb (patch) | |
tree | 4ea5761f57da01f46d80943e9262f84153cd3adf | |
parent | ffcfbf4b66904529635d0b85687a1be48392ca15 (diff) | |
download | cygnal-5ef0399ddd44e2f2e36d1a944f39e07544be8bbb.tar.gz cygnal-5ef0399ddd44e2f2e36d1a944f39e07544be8bbb.tar.bz2 cygnal-5ef0399ddd44e2f2e36d1a944f39e07544be8bbb.zip |
cygwin: pinfo: do not wait for setting ppid on a transitional procinfo
This leads to excessive lag when stracing processes if the inferior
process checks the process table. The reason is that ppid isn't set
in the procinfo memory of the dynamically loading strace itself.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/pinfo.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index e43082d4a..f5a659d86 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -314,12 +314,17 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0) /* Detect situation where a transitional memory block is being retrieved. If the block has been allocated with PINFO_REDIR_SIZE but not yet updated with a PID_EXECED state then we'll retry. */ - if (!created && !(flag & PID_NEW)) - /* If not populated, wait 2 seconds for procinfo to become populated. - Would like to wait with finer granularity but that is not easily - doable. */ - for (int i = 0; i < 200 && !procinfo->ppid; i++) - Sleep (10); + if (!created && !(flag & PID_NEW) && !procinfo->ppid) + { + /* Fetching process info for /proc or ps? just ignore this one. */ + if (flag & PID_NOREDIR) + break; + /* If not populated, wait 2 seconds for procinfo to become populated. + Would like to wait with finer granularity but that is not easily + doable. */ + for (int i = 0; i < 200 && !procinfo->ppid; i++) + Sleep (10); + } if (!created && createit && (procinfo->process_state & PID_REAPED)) { |