* cygmagic: Add define name to warning.

* dcrt0.cc (_dll_crt0): Check for changes in child_info size.
(multiple_cygwin_problem): Avoid "proc" errors when testing.  Just assume new
cygwin proc.
* shared_info.h (mount_info): Add 'cb' element for sanity checks.
(shared_info): Ditto.
* child_info.h (child_info): Add fhandler_union_size element for sanity
checking.
* shared.cc (open_shared): Detect shared region size mismatch between parent
and child.
(shared_info::initialize): Detect shared region size mismatch with expectation.
(memory_Init): Ditto.
* sigproc.cc (init_child_info): Correctly set cb in passed structure.
* shared.cc (open_shared):
This commit is contained in:
Christopher Faylor
2001-12-26 21:35:16 +00:00
parent dcd8b9be82
commit aaf219f01e
7 changed files with 67 additions and 17 deletions

View File

@@ -831,20 +831,29 @@ _dll_crt0 ()
else if (fork_info->intro == PROC_MAGIC_GENERIC
&& fork_info->magic != CHILD_INFO_MAGIC)
multiple_cygwin_problem ("proc", fork_info->magic, CHILD_INFO_MAGIC);
unsigned should_be_cb = 0;
switch (fork_info->type)
{
case _PROC_FORK:
user_data->forkee = fork_info->cygpid;
should_be_cb = sizeof (child_info_fork);
case _PROC_SPAWN:
if (fork_info->pppid_handle)
CloseHandle (fork_info->pppid_handle);
case _PROC_EXEC:
{
child_proc_info = fork_info;
cygwin_mount_h = child_proc_info->mount_h;
mypid = child_proc_info->cygpid;
break;
}
if (!should_be_cb)
should_be_cb = sizeof (child_info);
if (should_be_cb != fork_info->cb)
multiple_cygwin_problem ("proc size", fork_info->cb, should_be_cb);
else if (sizeof (fhandler_union) != fork_info->fhandler_union_cb)
multiple_cygwin_problem ("fhandler size", fork_info->fhandler_union_cb, sizeof (fhandler_union));
else
{
child_proc_info = fork_info;
cygwin_mount_h = child_proc_info->mount_h;
mypid = child_proc_info->cygpid;
break;
}
default:
system_printf ("unknown exec type %d", fork_info->type);
fork_info = NULL;
@@ -1025,6 +1034,11 @@ __api_fatal (const char *fmt, ...)
void
multiple_cygwin_problem (const char *what, unsigned magic_version, unsigned version)
{
if (_cygwin_testing && strstr (what, "proc"))
{
fork_info = NULL;
return;
}
if (CYGWIN_VERSION_MAGIC_VERSION (magic_version) != version)
api_fatal ("%s version mismatch detected - %p/%p.\n\
You have multiple copies of cygwin1.dll on your system.\n\