mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-12 16:45:31 +00:00
sys_util: SharedMemory: Add into_file
This will be very useful in tests that need a file as it removes the need for a temporary file to be created. Change-Id: I7fb08209174c870279e34ee07aad7a3b05baaad9 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/864625 Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
c2051921b5
commit
61046bfe82
1 changed files with 6 additions and 0 deletions
|
@ -184,6 +184,12 @@ impl AsRawFd for SharedMemory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Into<File> for SharedMemory {
|
||||||
|
fn into(self) -> File {
|
||||||
|
self.fd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Checks if the kernel we are running on has memfd_create. It was introduced in 3.17.
|
/// Checks if the kernel we are running on has memfd_create. It was introduced in 3.17.
|
||||||
/// Only to be used from tests to prevent running on ancient kernels that won't
|
/// Only to be used from tests to prevent running on ancient kernels that won't
|
||||||
/// support the functionality anyways.
|
/// support the functionality anyways.
|
||||||
|
|
Loading…
Reference in a new issue