rutabaga_gfx/rutabaga_os/sys/stub/
shm.rs

1// Copyright 2017 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::ffi::CStr;
6
7use crate::rutabaga_os::descriptor::AsRawDescriptor;
8use crate::rutabaga_os::descriptor::IntoRawDescriptor;
9use crate::rutabaga_os::RawDescriptor;
10use crate::rutabaga_utils::RutabagaError;
11use crate::rutabaga_utils::RutabagaResult;
12
13pub struct SharedMemory {
14    size: u64,
15}
16
17impl SharedMemory {
18    /// Creates a new shared memory file descriptor with zero size.
19    pub fn new(_debug_name: &CStr, _size: u64) -> RutabagaResult<SharedMemory> {
20        Err(RutabagaError::Unsupported)
21    }
22
23    /// Gets the size in bytes of the shared memory.
24    ///
25    /// The size returned here does not reflect changes by other interfaces or users of the shared
26    /// memory file descriptor..
27    pub fn size(&self) -> u64 {
28        self.size
29    }
30}
31
32impl AsRawDescriptor for SharedMemory {
33    fn as_raw_descriptor(&self) -> RawDescriptor {
34        unimplemented!()
35    }
36}
37
38impl IntoRawDescriptor for SharedMemory {
39    fn into_raw_descriptor(self) -> RawDescriptor {
40        unimplemented!()
41    }
42}
43
44/// Uses the system's page size in bytes to round the given value up to the nearest page boundary.
45pub fn round_up_to_page_size(_v: u64) -> RutabagaResult<u64> {
46    Err(RutabagaError::Unsupported)
47}