patch: minimize calls to close() in spawn by calling poll()

Jakub Wilk jwilk at
Sun Nov 18 13:51:35 CET 2018

* Werner Koch <wk at>, 2018-11-18, 12:42:
>On Sat, 17 Nov 2018 01:57, dctucker at said:
>>When running GPGME within Docker, the maximum number of FDs may be set 
>>higher than a sane and reasonable values for its specific use-case, 
>>causing many close calls to be issued, introducing a major slowdown in 
>Have you investigated why get_max_fd does not work for you.  On Linux 
>that function is is used to detect the highest used file descriptor by 
>reading /proc/self/fd/.  Or is your application really using that many 

FWIW, the parent of Casey's commit is fff2049c1bc7 (from 2014...), which 
didn't have this /proc/self/fd thing. Huh?

>Is is guaranteed that poll(3) does not allocate memory or other things 
>which may take a lock?

Yes, poll() is async-singal-safe.

Jakub Wilk

More information about the Gnupg-devel mailing list