Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>2016-12-07 13:58:28 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-02-07 17:58:02 +0300
commitece7282f329fd3616a9a1089aa0f0c26a5c01cc1 (patch)
treea40d53da4980658c85e293d02730b8b15d9c0c9b /winsup/cygwin/sigproc.cc
parent8ddb1f60c8bd5a1e6c64b2e713480bc7bc386328 (diff)
forkables: On fork failure, retry with hardlinks.
To support in-cygwin package managers, the fork() implementation must not rely on .exe and .dll files to stay in their original location, as the package manager's job is to replace these files. Instead, when the first fork try fails, and we have NTFS, we use hardlinks to the original binaries in /var/run/cygfork/ to create the child process during the second fork try, along the main.exe.local file to enable the "DotLocal Dll Redirection" feature for the dlls. The (probably few) users that need an update-safe fork manually have to create the /var/run/cygfork/ directory for now, using: mkdir --mode=a=rwxt /var/run/cygfork * child_info.h: Bump CURR_CHILD_INFO_MAGIC. (enum child_status): Add _CI_SILENTFAIL flag. (struct child_info): Add silentfail setter and getter. * winsup.h (child_copy): Add bool silentfail parameter. * cygheap.cc: Pass silentfail parameter to child_copy. * dcrt0.cc: Ditto. * dll_init.h (struct dll): Define public inline method forkedntname. (struct dll_list): Declare private method find_by_forkedntname. * dll_init.cc (struct dll_list): Implement find_by_forkedntname. (dll_list::alloc): Use find_by_forkedntname when in load after fork. (dll_list::load_after_fork_impl): Load dlls using dll::forkedntname. * fork.cc (frok::parent): Set silentfail child info flag. Pass silentfail parameter to child_copy. Use forkedntname of dlls.main_executable. (fork): When first dofork run failed and did not use forkables, run dofork again with_forkables set to true. (child_copy): Use debug_printf if silentfail is true, system_printf otherwise.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index a830bff79..30dfaaa25 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1101,7 +1101,10 @@ child_info_fork::abort (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
- strace_vprintf (SYSTEM, fmt, ap);
+ if (silentfail ())
+ strace_vprintf (DEBUG, fmt, ap);
+ else
+ strace_vprintf (SYSTEM, fmt, ap);
TerminateProcess (GetCurrentProcess (), EXITCODE_FORK_FAILED);
}
if (retry > 0)