mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
Processes can now have an icon assigned, which is essentially a 16x16 RGBA32 bitmap exposed as a shared buffer ID. You set the icon ID by calling set_process_icon(int) and the icon ID will be exposed through /proc/all. To make this work, I added a mechanism for making shared buffers globally accessible. For safety reasons, each app seals the icon buffer before making it global. Right now the first call to GWindow::set_icon() is what determines the process icon. We'll probably change this in the future. :^)
40 lines
790 B
C++
40 lines
790 B
C++
#pragma once
|
|
|
|
#include <AK/AKString.h>
|
|
#include <AK/HashMap.h>
|
|
|
|
struct CProcessStatistics {
|
|
// Keep this in sync with /proc/all.
|
|
// From the kernel side:
|
|
pid_t pid;
|
|
unsigned times_scheduled;
|
|
unsigned pgid;
|
|
unsigned pgp;
|
|
unsigned sid;
|
|
uid_t uid;
|
|
gid_t gid;
|
|
String state;
|
|
pid_t ppid;
|
|
unsigned nfds;
|
|
String name;
|
|
String tty;
|
|
size_t amount_virtual;
|
|
size_t amount_resident;
|
|
size_t amount_shared;
|
|
unsigned ticks;
|
|
String priority;
|
|
unsigned syscall_count;
|
|
int icon_id;
|
|
|
|
// synthetic
|
|
String username;
|
|
};
|
|
|
|
class CProcessStatisticsReader {
|
|
public:
|
|
static HashMap<pid_t, CProcessStatistics> get_all();
|
|
|
|
private:
|
|
static String username_from_uid(uid_t);
|
|
static HashMap<uid_t, String> s_usernames;
|
|
};
|