Ver Fonte

Kernel: Remove the per-process icon_id and sys$set_process_icon()

This was a goofy kernel API where you could assign an icon_id (int) to
a process which referred to a global shbuf with a 16x16 icon bitmap
inside it.

Instead of this, programs that want to display a process icon now
retrieve it from the process executable instead.
Andreas Kling há 4 anos atrás
pai
commit
0e2b7f9c9a

+ 0 - 7
DevTools/UserspaceEmulator/Emulator.cpp

@@ -496,8 +496,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
         return virt$kill(arg1, arg2);
     case SC_set_mmap_name:
         return virt$set_mmap_name(arg1);
-    case SC_set_process_icon:
-        return virt$set_process_icon(arg1);
     case SC_exit:
         virt$exit((int)arg1);
         return 0;
@@ -744,11 +742,6 @@ int Emulator::virt$kill(pid_t pid, int signal)
     return syscall(SC_kill, pid, signal);
 }
 
-int Emulator::virt$set_process_icon(int shbuf_id)
-{
-    return syscall(SC_set_process_icon, shbuf_id);
-}
-
 int Emulator::virt$gettimeofday(FlatPtr timeval)
 {
     struct timeval host_timeval;

+ 0 - 1
DevTools/UserspaceEmulator/Emulator.h

@@ -126,7 +126,6 @@ private:
     int virt$unlink(FlatPtr path, size_t path_length);
     int virt$get_process_name(FlatPtr buffer, int size);
     int virt$set_mmap_name(FlatPtr);
-    int virt$set_process_icon(int);
     int virt$gettimeofday(FlatPtr);
     int virt$clock_gettime(int, FlatPtr);
     int virt$clock_nanosleep(FlatPtr);

+ 0 - 1
Kernel/API/Syscall.h

@@ -157,7 +157,6 @@ namespace Kernel {
     S(dbgputstr)              \
     S(watch_file)             \
     S(shbuf_allow_all)        \
-    S(set_process_icon)       \
     S(mprotect)               \
     S(realpath)               \
     S(get_process_name)       \

+ 0 - 1
Kernel/FileSystem/ProcFS.cpp

@@ -881,7 +881,6 @@ static OwnPtr<KBuffer> procfs$all(InodeIdentifier)
         process_object.add("amount_shared", process.amount_shared());
         process_object.add("amount_purgeable_volatile", process.amount_purgeable_volatile());
         process_object.add("amount_purgeable_nonvolatile", process.amount_purgeable_nonvolatile());
-        process_object.add("icon_id", process.icon_id());
         process_object.add("dumpable", process.is_dumpable());
         auto thread_array = process_object.add_array("threads");
         process.for_each_thread([&](const Thread& thread) {

+ 0 - 8
Kernel/Process.h

@@ -340,7 +340,6 @@ public:
     int sys$shbuf_set_volatile(int shbuf_id, bool);
     int sys$halt();
     int sys$reboot();
-    int sys$set_process_icon(int icon_id);
     int sys$realpath(Userspace<const Syscall::SC_realpath_params*>);
     ssize_t sys$getrandom(Userspace<void*>, size_t, unsigned int);
     int sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>);
@@ -457,11 +456,6 @@ public:
         return m_big_lock;
     }
 
-    int icon_id() const
-    {
-        return m_icon_id;
-    }
-
     u32 priority_boost() const
     {
         return m_priority_boost;
@@ -630,8 +624,6 @@ private:
 
     RefPtr<Timer> m_alarm_timer;
 
-    int m_icon_id { -1 };
-
     u32 m_priority_boost { 0 };
 
     u32 m_promises { 0 };

+ 0 - 14
Kernel/Syscalls/process.cpp

@@ -41,20 +41,6 @@ pid_t Process::sys$getppid()
     return m_ppid.value();
 }
 
-int Process::sys$set_process_icon(int icon_id)
-{
-    REQUIRE_PROMISE(shared_buffer);
-    LOCKER(shared_buffers().lock());
-    auto it = shared_buffers().resource().find(icon_id);
-    if (it == shared_buffers().resource().end())
-        return -EINVAL;
-    auto& shared_buffer = *(*it).value;
-    if (!shared_buffer.is_shared_with(m_pid))
-        return -EPERM;
-    m_icon_id = icon_id;
-    return 0;
-}
-
 int Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size)
 {
     REQUIRE_PROMISE(stdio);

+ 0 - 6
Libraries/LibC/unistd.cpp

@@ -550,12 +550,6 @@ void sync()
     syscall(SC_sync);
 }
 
-int set_process_icon(int icon_id)
-{
-    int rc = syscall(SC_set_process_icon, icon_id);
-    __RETURN_WITH_ERRNO(rc, rc, -1);
-}
-
 static String getlogin_buffer;
 
 char* getlogin()

+ 0 - 1
Libraries/LibC/unistd.h

@@ -61,7 +61,6 @@ int fsync(int fd);
 void sysbeep();
 int gettid();
 int donate(int tid);
-int set_process_icon(int icon_id);
 int getpagesize();
 pid_t fork();
 int execv(const char* path, char* const argv[]);

+ 0 - 1
Libraries/LibCore/ProcessStatisticsReader.cpp

@@ -75,7 +75,6 @@ HashMap<pid_t, Core::ProcessStatistics> ProcessStatisticsReader::get_all()
         process.amount_clean_inode = process_object.get("amount_clean_inode").to_u32();
         process.amount_purgeable_volatile = process_object.get("amount_purgeable_volatile").to_u32();
         process.amount_purgeable_nonvolatile = process_object.get("amount_purgeable_nonvolatile").to_u32();
-        process.icon_id = process_object.get("icon_id").to_int();
 
         auto& thread_array = process_object.get_ptr("threads")->as_array();
         process.threads.ensure_capacity(thread_array.size());

+ 0 - 1
Libraries/LibCore/ProcessStatisticsReader.h

@@ -77,7 +77,6 @@ struct ProcessStatistics {
     size_t amount_clean_inode;
     size_t amount_purgeable_volatile;
     size_t amount_purgeable_nonvolatile;
-    int icon_id;
 
     Vector<Core::ThreadStatistics> threads;
 

+ 0 - 4
Libraries/LibGUI/Window.cpp

@@ -721,10 +721,6 @@ void Window::apply_icon()
     rc = shbuf_allow_all(m_icon->shbuf_id());
     ASSERT(rc == 0);
 
-    static bool has_set_process_icon;
-    if (!has_set_process_icon)
-        set_process_icon(m_icon->shbuf_id());
-
     WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
 }
 

+ 0 - 2
Userland/top.cpp

@@ -58,7 +58,6 @@ struct ThreadData {
     unsigned inode_faults;
     unsigned zero_faults;
     unsigned cow_faults;
-    int icon_id;
     unsigned times_scheduled;
 
     unsigned times_scheduled_since_prev { 0 };
@@ -120,7 +119,6 @@ static Snapshot get_snapshot()
             thread_data.inode_faults = thread.inode_faults;
             thread_data.zero_faults = thread.zero_faults;
             thread_data.cow_faults = thread.cow_faults;
-            thread_data.icon_id = stats.icon_id;
             thread_data.times_scheduled = thread.times_scheduled;
             thread_data.priority = thread.priority;
             thread_data.state = thread.state;