* child_info.h: Add _PROC_WHOOPS enum value.

(CURR_CHILD_INFO_MAGIC): Update.
(child_info::magic): Make 'long'.
* cygheap.h: Export _cygheap_start.
* cygheap.cc: Don't declare _cygheap_start.
* cygmagic: Use cksum to produce checksums.  Append 'U' to end of checksum.
* dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer.
(_dll_crt0): Detect cygheap mismatch as indicative of different cygwin version.
Set child_proc_info to NULL when _PROC_WHOOPS.
(multiple_cygwin_problem): If child_info specific problem, then set
child_proc_info type to _PROC_WHOOPS.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(CURR_SHARED_MAGIC): Ditto.
This commit is contained in:
Christopher Faylor 2002-08-27 04:10:54 +00:00
parent 4854ee501e
commit 6d8bd861e2
7 changed files with 42 additions and 19 deletions

View File

@ -1,3 +1,20 @@
2002-08-27 Christopher Faylor <cgf@redhat.com>
* child_info.h: Add _PROC_WHOOPS enum value.
(CURR_CHILD_INFO_MAGIC): Update.
(child_info::magic): Make 'long'.
* cygheap.h: Export _cygheap_start.
* cygheap.cc: Don't declare _cygheap_start.
* cygmagic: Use cksum to produce checksums. Append 'U' to end of
checksum.
* dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer.
(_dll_crt0): Detect cygheap mismatch as indicative of different cygwin
version. Set child_proc_info to NULL when _PROC_WHOOPS.
(multiple_cygwin_problem): If child_info specific problem, then set
child_proc_info type to _PROC_WHOOPS.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(CURR_SHARED_MAGIC): Ditto.
2002-08-25 Conrad Scott <conrad.scott@dsl.pipex.com> 2002-08-25 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_socket::recvfrom): Fix prototype. * fhandler.h (fhandler_socket::recvfrom): Fix prototype.

View File

@ -1,6 +1,6 @@
/* childinfo.h: shared child info for cygwin /* child_info.h: shared child info for cygwin
Copyright 2000, 2002 Red Hat, Inc. Copyright 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -14,7 +14,8 @@ enum
{ {
_PROC_EXEC, _PROC_EXEC,
_PROC_SPAWN, _PROC_SPAWN,
_PROC_FORK _PROC_FORK,
_PROC_WHOOPS
}; };
#define OPROC_MAGIC_MASK 0xff00ff00 #define OPROC_MAGIC_MASK 0xff00ff00
@ -28,7 +29,7 @@ enum
#define EXEC_MAGIC_SIZE sizeof(child_info) #define EXEC_MAGIC_SIZE sizeof(child_info)
#define CURR_CHILD_INFO_MAGIC 0x8b3c #define CURR_CHILD_INFO_MAGIC 0xb3836013U
/* 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
@ -39,7 +40,7 @@ public:
DWORD zero[4]; // must be zeroed DWORD zero[4]; // must be zeroed
DWORD cb; // size of this record DWORD cb; // size of this record
DWORD intro; // improbable string DWORD intro; // improbable string
unsigned short magic; // magic number unique to child_info unsigned long magic; // magic number unique to child_info
unsigned short type; // type of record, exec, spawn, fork unsigned short type; // type of record, exec, spawn, fork
int cygpid; // cygwin pid of child process int cygpid; // cygwin pid of child process
HANDLE subproc_ready; // used for synchronization with parent HANDLE subproc_ready; // used for synchronization with parent

View File

@ -45,7 +45,6 @@ struct cygheap_entry
extern "C" { extern "C" {
static void __stdcall _cfree (void *ptr) __attribute__((regparm(1))); static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
extern void *_cygheap_start;
} }
inline static void inline static void

View File

@ -324,4 +324,5 @@ char *__stdcall cstrdup (const char *) __attribute__ ((regparm(1)));
char *__stdcall cstrdup1 (const char *) __attribute__ ((regparm(1))); char *__stdcall cstrdup1 (const char *) __attribute__ ((regparm(1)));
void __stdcall cfree_and_set (char *&, char * = NULL) __attribute__ ((regparm(2))); void __stdcall cfree_and_set (char *&, char * = NULL) __attribute__ ((regparm(2)));
void __stdcall cygheap_init (); void __stdcall cygheap_init ();
extern DWORD _cygheap_start;
} }

View File

@ -17,16 +17,14 @@ cat <<EOF > $file_magic
/* autogenerated - do not edit */ /* autogenerated - do not edit */
#include "$file" #include "$file"
EOF EOF
if sum -r /dev/null >/dev/null 2>&1; then sumit() {
sumit(){ sum -r $*; } cksum $*
else }
sumit(){ sum $*; }
fi
while [ -n "$1" ]; do while [ -n "$1" ]; do
define=$1; shift define=$1; shift
struct=$1; shift struct=$1; shift
sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%x", $1}'` sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%xU", $1}'`
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 ***

