Commit b779fd09 authored by Petr Štětka's avatar Petr Štětka
Browse files

Type uint with PID changed to pid_t.

parent 883c7be3
No preview for this file type
......@@ -73,15 +73,15 @@ translate: c src/better-box.c
*translate: vala src/disk-sub-view.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/system-monitor.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/window.vala
*translate: vala src/process-list-box.vala
*translate: vala src/memory-graph.vala
*translate: vala src/sub-process-sub-row.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/process-row.vala
*translate: vala src/settings.vala
*translate: vala src/storage-view.vala
*translate: vala src/process-row.vala
*translate: vala src/system-monitor.vala
*translate: vala src/process-dialog.vala
*translate: vala src/power-view.vala
*translate: vala src/data-view.vala
......
using Posix;
namespace Usage
{
public class ProcessDialog : Gtk.Dialog
{
private Gtk.Widget kill_button;
private uint pid;
private pid_t pid;
public ProcessDialog(uint pid)
public ProcessDialog(pid_t pid)
{
Object(use_header_bar: 1);
this.pid = pid;
......@@ -43,9 +45,9 @@ namespace Usage
}
}
private void kill_process(uint pid)
private void kill_process(pid_t pid)
{
Posix.kill ((Posix.pid_t) pid, Posix.SIGKILL);
Posix.kill (pid, Posix.SIGKILL);
}
}
}
\ No newline at end of file
using Posix;
namespace Usage
{
public class ProcessRow : Gtk.Box
......@@ -9,7 +11,7 @@ namespace Usage
Gtk.EventBox event_box;
SubProcessListBox sub_process_list_box;
bool in_box = false;
uint pid; //TODO pid should be type of pid_t no uint.
pid_t pid; //TODO pid should be type of pid_t no uint.
int value;
string name;
bool alive = true;
......@@ -19,7 +21,7 @@ namespace Usage
public bool showing_details { get; private set; }
public bool max_usage { get; private set; }
public ProcessRow(uint pid, int value, string name)
public ProcessRow(pid_t pid, int value, string name)
{
this.pid = pid;
this.name = name;
......@@ -105,12 +107,12 @@ namespace Usage
update();
}
public bool is_in_subrows(uint pid)
public bool is_in_subrows(pid_t pid)
{
return sub_process_list_box.is_in_table(pid);
}
public void add_sub_row(uint pid, int value, string name)
public void add_sub_row(pid_t pid, int value, string name)
{
alive = true;
if(sub_process_list_box.get_sub_rows_count() == 0)
......@@ -122,7 +124,7 @@ namespace Usage
sub_process_list_box.add_sub_row(pid, value, name);
}
public void update_sub_row(uint pid, int value)
public void update_sub_row(pid_t pid, int value)
{
alive = true;
sub_process_list_box.update_sub_row(pid, value);
......@@ -148,7 +150,7 @@ namespace Usage
return value;
}
public void set_value(uint pid, int value)
public void set_value(pid_t pid, int value)
{
alive = true;
if(sub_process_list_box.is_in_table(pid))
......
using Gee;
using Posix;
namespace Usage
{
public class SubProcessListBox : Gtk.Box
{
HashTable<int?, SubProcessSubRow> process_sub_rows_table;
HashTable<pid_t?, SubProcessSubRow> process_sub_rows_table;
public SubProcessListBox()
{
orientation = Gtk.Orientation.VERTICAL;
process_sub_rows_table = new HashTable<int?, SubProcessSubRow>(int_hash, int_equal);
process_sub_rows_table = new HashTable<pid_t?, SubProcessSubRow>(int_hash, int_equal);
}
public string get_first_name()
......@@ -17,7 +18,7 @@ namespace Usage
return process_sub_rows_table.get_values().nth_data(0).get_name();
}
public uint get_first_pid()
public pid_t get_first_pid()
{
return process_sub_rows_table.get_values().nth_data(0).get_pid();
}
......@@ -32,7 +33,7 @@ namespace Usage
return process_sub_rows_table.length;
}
public bool is_in_table(uint pid)
public bool is_in_table(pid_t pid)
{
return ((int) pid in process_sub_rows_table);
}
......@@ -63,13 +64,13 @@ namespace Usage
this.add(sub_row);
}
public void add_sub_row(uint pid, int value, string name)
public void add_sub_row(pid_t pid, int value, string name)
{
SubProcessSubRow sub_row = new SubProcessSubRow((int) pid, value, name);
process_sub_rows_table.insert ((int) pid, (owned) sub_row);
}
public void update_sub_row(uint pid, int value)
public void update_sub_row(pid_t pid, int value)
{
unowned SubProcessSubRow sub_row = process_sub_rows_table[(int) pid];
sub_row.set_value(value);
......
using Posix;
namespace Usage
{
public class SubProcessSubRow : Gtk.Box
......@@ -7,7 +9,7 @@ namespace Usage
Gtk.Label load_label;
Gtk.EventBox event_box;
bool in_box = false;
uint pid;
pid_t pid;
int value;
string name;
bool alive = true;
......@@ -15,7 +17,7 @@ namespace Usage
//public bool is_headline { get; private set; }
public bool max_usage { get; private set; }
public SubProcessSubRow(uint pid, int value, string name)
public SubProcessSubRow(pid_t pid, int value, string name)
{
this.name = name;
this.pid = pid;
......@@ -69,7 +71,7 @@ namespace Usage
return name;
}
public uint get_pid()
public pid_t get_pid()
{
return pid;
}
......
......@@ -5,7 +5,7 @@ namespace Usage
[Compact]
public class Process
{
internal uint pid;
internal pid_t pid;
internal string cmdline;
internal double cpu_load;
internal uint64 cpu_last_used;
......@@ -37,7 +37,7 @@ namespace Usage
bool change_timeout = false;
HashTable<uint, Process> process_table;
HashTable<pid_t?, Process> process_table;
private int process_mode = GTop.KERN_PROC_ALL;
......@@ -247,7 +247,7 @@ namespace Usage
x_cpu_last_used_graph = new uint64[get_num_processors()];
x_cpu_last_total = new uint64[get_num_processors()];
x_cpu_last_total_graph = new uint64[get_num_processors()];
process_table = new HashTable<uint, Process>(direct_hash, direct_equal);
process_table = new HashTable<pid_t?, Process>(int_hash, int_equal);
var settings = (GLib.Application.get_default() as Application).settings;
......
......@@ -42,7 +42,7 @@ namespace GTop {
uint64 size;
}
[CCode(array_length = false, array_null_terminated = false)]
public uint[] get_proclist(out Proclist proclist, uint64 which, uint64 arg);
public Posix.pid_t[] get_proclist(out Proclist proclist, uint64 which, uint64 arg);
[CCode(cname = "glibtop_proc_state", cheader_filename = "glibtop/procstate.h")]
public struct ProcState {
......@@ -57,7 +57,7 @@ namespace GTop {
int processor;
int last_processor;
}
public void get_proc_state(out ProcState proc_state, uint pid);
public void get_proc_state(out ProcState proc_state, Posix.pid_t pid);
[CCode(cname = "glibtop_proc_time", cheader_filename = "glibtop/proctime.h")]
public struct ProcTime {
......@@ -74,7 +74,7 @@ namespace GTop {
uint64 xcpu_utime[32];
uint64 xcpu_stime[32];
}
public void get_proc_time(out ProcTime proc_time, uint pid);
public void get_proc_time(out ProcTime proc_time, Posix.pid_t pid);
[CCode(cname = "glibtop_mem", cheader_filename = "glibtop/mem.h")]
public struct Mem {
......@@ -111,7 +111,7 @@ namespace GTop {
uint64 rss;
uint64 rss_rlim;
}
public void get_proc_mem(out ProcMem proc_mem, uint pid);
public void get_proc_mem(out ProcMem proc_mem, Posix.pid_t pid);
[CCode(cname = "glibtop_netlist", cheader_filename = "glibtop/netlist.h")]
public struct Netlist {
......@@ -144,12 +144,12 @@ namespace GTop {
int32 ngroups;
int32 groups[64];
}
public void get_proc_uid(out ProcUid proc_uid, uint pid);
public void get_proc_uid(out ProcUid proc_uid, Posix.pid_t pid);
[CCode(cname = "glibtop_proc_args", cheader_filename = "glibtop/procargs.h")]
public struct ProcArgs {
uint64 flags;
uint64 size;
}
public string[] get_proc_argv(out ProcArgs proc_args, uint pid);
public string[] get_proc_argv(out ProcArgs proc_args, Posix.pid_t pid);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment