rutabaga_gfx/rutabaga_os/sys/stub/
memory_mapping.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2023 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use libc::c_void;

use crate::rutabaga_os::SafeDescriptor;
use crate::rutabaga_utils::RutabagaError;
use crate::rutabaga_utils::RutabagaResult;

/// Wraps an anonymous shared memory mapping in the current process. Provides
/// RAII semantics including munmap when no longer needed.
#[derive(Debug)]
pub struct MemoryMapping {
    pub addr: *mut c_void,
    pub size: usize,
}

impl MemoryMapping {
    pub fn from_safe_descriptor(
        _descriptor: SafeDescriptor,
        _size: usize,
        _map_info: u32,
    ) -> RutabagaResult<MemoryMapping> {
        Err(RutabagaError::Unsupported)
    }
}