| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <string> |
| 8 |
|
| 9 |
#include <gdkmm/texture.h> |
| 10 |
#include <glib.h> |
| 11 |
#include <gtk/gtk.h> |
| 12 |
#include <sys/types.h> |
| 13 |
|
| 14 |
#include "util.h" |
| 15 |
|
| 16 |
struct MutableProcInfo |
| 17 |
: private procman::NonCopyable |
| 18 |
{ |
| 19 |
MutableProcInfo () |
| 20 |
: vmsize (0UL), |
| 21 |
memres (0UL), |
| 22 |
memshared (0UL), |
| 23 |
memwritable (0UL), |
| 24 |
mem (0UL), |
| 25 |
start_time (0UL), |
| 26 |
cpu_time (0ULL), |
| 27 |
disk_read_bytes_total (0ULL), |
| 28 |
disk_write_bytes_total (0ULL), |
| 29 |
disk_read_bytes_current (0ULL), |
| 30 |
disk_write_bytes_current (0ULL), |
| 31 |
status (0U), |
| 32 |
pcpu (0), |
| 33 |
nice (0) |
| 34 |
{ |
| 35 |
} |
| 36 |
|
| 37 |
std::string user; |
| 38 |
|
| 39 |
std::string wchan; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
gulong vmsize; |
| 46 |
gulong memres; |
| 47 |
gulong memshared; |
| 48 |
gulong memwritable; |
| 49 |
gulong mem; |
| 50 |
|
| 51 |
gulong start_time; |
| 52 |
guint64 cpu_time; |
| 53 |
guint64 disk_read_bytes_total; |
| 54 |
guint64 disk_write_bytes_total; |
| 55 |
guint64 disk_read_bytes_current; |
| 56 |
guint64 disk_write_bytes_current; |
| 57 |
guint status; |
| 58 |
gdouble pcpu; |
| 59 |
gint nice; |
| 60 |
std::string cgroup_name; |
| 61 |
|
| 62 |
std::string unit; |
| 63 |
std::string session; |
| 64 |
std::string seat; |
| 65 |
|
| 66 |
std::string owner; |
| 67 |
}; |
| 68 |
|
| 69 |
|
| 70 |
class ProcInfo |
| 71 |
: public MutableProcInfo |
| 72 |
{ |
| 73 |
public: |
| 74 |
ProcInfo& operator= (const ProcInfo&) = delete; |
| 75 |
ProcInfo(const ProcInfo&) = delete; |
| 76 |
ProcInfo(pid_t pid); |
| 77 |
|
| 78 |
|
| 79 |
void set_icon (Glib::RefPtr<Gdk::Texture> icon); |
| 80 |
void set_user (guint uid); |
| 81 |
std::string lookup_user (guint uid); |
| 82 |
|
| 83 |
GtkTreeIter node; |
| 84 |
Glib::RefPtr<Gdk::Texture> icon; |
| 85 |
std::string tooltip; |
| 86 |
std::string name; |
| 87 |
std::string arguments; |
| 88 |
|
| 89 |
std::string security_context; |
| 90 |
|
| 91 |
const pid_t pid; |
| 92 |
pid_t ppid; |
| 93 |
guint uid; |
| 94 |
}; |
| 95 |
|
| 96 |
G_BEGIN_DECLS |
| 97 |
|
| 98 |
void gsm_proc_info_load_cgroups (ProcInfo *self); |
| 99 |
void gsm_proc_info_load_selinux (ProcInfo *self); |
| 100 |
void gsm_proc_info_load_systemd (ProcInfo *self); |
| 101 |
|
| 102 |
G_END_DECLS |