View File

@ -796,10 +796,11 @@ initial_env ()
#ifdef DEBUGGING #ifdef DEBUGGING
if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf) - 1)) if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf) - 1))
{ {
DWORD ms = atoi (buf);
buf[0] = '\0'; buf[0] = '\0';
len = GetModuleFileName (NULL, buf, MAX_PATH); len = GetModuleFileName (NULL, buf, MAX_PATH);
console_printf ("Sleeping %d, pid %u %s\n", atoi (buf), GetCurrentProcessId (), buf); console_printf ("Sleeping %d, pid %u %s\n", ms, GetCurrentProcessId (), buf);
Sleep (atoi (buf)); Sleep (ms);
} }
if (GetEnvironmentVariable ("CYGWIN_DEBUG", buf, sizeof (buf) - 1)) if (GetEnvironmentVariable ("CYGWIN_DEBUG", buf, sizeof (buf) - 1))
{ {
@ -872,7 +873,11 @@ _dll_crt0 ()
multiple_cygwin_problem ("proc", child_proc_info->intro, 0); multiple_cygwin_problem ("proc", child_proc_info->intro, 0);
else if (child_proc_info->intro == PROC_MAGIC_GENERIC else if (child_proc_info->intro == PROC_MAGIC_GENERIC
&& child_proc_info->magic != CHILD_INFO_MAGIC) && child_proc_info->magic != CHILD_INFO_MAGIC)
multiple_cygwin_problem ("proc", child_proc_info->magic, CHILD_INFO_MAGIC); multiple_cygwin_problem ("proc", child_proc_info->magic,
CHILD_INFO_MAGIC);
else if (child_proc_info->cygheap != (void *) &_cygheap_start)
multiple_cygwin_problem ("cygheap", (DWORD) child_proc_info->cygheap,
(DWORD) &_cygheap_start);
unsigned should_be_cb = 0; unsigned should_be_cb = 0;
switch (child_proc_info->type) switch (child_proc_info->type)
{ {
@ -896,6 +901,8 @@ _dll_crt0 ()
} }
default: default:
system_printf ("unknown exec type %d", child_proc_info->type); system_printf ("unknown exec type %d", child_proc_info->type);
/* intentionally fall through */
case _PROC_WHOOPS:
child_proc_info = NULL; child_proc_info = NULL;
break; break;
} }
@ -1071,9 +1078,9 @@ __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")) if (_cygwin_testing && (strstr (what, "proc") || strstr (what, "cygheap")))
{ {
fork_info = NULL; child_proc_info->type = _PROC_WHOOPS;
return; return;
} }

View File

@ -41,7 +41,7 @@ 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 0xf4e5 #define CURR_MOUNT_MAGIC 0x4fe431cdU
#define MOUNT_INFO_CB 16488 #define MOUNT_INFO_CB 16488
class reg_key; class reg_key;
@ -138,7 +138,7 @@ public:
#define SHARED_INFO_CB 47112 #define SHARED_INFO_CB 47112
#define CURR_SHARED_MAGIC 0x88e #define CURR_SHARED_MAGIC 0x29eb8ccdU
/* 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