From 77f4a2502895c8c619da30c3ddee12f0695ad05f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 26 Dec 2001 04:53:34 +0000 Subject: * Makefile.in: Autogenerate some header files which provide magic numbers. Force dependencies for files which depend on autogenerated headers to ensure that they are always built. * child_info.h (child_info): Add new fields to accommodate new magic number header stuff. * dcrt0.cc: Rely on "child_info_magic.h" to ensure that correct child_info magic numbers are used. (dll_crt0_1): Temporarily remove _cygwin_testing_magic test. (_dll_crt0): Do more testing on magic numbers from fork_info structure. Call "multiple_cygwin_problem" where appropriate. (multiple_cygwin_problem): Rename from multiple_cygwin_die. Issue a warning or die, as appropriate based on cygwin version/magic number mismatch. * pinfo.cc (pinfo::exit): Don't attempt to dereference `this' if it doesn't exist. This can happen when a fatal error occurs early in process initialization. * shared.cc: Rely on "shared_info_magic.h" to accommodate that new magic number header stuff. (shared_info::initialize): Use new magic number stuff, for shared region. (memory_init): Ditto, for mount table. * shared_info.h: Accomodate new magic number stuff for shared region and mount table. * sigproc.cc: Rely on "child_info_magic.h" to accommodate new magic number header stuff. (init_child_info): Initialize new fields in child_info) to accomodate magic numbers. * winsup.h: Rename multiple_cygwin_die to multiple_cygwin_problem. * include/cygwin/version.h: Define macros for manipulating version magic. * cygmagic: New shell script for generating magic numbers. --- winsup/cygwin/cygmagic | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 winsup/cygwin/cygmagic (limited to 'winsup/cygwin/cygmagic') diff --git a/winsup/cygwin/cygmagic b/winsup/cygwin/cygmagic new file mode 100755 index 000000000..17c74b496 --- /dev/null +++ b/winsup/cygwin/cygmagic @@ -0,0 +1,20 @@ +#!/bin/sh +file_magic=$1; shift +gcc=$1; shift +file=$1; shift +trap "rm -f /tmp/$$.magic" 0 1 2 15 +cat < $file_magic +/* autogenerated - do not edit */ +#include "$file" +EOF +while [ -n "$1" ]; do + define=$1; shift + struct=$1; shift + sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sum | awk '{print "obase=16;\"0x\";", $1}' | bc | tr '[A-Z]' '[a-z]'` + echo "#define $define $sum" + curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file` + [ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING *** +*** $file: magic number changed old $curr != new $sum +*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2 +done >> $file_magic +exit 0 -- cgit v1.2.3