浏览代码

Kernel: Remove sys$shbuf_set_volatile() and userland wrappers

There are no remaining users of this syscall so let's remove it! :^)
Andreas Kling 4 年之前
父节点
当前提交
de31e82f97

+ 0 - 19
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;
-}
-
 }

+ 0 - 3
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*);
 

+ 0 - 1
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)                  \

+ 0 - 1
Kernel/Process.h

@@ -341,7 +341,6 @@ public:
     void* sys$shbuf_get(int shbuf_id, Userspace<size_t*> 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<const Syscall::SC_realpath_params*>);

+ 0 - 37
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();
-}
-
 }

+ 0 - 9
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);

+ 0 - 1
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);

+ 0 - 5
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);
-}
-
 }

+ 0 - 1
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);