A single memory-mapped kernel buffer. 单个内核内存映射缓冲区。 Wraps a raw pointer returned by `mmap()`. Implements `Drop` to ensure `munmap()` is called — preventing resource leaks. 封装 `mmap()` 返回的裸指针。 实现 `Drop` 确保调用 `munmap()` —— 防止资源泄漏。
| 36 | /// 封装 `mmap()` 返回的裸指针。 |
| 37 | /// 实现 `Drop` 确保调用 `munmap()` —— 防止资源泄漏。 |
| 38 | struct MmapBuffer { |
| 39 | /// Pointer to the mapped memory region. |
| 40 | /// 指向映射内存区域的指针。 |
| 41 | ptr: *mut u8, |
| 42 | |
| 43 | /// Total size of this buffer in bytes. |
| 44 | /// 此缓冲区的总大小(字节)。 |
| 45 | length: usize, |
| 46 | } |
| 47 | |
| 48 | /// # Safety |
| 49 | /// mmap buffers are backed by kernel memory with well-defined access semantics. |
nothing calls this directly
no outgoing calls
no test coverage detected