Fork issue with timerfd
Corinna Vinschen
corinna-cygwin@cygwin.com
Sun Feb 24 19:01:00 GMT 2019
On Feb 24 17:27, Ken Brown wrote:
> I'm seeing sporadic errors like this on 64-bit Cygwin when I first start emacs:
>
> 0 [main] emacs-X11 864 C:\cygwin64\bin\emacs-X11.exe: *** fatal error in
> forked process - Can't recreate shared timerfd section during fork!
> 0 [main] emacs 860 dofork: child 864 - died waiting for dll loading, errno 11
>
> If I exit and restart, everything will be fine almost every time.
I think I see where the thinko was here. Can you try this?
diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc
index 7e6be72b225a..7eda71ddb235 100644
--- a/winsup/cygwin/timerfd.cc
+++ b/winsup/cygwin/timerfd.cc
@@ -408,6 +408,7 @@ void
timerfd_tracker::fixup_after_fork_exec (bool execing)
{
NTSTATUS status;
+ PVOID base_address = NULL;
OBJECT_ATTRIBUTES attr;
SIZE_T vsize = PAGE_SIZE;
@@ -416,11 +417,12 @@ timerfd_tracker::fixup_after_fork_exec (bool execing)
return;
/* Recreate shared section mapping */
status = NtMapViewOfSection (tfd_shared_hdl, NtCurrentProcess (),
- (void **) &tfd_shared, 0, PAGE_SIZE, NULL,
+ &base_address, 0, PAGE_SIZE, NULL,
&vsize, ViewShare, MEM_TOP_DOWN, PAGE_READWRITE);
if (!NT_SUCCESS (status))
- api_fatal ("Can't recreate shared timerfd section during %s!",
- execing ? "execve" : "fork");
+ api_fatal ("Can't recreate shared timerfd section during %s, status %y!",
+ execing ? "execve" : "fork", status);
+ tfd_shared = (timerfd_shared *) base_address;
/* Increment global instance count by the number of instances in this
process */
InterlockedAdd (&tfd_shared->instance_count, local_instance_count);
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190224/a263d393/attachment.sig>
More information about the Cygwin
mailing list