static int _fork_child_entry(HANDLE hData) { struct _fork_shared* shared; shared = MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0); if (shared == NULL) return -1; // snag handles that parent has duped for us assert( _to_descriptor(shared->hStdin, (void*)STDIN_FILENO) >= 0); assert( _to_descriptor(shared->hStdout, (void*)STDOUT_FILENO) >= 0); assert( _to_descriptor(shared->hStderr, (void*)STDERR_FILENO) >= 0); #if defined(__CYGWIN__) // re-initialize cygwin dll_dllcrt0(); #endif #if defined(__CYGWIN__) && defined(_NATIVE_) _fork_override_cygwin_exceptions(); #endif if (UnmapViewOfFile(shared) == FALSE) return -1; return 0; }
/* for a loaded dll */ int cygwin_attach_dll (HMODULE h, MainFunc f) { static struct per_process u; (void) _cygwin_crt0_common (f, &u); /* jump into the dll. */ return dll_dllcrt0 (h, &u); }