(file: &mut File, vmclock_content: &VMClockContent)
| 388 | } |
| 389 | |
| 390 | fn write_vmclock_content(file: &mut File, vmclock_content: &VMClockContent) { |
| 391 | // Convert the VMClockShmBody struct into a slice so we can write it all out, fairly magic. |
| 392 | // Definitely needs the #[repr(C)] layout. |
| 393 | let slice = unsafe { |
| 394 | ::core::slice::from_raw_parts( |
| 395 | (vmclock_content as *const VMClockContent) as *const u8, |
| 396 | ::core::mem::size_of::<VMClockContent>(), |
| 397 | ) |
| 398 | }; |
| 399 | |
| 400 | file.write_all(slice).expect("Write failed VMClockContent"); |
| 401 | file.sync_all().expect("Sync to disk failed"); |
| 402 | } |
| 403 | |
| 404 | /// Helper function to remove files created during unit tests. |
| 405 | fn remove_file_or_directory(path: &str) { |
no outgoing calls