ipcd: Implement fsize for shm

To fix seek support.
This commit is contained in:
bjorn3
2026-03-08 21:35:52 +01:00
parent 3338fc7708
commit db4292da49
+18
View File
@@ -173,6 +173,24 @@ impl SchemeSync for ShmScheme {
Ok(())
}
fn fsize(&mut self, id: usize, _ctx: &CallerCtx) -> Result<u64> {
let path = self
.handles
.get(&id)
.and_then(Handle::as_shm)
.ok_or(Error::new(EBADF))?;
let size = match self
.maps
.get(path)
.expect("handle pointing to nothing")
.buffer
{
Some(ref map) => map.len(),
None => 0,
};
Ok(size as u64)
}
fn ftruncate(&mut self, id: usize, len: u64, _ctx: &CallerCtx) -> Result<()> {
let path = self
.handles