OSDN Git Service

* child_info.h: Add _PROC_WHOOPS enum value.
authorcgf <cgf>
Tue, 27 Aug 2002 04:10:53 +0000 (04:10 +0000)
committercgf <cgf>
Tue, 27 Aug 2002 04:10:53 +0000 (04:10 +0000)
(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.

winsup/cygwin/ChangeLog
winsup/cygwin/child_info.h
winsup/cygwin/cygheap.cc
winsup/cygwin/cygheap.h
winsup/cygwin/cygmagic
winsup/cygwin/dcrt0.cc
winsup/cygwin/shared_info.h

index 1e37ce9..5cdfa57 100644 (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>
 
        * fhandler.h (fhandler_socket::recvfrom): Fix prototype.
index 4b68e42..1aca724 100644 (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.
 
@@ -14,7 +14,8 @@ enum
 {
   _PROC_EXEC,
   _PROC_SPAWN,
-  _PROC_FORK
+  _PROC_FORK,
+  _PROC_WHOOPS
 };
 
 #define OPROC_MAGIC_MASK 0xff00ff00
@@ -28,7 +29,7 @@ enum
 
 #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
    below class.  The layout is checksummed to determine compatibility between
@@ -39,7 +40,7 @@ public:
   DWORD zero[4];       // must be zeroed
   DWORD cb;            // size of this record
   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
   int cygpid;          // cygwin pid of child process
   HANDLE subproc_ready;        // used for synchronization with parent
index 7ea7a39..937c339 100644 (file)
@@ -45,7 +45,6 @@ struct cygheap_entry
 
 extern "C" {
 static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
-extern void *_cygheap_start;
 }
 
 inline static void
index 7cd5bec..6f81eaa 100644 (file)
@@ -324,4 +324,5 @@ char *__stdcall cstrdup (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 cygheap_init ();
+extern DWORD _cygheap_start;
 }
index 3875938..a8ccc8c 100755 (executable)
@@ -17,16 +17,14 @@ cat <<EOF > $file_magic
 /* autogenerated - do not edit */
 #include "$file"
 EOF
-if sum -r /dev/null >/dev/null 2>&1; then
-  sumit(){ sum -r $*; }
-else
-  sumit(){ sum $*; }
-fi
+sumit() {
+    cksum $*
+}
 
 while [ -n "$1" ]; do
     define=$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"
     curr=`sed -n "s/^#[        ]*define CURR_$define[  ][      ]*\([^  ][^     ]*\)/\1/p" $file`
     [ "$curr" != "$sum" ] && echo "*** WARNING WARNING WARNING WARNING WARNING ***
index 0384275..003085d 100644 (file)
@@ -796,10 +796,11 @@ initial_env ()
 #ifdef DEBUGGING
   if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf) - 1))
     {
+      DWORD ms = atoi (buf);
       buf[0] = '\0';
       len = GetModuleFileName (NULL, buf, MAX_PATH);
-      console_printf ("Sleeping %d, pid %u %s\n", atoi (buf), GetCurrentProcessId (), buf);
-      Sleep (atoi (buf));
+      console_printf ("Sleeping %d, pid %u %s\n", ms, GetCurrentProcessId (), buf);
+      Sleep (ms);
     }
   if (GetEnvironmentVariable ("CYGWIN_DEBUG", buf, sizeof (buf) - 1))
     {
@@ -872,7 +873,11 @@ _dll_crt0 ()
        multiple_cygwin_problem ("proc", child_proc_info->intro, 0);
       else if (child_proc_info->intro == PROC_MAGIC_GENERIC
               && 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;
       switch (child_proc_info->type)
        {
@@ -896,6 +901,8 @@ _dll_crt0 ()
              }
          default:
            system_printf ("unknown exec type %d", child_proc_info->type);
+           /* intentionally fall through */
+         case _PROC_WHOOPS:
            child_proc_info = NULL;
            break;
        }
@@ -1071,9 +1078,9 @@ __api_fatal (const char *fmt, ...)
 void
 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;
     }
 
index 02a12ff..945bc17 100644 (file)
@@ -41,7 +41,7 @@ class mount_item
 
 #define MOUNT_VERSION  27      // increment when mount table changes and
 #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
 
 class reg_key;
@@ -138,7 +138,7 @@ public:
 
 #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
    below class.  The layout is checksummed to determine compatibility between