cygrunsrv + sshd + rsync = 20 times too slow -- throttled?

Takashi Yano takashi.yano@nifty.ne.jp
Mon Oct 18 12:02:31 GMT 2021


Hi Corinna,

On Mon, 18 Oct 2021 12:51:37 +0200
Corinna Vinschen wrote:
> The patch looks basically ok, but we shouldn't use PSAPI calls inside
> Cygwin.  I'm a bit fuzzy on the details, but we had some problems with
> PSAPI way back when.
> 
> One of them, prominently, is the fact that the entry points have changed
> in the past.  EnumProcess from psapi.dll is now k32_EnumProcess from
> kernel32.dll or whatever, since the headers are using PSAPI_VERSION 2 as
> default.  Linking against that will break Vista.  If you change this to
> PSAPI_VERSION 1, OTOH, you will have to add the psapi symbols to
> autoload.cc.
> 
> Why don't you just use winpids, as in:
> 
>   winpids pids;
>   pids.set (true);
>   for (int i = 0; i < pids.npids; ++i)
>     ...
>   pids.reset ();
> 
> This will use NtQuerySystemInformation (SystemProcessInformation) under
> the hood.  Of course, winpids adds a bit of unnecessary overhead by
> checking for procinfo stuff, so maybe you may want to use
> NtQuerySystemInformation (SystemProcessInformation) directly and
> just copy/paste the minimally required code from the `else' branch in
> winpids::enum_processes.

Thanks for reviewing the code.

I will make a patch which replaces EnumProcesses() with
NtQuerySystemInformation (SystemProcessInformation).

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-developers mailing list