()
| 153 | |
| 154 | impl DumpItForLinux { |
| 155 | fn new() -> Result<Self> { |
| 156 | |
| 157 | let mem_ranges = Vec::new(); |
| 158 | |
| 159 | if !Uid::effective().is_root() { |
| 160 | return Err(Error::NixError("You must run this executable with root permissions.".to_string())); |
| 161 | } |
| 162 | |
| 163 | let kcore = fs::File::open(format!("{}kcore", PROC_DIR))?; |
| 164 | let iomem_ranges = DumpItForLinux::get_memory_ranges()?; |
| 165 | let _kallsyms = fs::File::open(format!("{}kallsyms", PROC_DIR))?; |
| 166 | |
| 167 | Ok(DumpItForLinux { |
| 168 | iomem_ranges, |
| 169 | mem_ranges, |
| 170 | // VMCOREINFO |
| 171 | vmci_size_va: None, |
| 172 | vmci_data_va: None, |
| 173 | vmcoreinfo: None, |
| 174 | // kcore |
| 175 | kcore, |
| 176 | out_header: None |
| 177 | }) |
| 178 | } |
| 179 | |
| 180 | // Initialize the data we need prior writing a new memory dump. |
| 181 | fn init(&mut self) -> Result<()> { |
nothing calls this directly
no outgoing calls
no test coverage detected