(file: &mut File, vmclock_content: &VMClockContent)
| 373 | // Convert the VMClockShmBody struct into a slice so we can write it all out, fairly magic. |
| 374 | // Definitely needs the #[repr(C)] layout. |
| 375 | let slice = unsafe { |
| 376 | ::core::slice::from_raw_parts( |
| 377 | (vmclock_content as *const VMClockContent) as *const u8, |
| 378 | ::core::mem::size_of::<VMClockContent>(), |
| 379 | ) |
| 380 | }; |
| 381 | |
| 382 | file.write_all(slice).expect("Write failed VMClockContent"); |
| 383 | file.sync_all().expect("Sync to disk failed"); |
| 384 | } |
| 385 | |
| 386 | fn remove_path_if_exists(path_shm: &str) { |
| 387 | let path = Path::new(path_shm); |
| 388 | if path.exists() { |
| 389 | if path.is_dir() { |
| 390 | std::fs::remove_dir_all(path_shm).expect("failed to remove file"); |
no outgoing calls