mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									cb68b8ff8b
								
							
						
					
					
						commit
						0e2b7f9c9a
					
				
					 12 changed files with 0 additions and 47 deletions
				
			
		|  | @ -496,8 +496,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) | ||||||
|         return virt$kill(arg1, arg2); |         return virt$kill(arg1, arg2); | ||||||
|     case SC_set_mmap_name: |     case SC_set_mmap_name: | ||||||
|         return virt$set_mmap_name(arg1); |         return virt$set_mmap_name(arg1); | ||||||
|     case SC_set_process_icon: |  | ||||||
|         return virt$set_process_icon(arg1); |  | ||||||
|     case SC_exit: |     case SC_exit: | ||||||
|         virt$exit((int)arg1); |         virt$exit((int)arg1); | ||||||
|         return 0; |         return 0; | ||||||
|  | @ -744,11 +742,6 @@ int Emulator::virt$kill(pid_t pid, int signal) | ||||||
|     return syscall(SC_kill, pid, 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) | int Emulator::virt$gettimeofday(FlatPtr timeval) | ||||||
| { | { | ||||||
|     struct timeval host_timeval; |     struct timeval host_timeval; | ||||||
|  |  | ||||||
|  | @ -126,7 +126,6 @@ private: | ||||||
|     int virt$unlink(FlatPtr path, size_t path_length); |     int virt$unlink(FlatPtr path, size_t path_length); | ||||||
|     int virt$get_process_name(FlatPtr buffer, int size); |     int virt$get_process_name(FlatPtr buffer, int size); | ||||||
|     int virt$set_mmap_name(FlatPtr); |     int virt$set_mmap_name(FlatPtr); | ||||||
|     int virt$set_process_icon(int); |  | ||||||
|     int virt$gettimeofday(FlatPtr); |     int virt$gettimeofday(FlatPtr); | ||||||
|     int virt$clock_gettime(int, FlatPtr); |     int virt$clock_gettime(int, FlatPtr); | ||||||
|     int virt$clock_nanosleep(FlatPtr); |     int virt$clock_nanosleep(FlatPtr); | ||||||
|  |  | ||||||
|  | @ -157,7 +157,6 @@ namespace Kernel { | ||||||
|     S(dbgputstr)              \ |     S(dbgputstr)              \ | ||||||
|     S(watch_file)             \ |     S(watch_file)             \ | ||||||
|     S(shbuf_allow_all)        \ |     S(shbuf_allow_all)        \ | ||||||
|     S(set_process_icon)       \ |  | ||||||
|     S(mprotect)               \ |     S(mprotect)               \ | ||||||
|     S(realpath)               \ |     S(realpath)               \ | ||||||
|     S(get_process_name)       \ |     S(get_process_name)       \ | ||||||
|  |  | ||||||
|  | @ -881,7 +881,6 @@ static OwnPtr<KBuffer> procfs$all(InodeIdentifier) | ||||||
|         process_object.add("amount_shared", process.amount_shared()); |         process_object.add("amount_shared", process.amount_shared()); | ||||||
|         process_object.add("amount_purgeable_volatile", process.amount_purgeable_volatile()); |         process_object.add("amount_purgeable_volatile", process.amount_purgeable_volatile()); | ||||||
|         process_object.add("amount_purgeable_nonvolatile", process.amount_purgeable_nonvolatile()); |         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()); |         process_object.add("dumpable", process.is_dumpable()); | ||||||
|         auto thread_array = process_object.add_array("threads"); |         auto thread_array = process_object.add_array("threads"); | ||||||
|         process.for_each_thread([&](const Thread& thread) { |         process.for_each_thread([&](const Thread& thread) { | ||||||
|  |  | ||||||
|  | @ -340,7 +340,6 @@ public: | ||||||
|     int sys$shbuf_set_volatile(int shbuf_id, bool); |     int sys$shbuf_set_volatile(int shbuf_id, bool); | ||||||
|     int sys$halt(); |     int sys$halt(); | ||||||
|     int sys$reboot(); |     int sys$reboot(); | ||||||
|     int sys$set_process_icon(int icon_id); |  | ||||||
|     int sys$realpath(Userspace<const Syscall::SC_realpath_params*>); |     int sys$realpath(Userspace<const Syscall::SC_realpath_params*>); | ||||||
|     ssize_t sys$getrandom(Userspace<void*>, size_t, unsigned int); |     ssize_t sys$getrandom(Userspace<void*>, size_t, unsigned int); | ||||||
|     int sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>); |     int sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>); | ||||||
|  | @ -457,11 +456,6 @@ public: | ||||||
|         return m_big_lock; |         return m_big_lock; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     int icon_id() const |  | ||||||
|     { |  | ||||||
|         return m_icon_id; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     u32 priority_boost() const |     u32 priority_boost() const | ||||||
|     { |     { | ||||||
|         return m_priority_boost; |         return m_priority_boost; | ||||||
|  | @ -630,8 +624,6 @@ private: | ||||||
| 
 | 
 | ||||||
|     RefPtr<Timer> m_alarm_timer; |     RefPtr<Timer> m_alarm_timer; | ||||||
| 
 | 
 | ||||||
|     int m_icon_id { -1 }; |  | ||||||
| 
 |  | ||||||
|     u32 m_priority_boost { 0 }; |     u32 m_priority_boost { 0 }; | ||||||
| 
 | 
 | ||||||
|     u32 m_promises { 0 }; |     u32 m_promises { 0 }; | ||||||
|  |  | ||||||
|  | @ -41,20 +41,6 @@ pid_t Process::sys$getppid() | ||||||
|     return m_ppid.value(); |     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) | int Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) | ||||||
| { | { | ||||||
|     REQUIRE_PROMISE(stdio); |     REQUIRE_PROMISE(stdio); | ||||||
|  |  | ||||||
|  | @ -550,12 +550,6 @@ void sync() | ||||||
|     syscall(SC_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; | static String getlogin_buffer; | ||||||
| 
 | 
 | ||||||
| char* getlogin() | char* getlogin() | ||||||
|  |  | ||||||
|  | @ -61,7 +61,6 @@ int fsync(int fd); | ||||||
| void sysbeep(); | void sysbeep(); | ||||||
| int gettid(); | int gettid(); | ||||||
| int donate(int tid); | int donate(int tid); | ||||||
| int set_process_icon(int icon_id); |  | ||||||
| int getpagesize(); | int getpagesize(); | ||||||
| pid_t fork(); | pid_t fork(); | ||||||
| int execv(const char* path, char* const argv[]); | int execv(const char* path, char* const argv[]); | ||||||
|  |  | ||||||
|  | @ -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_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_volatile = process_object.get("amount_purgeable_volatile").to_u32(); | ||||||
|         process.amount_purgeable_nonvolatile = process_object.get("amount_purgeable_nonvolatile").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(); |         auto& thread_array = process_object.get_ptr("threads")->as_array(); | ||||||
|         process.threads.ensure_capacity(thread_array.size()); |         process.threads.ensure_capacity(thread_array.size()); | ||||||
|  |  | ||||||
|  | @ -77,7 +77,6 @@ struct ProcessStatistics { | ||||||
|     size_t amount_clean_inode; |     size_t amount_clean_inode; | ||||||
|     size_t amount_purgeable_volatile; |     size_t amount_purgeable_volatile; | ||||||
|     size_t amount_purgeable_nonvolatile; |     size_t amount_purgeable_nonvolatile; | ||||||
|     int icon_id; |  | ||||||
| 
 | 
 | ||||||
|     Vector<Core::ThreadStatistics> threads; |     Vector<Core::ThreadStatistics> threads; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -721,10 +721,6 @@ void Window::apply_icon() | ||||||
|     rc = shbuf_allow_all(m_icon->shbuf_id()); |     rc = shbuf_allow_all(m_icon->shbuf_id()); | ||||||
|     ASSERT(rc == 0); |     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())); |     WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->to_shareable_bitmap(WindowServerConnection::the().server_pid())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -58,7 +58,6 @@ struct ThreadData { | ||||||
|     unsigned inode_faults; |     unsigned inode_faults; | ||||||
|     unsigned zero_faults; |     unsigned zero_faults; | ||||||
|     unsigned cow_faults; |     unsigned cow_faults; | ||||||
|     int icon_id; |  | ||||||
|     unsigned times_scheduled; |     unsigned times_scheduled; | ||||||
| 
 | 
 | ||||||
|     unsigned times_scheduled_since_prev { 0 }; |     unsigned times_scheduled_since_prev { 0 }; | ||||||
|  | @ -120,7 +119,6 @@ static Snapshot get_snapshot() | ||||||
|             thread_data.inode_faults = thread.inode_faults; |             thread_data.inode_faults = thread.inode_faults; | ||||||
|             thread_data.zero_faults = thread.zero_faults; |             thread_data.zero_faults = thread.zero_faults; | ||||||
|             thread_data.cow_faults = thread.cow_faults; |             thread_data.cow_faults = thread.cow_faults; | ||||||
|             thread_data.icon_id = stats.icon_id; |  | ||||||
|             thread_data.times_scheduled = thread.times_scheduled; |             thread_data.times_scheduled = thread.times_scheduled; | ||||||
|             thread_data.priority = thread.priority; |             thread_data.priority = thread.priority; | ||||||
|             thread_data.state = thread.state; |             thread_data.state = thread.state; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling