kernel: Create a new shared memory object if the old one was lost
This commit is contained in:
parent
842b212685
commit
f150425222
@ -39,6 +39,11 @@ Result<u64> FramebufferDevice::query_shared_memory(off_t offset, usize count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* shm = g_shared_memory_map.try_get_ref(*m_shmid);
|
auto* shm = g_shared_memory_map.try_get_ref(*m_shmid);
|
||||||
|
if (!shm)
|
||||||
|
{
|
||||||
|
m_shmid = {};
|
||||||
|
return query_shared_memory(offset, count);
|
||||||
|
}
|
||||||
if (shm->offset > offset)
|
if (shm->offset > offset)
|
||||||
{
|
{
|
||||||
TRY(shm->grow_backward(Framebuffer::ptr() + offset, (shm->offset - offset) / ARCH_PAGE_SIZE));
|
TRY(shm->grow_backward(Framebuffer::ptr() + offset, (shm->offset - offset) / ARCH_PAGE_SIZE));
|
||||||
|
@ -144,6 +144,12 @@ namespace TmpFS
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* shm = g_shared_memory_map.try_get_ref(*m_shmid);
|
auto* shm = g_shared_memory_map.try_get_ref(*m_shmid);
|
||||||
|
if (!shm)
|
||||||
|
{
|
||||||
|
m_shmid = {};
|
||||||
|
return query_shared_memory(offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
if (shm->offset > offset)
|
if (shm->offset > offset)
|
||||||
{
|
{
|
||||||
TRY(shm->grow_backward(m_data_buffer.data() + offset, (shm->offset - offset) / ARCH_PAGE_SIZE));
|
TRY(shm->grow_backward(m_data_buffer.data() + offset, (shm->offset - offset) / ARCH_PAGE_SIZE));
|
||||||
|
Loading…
Reference in New Issue
Block a user