[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: library/668: libkvm broken in 2.4/alpha



The following reply was made to PR library/668; it has been noted by GNATS.

From: Marco S Hyman <marc_(_at_)_snafu_(_dot_)_org>
To: sturm_(_at_)_physik_(_dot_)_rwth-aachen_(_dot_)_de
Cc: gnats_(_at_)_openbsd_(_dot_)_org
Subject: Re: library/668: libkvm broken in 2.4/alpha 
Date: Mon, 21 Dec 1998 11:16:13 -0800

  > >Synopsis:       libkvm does not work correctly
 
 The problem was described and fixed a while back.  Here is the
 message describing it and a patch.  The patch is in -current.
 
 // marc
 
 Date:        Thu, 22 Oct 1998 17:52:41 PDT
 To:          OpenBSD Tech <tech_(_at_)_openbsd_(_dot_)_org>
 From:        Marco S Hyman <marc_(_at_)_snafu_(_dot_)_org>
 Message-Id:  <7097_(_dot_)_909103961_(_at_)_dumbcat_(_dot_)_snafu_(_dot_)_org>
 
 Subject:     savecore error message
 
 Just an FYI for the group.  If you ever see the message:
 
         savecore: /bsd: kvm_dump_mkheader: invalid magic in cpu_hdr
 
 ignore it.  First of all it is not a real problem.  It is a bogus
 error message that means "There has NEVER been a dump to save".
 The error message goes away after your first crash dump!
 
 It seems to be the result of a change to kvm.c last June.  The
 original code was:
 
         if ((CORE_GETMAGIC(cpu_hdr) != KCORE_MAGIC)
                 || (CORE_GETMID(cpu_hdr) != MID_MACHINE)) {
                 _kvm_err(kd, 0, "invalid magic in cpu_hdr");
                 return (0);
         }
 
 In june, the `return (0);' was changed to `return (-1);'  This
 causes savecore to print the error message stored by _kvm_err
 and exit:
 
         hdrsz = kvm_dump_mkheader(kd_dump, (off_t)dumplo);
         if (hdrsz == -1) {
                 syslog(LOG_ERR, "%s: kvm_dump_mkheader: %s", dump_sys,
                         kvm_geterr(kd_dump));
                 exit(1);
         }
         dumplo += hdrsz;
         kvm_close(kd_kern);
 
 With the 0 return savecore code would continue, see that the dump size
 was zero, realize that there was no dump to save, and exit with an
 appropriate error message (I think :-).
 
 So why was the code changed?
 
 Here is a patch to change it back:
 
 Index: kvm.c
 ===================================================================
 RCS file: /cvs/src/lib/libkvm/kvm.c,v
 retrieving revision 1.16
 diff -u -p -r1.16 kvm.c
 --- kvm.c       1998/08/24 05:32:39     1.16
 +++ kvm.c       1998/10/23 00:51:56
 @@ -480,7 +480,7 @@ off_t       dump_off;
         if ((CORE_GETMAGIC(cpu_hdr) != KCORE_MAGIC)
                 || (CORE_GETMID(cpu_hdr) != MID_MACHINE)) {
                 _kvm_err(kd, 0, "invalid magic in cpu_hdr");
 -               return (-1);
 +               return (0);
         }
         hdr_size = ALIGN(sizeof(cpu_hdr));
  
 
 
 


Visit your host, monkey.org