forkables: Keep hardlinks disabled via shared mem.

To avoid the need for each process to check the filesystem to detect
that hardlink creation is impossible or disabled, cache this fact in
shared memory.  Removing cygfork directory while in use does disable
hardlinks creation.  To (re-)enable hardlinks creation, the cygfork
directory has to exist before the first cygwin process does fork.

	* forkable.cc (dll_list::forkable_ntnamesize): Short cut
	forkables needs to impossible when disabled via shared memory.
	(dll_list::update_forkables_needs): When detecting hardlink
	creation as impossible (not on NTFS) while still (we are the
	first one checking) enabled via shared memory, disable the
	shared memory value.
	(dll_list::request_forkables): Disable the shared memory value
	when hardlinks creation became disabled, that is when the
	cygfork directory was removed.
	* include/cygwin/version.h: Bump CYGWIN_VERSION_SHARED_DATA 6.
	* shared_info.h (struct shared_info): Add member
	prefer_forkable_hardlinks.  Update CURR_SHARED_MAGIC.
	* shared.cc (shared_info::initialize): Initialize
	prefer_forkable_hardlinks to 1 (Yes).
This commit is contained in:
Michael Haubenwallner
2016-12-07 11:58:29 +01:00
committed by Corinna Vinschen
parent ece7282f32
commit 5a41aa6f4d
3 changed files with 16 additions and 2 deletions

View File

@ -33,7 +33,7 @@ public:
/* Data accessible to all tasks */
#define CURR_SHARED_MAGIC 0x6758de88U
#define CURR_SHARED_MAGIC 0x3a6025edU
#define USER_VERSION 1
@ -51,6 +51,7 @@ class shared_info
mtinfo mt;
loadavginfo loadavg;
LONG pid_src;
char prefer_forkable_hardlinks; /* single byte access always is atomic */
void initialize ();
void init_obcaseinsensitive ();