diff --git a/AK/SharedBuffer.cpp b/AK/SharedBuffer.cpp index 5f784a2466..4705cf9882 100644 --- a/AK/SharedBuffer.cpp +++ b/AK/SharedBuffer.cpp @@ -188,23 +188,4 @@ void SharedBuffer::seal() #endif } -void SharedBuffer::set_volatile() -{ -#if defined(__serenity__) - u32 rc = syscall(SC_shbuf_set_volatile, m_shbuf_id, true); - ASSERT(rc == 0); -#endif -} - -bool SharedBuffer::set_nonvolatile() -{ -#if defined(__serenity__) - u32 rc = syscall(SC_shbuf_set_volatile, m_shbuf_id, false); - if (rc == 0) - return true; - ASSERT(rc == 1); -#endif - return false; -} - } diff --git a/AK/SharedBuffer.h b/AK/SharedBuffer.h index 56e025046d..b07c9d21b0 100644 --- a/AK/SharedBuffer.h +++ b/AK/SharedBuffer.h @@ -57,9 +57,6 @@ public: return (const T*)m_data; } - void set_volatile(); - [[nodiscard]] bool set_nonvolatile(); - private: SharedBuffer(int shbuf_id, int size, void*); diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h index 4a7b7ea6c6..f956dff1e1 100644 --- a/Kernel/API/Syscall.h +++ b/Kernel/API/Syscall.h @@ -174,7 +174,6 @@ namespace Kernel { S(get_thread_name) \ S(madvise) \ S(purge) \ - S(shbuf_set_volatile) \ S(profiling_enable) \ S(profiling_disable) \ S(futex) \ diff --git a/Kernel/Process.h b/Kernel/Process.h index f6772bae62..e2b2a9f79c 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -341,7 +341,6 @@ public: void* sys$shbuf_get(int shbuf_id, Userspace size); int sys$shbuf_release(int shbuf_id); int sys$shbuf_seal(int shbuf_id); - int sys$shbuf_set_volatile(int shbuf_id, bool); int sys$halt(); int sys$reboot(); int sys$realpath(Userspace); diff --git a/Kernel/Syscalls/shbuf.cpp b/Kernel/Syscalls/shbuf.cpp index 50b72f2e1c..c49674a876 100644 --- a/Kernel/Syscalls/shbuf.cpp +++ b/Kernel/Syscalls/shbuf.cpp @@ -165,41 +165,4 @@ int Process::sys$shbuf_seal(int shbuf_id) return 0; } -int Process::sys$shbuf_set_volatile(int shbuf_id, bool state) -{ - REQUIRE_PROMISE(shared_buffer); - LOCKER(shared_buffers().lock()); - auto it = shared_buffers().resource().find(shbuf_id); - if (it == shared_buffers().resource().end()) - return -EINVAL; - auto& shared_buffer = *(*it).value; - if (!shared_buffer.is_shared_with(m_pid)) - return -EPERM; -#ifdef SHARED_BUFFER_DEBUG - klog() << "Set shared buffer " << shbuf_id << " volatile: " << state; -#endif - - bool was_purged = false; - auto set_volatile = [&]() -> int { - switch (shared_buffer.set_volatile_all(state, was_purged)) { - case SharedBuffer::SetVolatileError::Success: - break; - case SharedBuffer::SetVolatileError::NotPurgeable: - return -EPERM; - case SharedBuffer::SetVolatileError::OutOfMemory: - return -ENOMEM; - case SharedBuffer::SetVolatileError::NotMapped: - return -EINVAL; - } - return 0; - }; - - if (!state) { - if (int err = set_volatile()) - return err; - return was_purged ? 1 : 0; - } - return set_volatile(); -} - } diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 8248aedf53..db73c53041 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -397,8 +397,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$shbuf_release(arg1); case SC_shbuf_seal: return virt$shbuf_seal(arg1); - case SC_shbuf_set_volatile: - return virt$shbuf_set_volatile(arg1, arg2); case SC_profiling_enable: return virt$profiling_enable(arg1); case SC_profiling_disable: @@ -622,13 +620,6 @@ int Emulator::virt$shbuf_seal(int shbuf_id) return region->seal(); } -int Emulator::virt$shbuf_set_volatile(int shbuf_id, bool is_volatile) -{ - auto* region = m_mmu.shbuf_region(shbuf_id); - ASSERT(region); - return region->set_volatile(is_volatile); -} - int Emulator::virt$profiling_enable(pid_t pid) { return syscall(SC_profiling_enable, pid); diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index d842de77a3..238276df14 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -97,7 +97,6 @@ private: FlatPtr virt$shbuf_get(int shbuf_id, FlatPtr size); int virt$shbuf_release(int shbuf_id); int virt$shbuf_seal(int shbuf_id); - int virt$shbuf_set_volatile(int shbuf_id, bool); int virt$profiling_enable(pid_t); int virt$profiling_disable(pid_t); int virt$disown(pid_t); diff --git a/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.cpp b/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.cpp index aec26c2082..ae4942dc7c 100644 --- a/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.cpp @@ -124,9 +124,4 @@ int SharedBufferRegion::release() return syscall(SC_shbuf_release, m_shbuf_id); } -int SharedBufferRegion::set_volatile(bool is_volatile) -{ - return syscall(SC_shbuf_set_volatile, m_shbuf_id, is_volatile); -} - } diff --git a/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.h b/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.h index b3c7d68d5c..a099b16ebc 100644 --- a/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.h +++ b/Userland/DevTools/UserspaceEmulator/SharedBufferRegion.h @@ -55,7 +55,6 @@ public: int allow_pid(pid_t); int seal(); int release(); - int set_volatile(bool); private: SharedBufferRegion(u32 base, u32 size, int shbuf_id, u8* shbuf_data);