mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-01 03:50:28 +08:00
* 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:
parent
dcd8b9be82
commit
aaf219f01e
@ -1,3 +1,21 @@
|
|||||||
|
2001-12-26 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* 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):
|
||||||
|
|
||||||
2001-12-26 Christopher Faylor <cgf@redhat.com>
|
2001-12-26 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* include/getopt.h: Protect a declaratin.
|
* include/getopt.h: Protect a declaratin.
|
||||||
|
@ -28,7 +28,7 @@ enum
|
|||||||
|
|
||||||
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
||||||
|
|
||||||
#define CURR_CHILD_INFO_MAGIC 0xba17
|
#define CURR_CHILD_INFO_MAGIC 0x8b3c
|
||||||
|
|
||||||
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
||||||
below class. The layout is checksummed to determine compatibility between
|
below class. The layout is checksummed to determine compatibility between
|
||||||
@ -49,6 +49,7 @@ public:
|
|||||||
init_cygheap *cygheap;
|
init_cygheap *cygheap;
|
||||||
void *cygheap_max;
|
void *cygheap_max;
|
||||||
HANDLE cygheap_h;
|
HANDLE cygheap_h;
|
||||||
|
unsigned fhandler_union_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
class child_info_fork: public child_info
|
class child_info_fork: public child_info
|
||||||
|
@ -14,7 +14,7 @@ while [ -n "$1" ]; do
|
|||||||
echo "#define $define $sum"
|
echo "#define $define $sum"
|
||||||
curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
|
curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
|
||||||
[ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING ***
|
[ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING ***
|
||||||
*** $file: magic number changed old $curr != new $sum
|
*** $file: magic number for $define changed old $curr != new $sum
|
||||||
*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
|
*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
|
||||||
done >> $file_magic
|
done >> $file_magic
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -831,14 +831,23 @@ _dll_crt0 ()
|
|||||||
else if (fork_info->intro == PROC_MAGIC_GENERIC
|
else if (fork_info->intro == PROC_MAGIC_GENERIC
|
||||||
&& fork_info->magic != CHILD_INFO_MAGIC)
|
&& fork_info->magic != CHILD_INFO_MAGIC)
|
||||||
multiple_cygwin_problem ("proc", 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)
|
switch (fork_info->type)
|
||||||
{
|
{
|
||||||
case _PROC_FORK:
|
case _PROC_FORK:
|
||||||
user_data->forkee = fork_info->cygpid;
|
user_data->forkee = fork_info->cygpid;
|
||||||
|
should_be_cb = sizeof (child_info_fork);
|
||||||
case _PROC_SPAWN:
|
case _PROC_SPAWN:
|
||||||
if (fork_info->pppid_handle)
|
if (fork_info->pppid_handle)
|
||||||
CloseHandle (fork_info->pppid_handle);
|
CloseHandle (fork_info->pppid_handle);
|
||||||
case _PROC_EXEC:
|
case _PROC_EXEC:
|
||||||
|
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;
|
child_proc_info = fork_info;
|
||||||
cygwin_mount_h = child_proc_info->mount_h;
|
cygwin_mount_h = child_proc_info->mount_h;
|
||||||
@ -1025,6 +1034,11 @@ __api_fatal (const char *fmt, ...)
|
|||||||
void
|
void
|
||||||
multiple_cygwin_problem (const char *what, unsigned magic_version, unsigned version)
|
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)
|
if (CYGWIN_VERSION_MAGIC_VERSION (magic_version) != version)
|
||||||
api_fatal ("%s version mismatch detected - %p/%p.\n\
|
api_fatal ("%s version mismatch detected - %p/%p.\n\
|
||||||
You have multiple copies of cygwin1.dll on your system.\n\
|
You have multiple copies of cygwin1.dll on your system.\n\
|
||||||
|
@ -103,10 +103,12 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, void *addr)
|
|||||||
void
|
void
|
||||||
shared_info::initialize ()
|
shared_info::initialize ()
|
||||||
{
|
{
|
||||||
if (inited)
|
if (version)
|
||||||
{
|
{
|
||||||
if (inited != SHARED_VERSION_MAGIC)
|
if (version != SHARED_VERSION_MAGIC)
|
||||||
multiple_cygwin_problem ("shared", inited, SHARED_VERSION);
|
multiple_cygwin_problem ("shared", version, SHARED_VERSION);
|
||||||
|
else if (cb != SHARED_INFO_CB)
|
||||||
|
multiple_cygwin_problem ("shared size", cb, SHARED_INFO_CB);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +117,11 @@ shared_info::initialize ()
|
|||||||
|
|
||||||
/* Initialize tty table. */
|
/* Initialize tty table. */
|
||||||
tty.init ();
|
tty.init ();
|
||||||
inited = SHARED_VERSION_MAGIC;
|
version = SHARED_VERSION_MAGIC;
|
||||||
|
cb = sizeof (*this);
|
||||||
|
if (cb != SHARED_INFO_CB)
|
||||||
|
system_printf ("size of shared memory region changed from %u to %u",
|
||||||
|
SHARED_INFO_CB, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
void __stdcall
|
||||||
@ -162,10 +168,16 @@ memory_init ()
|
|||||||
{
|
{
|
||||||
mount_table->version = MOUNT_VERSION_MAGIC;
|
mount_table->version = MOUNT_VERSION_MAGIC;
|
||||||
debug_printf ("initializing mount table");
|
debug_printf ("initializing mount table");
|
||||||
|
mount_table->cb = sizeof (*mount_table);
|
||||||
|
if (mount_table->cb != MOUNT_INFO_CB)
|
||||||
|
system_printf ("size of mount table region changed from %u to %u",
|
||||||
|
MOUNT_INFO_CB, mount_table->cb);
|
||||||
mount_table->init (); /* Initialize the mount table. */
|
mount_table->init (); /* Initialize the mount table. */
|
||||||
}
|
}
|
||||||
else if (mount_table->version != MOUNT_VERSION_MAGIC)
|
else if (mount_table->version != MOUNT_VERSION_MAGIC)
|
||||||
multiple_cygwin_problem ("mount", mount_table->version, MOUNT_VERSION);
|
multiple_cygwin_problem ("mount", mount_table->version, MOUNT_VERSION);
|
||||||
|
else if (mount_table->cb != MOUNT_INFO_CB)
|
||||||
|
multiple_cygwin_problem ("mount table size", mount_table->cb, MOUNT_INFO_CB);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ class mount_item
|
|||||||
public:
|
public:
|
||||||
/* FIXME: Nasty static allocation. Need to have a heap in the shared
|
/* FIXME: Nasty static allocation. Need to have a heap in the shared
|
||||||
area [with the user being able to configure at runtime the max size]. */
|
area [with the user being able to configure at runtime the max size]. */
|
||||||
|
|
||||||
/* Win32-style mounted partition source ("C:\foo\bar").
|
/* Win32-style mounted partition source ("C:\foo\bar").
|
||||||
native_path[0] == 0 for unused entries. */
|
native_path[0] == 0 for unused entries. */
|
||||||
char native_path[MAX_PATH];
|
char native_path[MAX_PATH];
|
||||||
@ -42,7 +41,8 @@ class mount_item
|
|||||||
|
|
||||||
#define MOUNT_VERSION 27 // increment when mount table changes and
|
#define MOUNT_VERSION 27 // increment when mount table changes and
|
||||||
#define MOUNT_VERSION_MAGIC CYGWIN_VERSION_MAGIC (MOUNT_MAGIC, MOUNT_VERSION)
|
#define MOUNT_VERSION_MAGIC CYGWIN_VERSION_MAGIC (MOUNT_MAGIC, MOUNT_VERSION)
|
||||||
#define CURR_MOUNT_MAGIC 0xfe35
|
#define CURR_MOUNT_MAGIC 0x41e0
|
||||||
|
#define MOUNT_INFO_CB 16488
|
||||||
|
|
||||||
class reg_key;
|
class reg_key;
|
||||||
|
|
||||||
@ -53,6 +53,7 @@ class mount_info
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DWORD version;
|
DWORD version;
|
||||||
|
unsigned cb;
|
||||||
DWORD sys_mount_table_counter;
|
DWORD sys_mount_table_counter;
|
||||||
int nmounts;
|
int nmounts;
|
||||||
mount_item mount[MAX_MOUNTS];
|
mount_item mount[MAX_MOUNTS];
|
||||||
@ -138,14 +139,17 @@ public:
|
|||||||
cygwin_version.api_minor)
|
cygwin_version.api_minor)
|
||||||
#define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
|
#define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
|
||||||
|
|
||||||
#define CURR_SHARED_MAGIC 0x6f6e
|
#define SHARED_INFO_CB 47112
|
||||||
|
|
||||||
|
#define CURR_SHARED_MAGIC 0x88e
|
||||||
|
|
||||||
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
||||||
below class. The layout is checksummed to determine compatibility between
|
below class. The layout is checksummed to determine compatibility between
|
||||||
different cygwin versions. */
|
different cygwin versions. */
|
||||||
class shared_info
|
class shared_info
|
||||||
{
|
{
|
||||||
DWORD inited;
|
DWORD version;
|
||||||
|
DWORD cb;
|
||||||
public:
|
public:
|
||||||
int heap_chunk_in_mb;
|
int heap_chunk_in_mb;
|
||||||
DWORD sys_mount_table_counter;
|
DWORD sys_mount_table_counter;
|
||||||
|
@ -857,13 +857,14 @@ void __stdcall
|
|||||||
init_child_info (DWORD chtype, child_info *ch, pid_t pid, HANDLE subproc_ready)
|
init_child_info (DWORD chtype, child_info *ch, pid_t pid, HANDLE subproc_ready)
|
||||||
{
|
{
|
||||||
memset (ch, 0, sizeof *ch);
|
memset (ch, 0, sizeof *ch);
|
||||||
ch->cb = sizeof *ch;
|
ch->cb = chtype == PROC_FORK ? sizeof (child_info_fork) : sizeof (child_info);
|
||||||
ch->intro = PROC_MAGIC_GENERIC;
|
ch->intro = PROC_MAGIC_GENERIC;
|
||||||
ch->magic = CHILD_INFO_MAGIC;
|
ch->magic = CHILD_INFO_MAGIC;
|
||||||
ch->type = chtype;
|
ch->type = chtype;
|
||||||
ch->cygpid = pid;
|
ch->cygpid = pid;
|
||||||
ch->subproc_ready = subproc_ready;
|
ch->subproc_ready = subproc_ready;
|
||||||
ch->pppid_handle = myself->ppid_handle;
|
ch->pppid_handle = myself->ppid_handle;
|
||||||
|
ch->fhandler_union_cb = sizeof (fhandler_union);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the state of all of our children to see if any are stopped or
|
/* Check the state of all of our children to see if any are stopped or
|
||||||
|
Loading…
x
Reference in New Issue
Block a user