forkables: simplify disabling via shm

* Rename cygwin_shared->prefer_forkable_hardlinks to
  forkable_hardlink_support, with values
  0 for Unknown, 1 for Supported, -1 for Unsupported.
  Upon first dll loaded ever, dll_list::forkable_ntnamesize checks the
  /var/run/cygfork directory to both exist and reside on NTFS, setting
  cygwin_shared->forkable_hardlink_support accordingly.
* Replace enum forkables_needs by bool forkables_created: Set
  to True by request_forkables after creating forkable hardlinks.
This commit is contained in:
Michael Haubenwallner
2017-03-01 10:19:37 +01:00
committed by Corinna Vinschen
parent 8bbb3d3a23
commit 135577f708
5 changed files with 65 additions and 148 deletions

View File

@@ -87,17 +87,9 @@ struct dll
class dll_list
{
/* forkables */
enum
{
forkables_unknown,
forkables_impossible,
forkables_disabled,
forkables_needless,
forkables_needed,
forkables_created,
}
forkables_needs;
bool forkables_supported ();
DWORD forkables_dirx_size;
bool forkables_created;
PWCHAR forkables_dirx_ntname;
PWCHAR forkables_mutex_name;
HANDLE forkables_mutex;
@@ -160,10 +152,11 @@ public:
void cleanup_forkables ();
bool setup_forkables (bool with_forkables)
{
if (forkables_needs == forkables_impossible)
return true; /* short cut to not retry fork */
/* Once used, always use forkables in current process chain. */
if (forkables_needs != forkables_unknown)
if (!forkables_supported ())
return true; /* no need to retry fork */
if (forkables_created)
/* Once created, use forkables in current
process chain on first fork try already. */
with_forkables = true;
if (with_forkables)
request_forkables ();