mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 16:26:12 +08:00
* cygheap.cc (cygheap_fixup_in_child): Attempt Win95 workaround.
* dtable.cc (dtable::dup_worker): Add debugging output. (dtable::vfork_child_dup): Correctly set close_on_exec. * fhandler.cc (fhandler_base::fork_fixup): Don't mess with handle if there is no need to get it from the parent. * fhandler_tty.cc (fhandler_tty_common::close): Add debugging output.
This commit is contained in:
parent
b34f1c9f7b
commit
a7670c1e82
@ -1,3 +1,12 @@
|
|||||||
|
Fri 20 Jul 2001 11:15:50 PM EDT Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* cygheap.cc (cygheap_fixup_in_child): Attempt Win95 workaround.
|
||||||
|
* dtable.cc (dtable::dup_worker): Add debugging output.
|
||||||
|
(dtable::vfork_child_dup): Correctly set close_on_exec.
|
||||||
|
* fhandler.cc (fhandler_base::fork_fixup): Don't mess with handle if
|
||||||
|
there is no need to get it from the parent.
|
||||||
|
* fhandler_tty.cc (fhandler_tty_common::close): Add debugging output.
|
||||||
|
|
||||||
Fri 20 Jul 2001 09:15:00 Mark Bradshaw <bradshaw@staff.crosswalk.com>
|
Fri 20 Jul 2001 09:15:00 Mark Bradshaw <bradshaw@staff.crosswalk.com>
|
||||||
|
|
||||||
* dir.cc (readdir): Protect FindNextFileA against INVALID_HANDLE_VALUE.
|
* dir.cc (readdir): Protect FindNextFileA against INVALID_HANDLE_VALUE.
|
||||||
|
@ -74,7 +74,7 @@ cygheap_setup_for_child (child_info *ci)
|
|||||||
newcygheap = MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
newcygheap = MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
||||||
0, 0, 0, NULL);
|
0, 0, 0, NULL);
|
||||||
if (!VirtualAlloc (newcygheap, n, MEM_COMMIT, PAGE_READWRITE))
|
if (!VirtualAlloc (newcygheap, n, MEM_COMMIT, PAGE_READWRITE))
|
||||||
api_fatal ("couldn't allocate new heap for child, %E");
|
api_fatal ("couldn't allocate new cygwin heap for child, %E");
|
||||||
memcpy (newcygheap, cygheap, n);
|
memcpy (newcygheap, cygheap, n);
|
||||||
UnmapViewOfFile (newcygheap);
|
UnmapViewOfFile (newcygheap);
|
||||||
ci->cygheap = cygheap;
|
ci->cygheap = cygheap;
|
||||||
@ -96,9 +96,11 @@ cygheap_fixup_in_child (child_info *ci, bool execed)
|
|||||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
||||||
cygheap_h = ci->cygheap_h;
|
cygheap_h = ci->cygheap_h;
|
||||||
#endif
|
#endif
|
||||||
|
VirtualFree (cygheap, CYGHEAPSIZE, MEM_DECOMMIT);
|
||||||
|
VirtualFree (cygheap, 0, MEM_RELEASE);
|
||||||
if (MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
if (MapViewOfFileEx (ci->cygheap_h, FILE_MAP_READ | FILE_MAP_WRITE,
|
||||||
0, 0, 0, cygheap) != cygheap)
|
0, 0, CYGHEAPSIZE, cygheap) != cygheap)
|
||||||
api_fatal ("Couldn't allocate space for child's heap from %p, to %p, %E",
|
api_fatal ("Couldn't allocate space for child's cygwin heap from %p, to %p, %E",
|
||||||
cygheap, cygheap_max);
|
cygheap, cygheap_max);
|
||||||
|
|
||||||
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
|
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
|
||||||
|
@ -337,6 +337,7 @@ dtable::dup_worker (fhandler_base *oldfh)
|
|||||||
|
|
||||||
newfh->set_close_on_exec_flag (0);
|
newfh->set_close_on_exec_flag (0);
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
|
debug_printf ("duped '%s' old %p, new %p", oldfh->get_name (), oldfh->get_io_handle (), newfh->get_io_handle ());
|
||||||
return newfh;
|
return newfh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +535,9 @@ dtable::vfork_child_dup ()
|
|||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
if (not_open (i))
|
if (not_open (i))
|
||||||
continue;
|
continue;
|
||||||
else if ((newtable[i] = dup_worker (fds[i])) == NULL)
|
else if ((newtable[i] = dup_worker (fds[i])) != NULL)
|
||||||
|
newtable[i]->set_close_on_exec (fds[i]->get_close_on_exec ());
|
||||||
|
else
|
||||||
{
|
{
|
||||||
res = 0;
|
res = 0;
|
||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
@ -568,6 +571,7 @@ dtable::vfork_child_fixup ()
|
|||||||
{
|
{
|
||||||
if (!fds_on_hold)
|
if (!fds_on_hold)
|
||||||
return;
|
return;
|
||||||
|
debug_printf ("here");
|
||||||
fhandler_base **saveme = fds;
|
fhandler_base **saveme = fds;
|
||||||
fds = fds_on_hold;
|
fds = fds_on_hold;
|
||||||
|
|
||||||
|
@ -1542,7 +1542,9 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting, const char *namep
|
|||||||
void
|
void
|
||||||
fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
|
fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
|
||||||
{
|
{
|
||||||
if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
|
if (!get_close_on_exec ())
|
||||||
|
debug_printf ("handle %p already opened", h);
|
||||||
|
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
|
system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
|
||||||
}
|
}
|
||||||
|
@ -1014,7 +1014,7 @@ fhandler_tty_common::close ()
|
|||||||
termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
|
termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
|
||||||
|
|
||||||
inuse = NULL;
|
inuse = NULL;
|
||||||
termios_printf ("tty%d closed", ttynum);
|
termios_printf ("tty%d <%p,%p> closed", ttynum, get_handle (), get_output_handle ());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,8 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
|
|||||||
|
|
||||||
sync_with_parent ("after longjmp.", TRUE);
|
sync_with_parent ("after longjmp.", TRUE);
|
||||||
ProtectHandle (hParent);
|
ProtectHandle (hParent);
|
||||||
sigproc_printf ("hParent %p, child 1 first_dll %p, load_dlls %d\n", hParent, first_dll, load_dlls);
|
sigproc_printf ("hParent %p, child 1 first_dll %p, load_dlls %d\n", hParent,
|
||||||
|
first_dll, load_dlls);
|
||||||
|
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
char c;
|
char c;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user