1 .\" $NetBSD: kvm_dump.3,v 1.14 2009/03/10 23:49:07 joerg Exp $
3 .\" Copyright (c) 1996 Leo Weppelman
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 .Nm kvm_dump_mkheader ,
32 .Nm kvm_dump_wrtheader ,
34 .Nd crash dump support functions
40 .Fn kvm_dump_mkheader "kvm_t *kd" "off_t dump_off"
42 .Fn kvm_dump_wrtheader "kvm_t *kd" "FILE *fp" "int dumpsize"
44 .Fn kvm_dump_inval "kvm_t *kd"
46 First note that the functions described here were designed to be used by
51 checks if the physical memory file associated with
53 contains a valid crash dump header as generated by a dumping kernel.
54 When a valid header is found,
56 initializes the internal kvm data structures as if a crash dump generated by
60 This has the intentional side effect of enabling the
61 address translation machinery.
65 will most likely be followed by a call to
66 .Fn kvm_dump_wrtheader .
67 This function takes care of generating the generic header, the CORE_CPU
68 section and the section header of the CORE_DATA section.
69 The data is written to the file pointed at by
73 argument is only used to properly the set the segment size of the CORE_DATA
75 Note that this function assumes that
77 is positioned at file location 0.
78 This function will not seek and therefore allows
80 to be a file pointer obtained by
85 function clears the magic number in the physical memory file associated with
87 The address translations must be enabled for this to work (thus assuming
90 was called earlier in the sequence).
94 return 0 on success, -1 on failure.
97 returns the size of the headers present before the actual dumpdata starts.
98 If no valid headers were found but no fatal errors occurred, 0 is returned.
99 On fatal errors the return value is -1.
101 In the case of failure,
103 can be used to retrieve the cause of the error.
108 These functions first appeared in