Make pid type: GPid (bug 14401)
This commit is contained in:
@@ -38,12 +38,12 @@ G_DEFINE_TYPE (XtmAppManager, xtm_app_manager, G_TYPE_OBJECT)
|
||||
|
||||
static void xtm_app_manager_finalize (GObject *object);
|
||||
|
||||
static gint app_get_pid (WnckApplication *application);
|
||||
static GPid app_get_pid (WnckApplication *application);
|
||||
static gint app_pid_compare_fn (gconstpointer a, gconstpointer b);
|
||||
|
||||
static void apps_add_application (GArray *apps, WnckApplication *application, gint pid);
|
||||
static void apps_add_application (GArray *apps, WnckApplication *application, GPid pid);
|
||||
static void apps_remove_application (GArray *apps, WnckApplication *application);
|
||||
static App * apps_lookup_pid (GArray *apps, gint pid);
|
||||
static App * apps_lookup_pid (GArray *apps, GPid pid);
|
||||
static void application_opened (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager);
|
||||
static void application_closed (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager);
|
||||
|
||||
@@ -93,10 +93,10 @@ xtm_app_manager_finalize (GObject *object)
|
||||
g_array_free (XTM_APP_MANAGER (object)->apps, TRUE);
|
||||
}
|
||||
|
||||
static gint
|
||||
static GPid
|
||||
app_get_pid(WnckApplication *application)
|
||||
{
|
||||
gint pid;
|
||||
GPid pid;
|
||||
if (NULL == application)
|
||||
return (0);
|
||||
pid = wnck_application_get_pid (application);
|
||||
@@ -112,7 +112,7 @@ app_pid_compare_fn(gconstpointer a, gconstpointer b)
|
||||
}
|
||||
|
||||
static void
|
||||
apps_add_application (GArray *apps, WnckApplication *application, gint pid)
|
||||
apps_add_application (GArray *apps, WnckApplication *application, GPid pid)
|
||||
{
|
||||
App app;
|
||||
|
||||
@@ -141,7 +141,7 @@ apps_remove_application (GArray *apps, WnckApplication *application)
|
||||
}
|
||||
|
||||
static App *
|
||||
apps_lookup_pid (GArray *apps, gint pid)
|
||||
apps_lookup_pid (GArray *apps, GPid pid)
|
||||
{
|
||||
App tapp;
|
||||
|
||||
@@ -153,7 +153,7 @@ apps_lookup_pid (GArray *apps, gint pid)
|
||||
static void
|
||||
application_opened (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager)
|
||||
{
|
||||
gint pid = app_get_pid (application);
|
||||
GPid pid = app_get_pid (application);
|
||||
G_DEBUG_FMT ("Application opened %p %d", (void*)application, pid);
|
||||
apps_add_application (manager->apps, application, pid);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ xtm_app_manager_new (void)
|
||||
}
|
||||
|
||||
App *
|
||||
xtm_app_manager_get_app_from_pid (XtmAppManager *manager, gint pid)
|
||||
xtm_app_manager_get_app_from_pid (XtmAppManager *manager, GPid pid)
|
||||
{
|
||||
return apps_lookup_pid (manager->apps, pid);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct _App App;
|
||||
struct _App
|
||||
{
|
||||
WnckApplication * application;
|
||||
gint pid;
|
||||
GPid pid;
|
||||
gchar name[1024];
|
||||
GdkPixbuf * icon;
|
||||
};
|
||||
@@ -39,6 +39,6 @@ typedef struct _XtmAppManager XtmAppManager;
|
||||
|
||||
GType xtm_app_manager_get_type (void);
|
||||
XtmAppManager * xtm_app_manager_new (void);
|
||||
App * xtm_app_manager_get_app_from_pid (XtmAppManager *manager, gint pid);
|
||||
App * xtm_app_manager_get_app_from_pid (XtmAppManager *manager, GPid pid);
|
||||
|
||||
#endif /* !APP_MANAGER_H */
|
||||
|
||||
@@ -356,7 +356,7 @@ cb_send_signal (GtkMenuItem *mi, gpointer user_data)
|
||||
XtmSettings *settings;
|
||||
gboolean prompt_terminate_task;
|
||||
GtkWidget *dialog;
|
||||
guint pid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (mi), "pid"));
|
||||
GPid pid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mi), "pid"));
|
||||
gint xtm_signal = GPOINTER_TO_INT (user_data);
|
||||
|
||||
settings = xtm_settings_get_default ();
|
||||
@@ -407,7 +407,7 @@ cb_send_signal (GtkMenuItem *mi, gpointer user_data)
|
||||
static void
|
||||
cb_set_priority (GtkMenuItem *mi, gpointer user_data)
|
||||
{
|
||||
guint pid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (mi), "pid"));
|
||||
GPid pid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mi), "pid"));
|
||||
gint priority = GPOINTER_TO_INT (user_data);
|
||||
|
||||
if (!set_priority_to_pid (pid, priority))
|
||||
@@ -424,7 +424,7 @@ cb_set_priority (GtkMenuItem *mi, gpointer user_data)
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
build_context_menu (XtmProcessTreeView *treeview, guint pid)
|
||||
build_context_menu (XtmProcessTreeView *treeview, GPid pid)
|
||||
{
|
||||
GtkWidget *menu, *menu_priority, *mi;
|
||||
|
||||
@@ -433,53 +433,53 @@ build_context_menu (XtmProcessTreeView *treeview, guint pid)
|
||||
if (!pid_is_sleeping (pid))
|
||||
{
|
||||
mi = gtk_menu_item_new_with_label (_("Stop"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_send_signal), GINT_TO_POINTER (XTM_SIGNAL_STOP));
|
||||
}
|
||||
else
|
||||
{
|
||||
mi = gtk_menu_item_new_with_label (_("Continue"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_send_signal), GINT_TO_POINTER (XTM_SIGNAL_CONTINUE));
|
||||
}
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Terminate"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "treeview", treeview);
|
||||
gtk_container_add (GTK_CONTAINER (menu), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_send_signal), GINT_TO_POINTER (XTM_SIGNAL_TERMINATE));
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Kill"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_send_signal), GINT_TO_POINTER (XTM_SIGNAL_KILL));
|
||||
|
||||
menu_priority = gtk_menu_new ();
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Very low"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu_priority), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_set_priority), GINT_TO_POINTER (XTM_PRIORITY_VERY_LOW));
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Low"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu_priority), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_set_priority), GINT_TO_POINTER (XTM_PRIORITY_LOW));
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Normal"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu_priority), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_set_priority), GINT_TO_POINTER (XTM_PRIORITY_NORMAL));
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("High"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu_priority), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_set_priority), GINT_TO_POINTER (XTM_PRIORITY_HIGH));
|
||||
|
||||
mi = gtk_menu_item_new_with_label (_("Very high"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
gtk_container_add (GTK_CONTAINER (menu_priority), mi);
|
||||
g_signal_connect (mi, "activate", G_CALLBACK (cb_set_priority), GINT_TO_POINTER (XTM_PRIORITY_VERY_HIGH));
|
||||
|
||||
@@ -502,7 +502,7 @@ position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, XtmProcessTre
|
||||
}
|
||||
|
||||
static void
|
||||
popup_menu (XtmProcessTreeView *treeview, guint pid, guint activate_time, gboolean at_pointer_position)
|
||||
popup_menu (XtmProcessTreeView *treeview, GPid pid, guint activate_time, gboolean at_pointer_position)
|
||||
{
|
||||
static GtkWidget *menu = NULL;
|
||||
GtkMenuPositionFunc position_func = NULL;
|
||||
@@ -520,7 +520,7 @@ popup_menu (XtmProcessTreeView *treeview, guint pid, guint activate_time, gboole
|
||||
static gboolean
|
||||
treeview_clicked (XtmProcessTreeView *treeview, GdkEventButton *event)
|
||||
{
|
||||
guint pid;
|
||||
GPid pid;
|
||||
|
||||
if (event->button != 3)
|
||||
return FALSE;
|
||||
@@ -556,7 +556,7 @@ treeview_clicked (XtmProcessTreeView *treeview, GdkEventButton *event)
|
||||
static gboolean
|
||||
treeview_key_pressed (XtmProcessTreeView *treeview, GdkEventKey *event)
|
||||
{
|
||||
guint pid;
|
||||
GPid pid;
|
||||
|
||||
GtkTreeModel *model;
|
||||
GtkTreeSelection *selection;
|
||||
@@ -582,7 +582,7 @@ treeview_key_pressed (XtmProcessTreeView *treeview, GdkEventKey *event)
|
||||
/* Fake menuitem for the cb_send_signal callback */
|
||||
GtkWidget *mi;
|
||||
mi = gtk_menu_item_new_with_label (_("Stop"));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GUINT_TO_POINTER (pid));
|
||||
g_object_set_data (G_OBJECT (mi), "pid", GINT_TO_POINTER (pid));
|
||||
if ((event->state & modifiers) == GDK_SHIFT_MASK)
|
||||
cb_send_signal (GTK_MENU_ITEM (mi), GINT_TO_POINTER (XTM_SIGNAL_KILL));
|
||||
else
|
||||
@@ -768,13 +768,13 @@ xtm_process_tree_view_get_model (XtmProcessTreeView *treeview)
|
||||
}
|
||||
|
||||
void
|
||||
xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, guint pid) {
|
||||
xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, GPid pid) {
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
gboolean tree;
|
||||
guint pid_iter;
|
||||
GPid pid_iter;
|
||||
GtkTreeIter child_iter;
|
||||
gboolean validParent;
|
||||
|
||||
|
||||
@@ -54,6 +54,6 @@ GtkWidget * xtm_process_tree_view_new (void);
|
||||
void xtm_process_tree_view_get_sort_column_id (XtmProcessTreeView *treeview, gint *sort_column_id, GtkSortType *sort_type);
|
||||
void xtm_process_tree_view_set_filter (XtmProcessTreeView *treeview, const gchar *cmd_filter);
|
||||
GtkTreeModel * xtm_process_tree_view_get_model (XtmProcessTreeView *treeview);
|
||||
void xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, guint pid);
|
||||
void xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, GPid pid);
|
||||
|
||||
#endif /* !PROCESS_TREE_VIEW_H */
|
||||
|
||||
@@ -140,8 +140,7 @@ static void
|
||||
xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
||||
XtmProcessWindow *window = (XtmProcessWindow *) user_data;
|
||||
Window selected_window;
|
||||
Display *dpy = NULL;
|
||||
|
||||
Display *dpy;
|
||||
Atom atom_NET_WM_PID;
|
||||
unsigned long _nitems;
|
||||
Atom actual_type;
|
||||
@@ -149,8 +148,7 @@ xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
||||
unsigned char *prop;
|
||||
int status;
|
||||
unsigned long bytes_after;
|
||||
|
||||
guint pid = 0;
|
||||
GPid pid = 0;
|
||||
|
||||
dpy = XOpenDisplay (NULL);
|
||||
selected_window = Select_Window (dpy, 0);
|
||||
@@ -172,7 +170,7 @@ xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
||||
_("XGetWindowProperty failed"), _("XGetWindowProperty failed!"));
|
||||
} else {
|
||||
if (_nitems > 0) {
|
||||
pid = (guint) *((unsigned long*)prop);
|
||||
memcpy(&pid, prop, sizeof(pid));
|
||||
xtm_process_tree_view_highlight_pid(XTM_PROCESS_TREE_VIEW (window->treeview), pid);
|
||||
} else {
|
||||
XTM_SHOW_MESSAGE(GTK_MESSAGE_INFO,
|
||||
|
||||
@@ -157,7 +157,7 @@ gboolean get_task_list (GArray *task_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
pid_is_sleeping (GPid pid)
|
||||
{
|
||||
int mib[6];
|
||||
#ifdef __OpenBSD__
|
||||
|
||||
@@ -262,7 +262,7 @@ get_task_list (GArray *task_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
pid_is_sleeping (GPid pid)
|
||||
{
|
||||
kvm_t *kd;
|
||||
struct kinfo_proc *kp;
|
||||
|
||||
@@ -156,7 +156,7 @@ get_task_cmdline (Task *task)
|
||||
}
|
||||
|
||||
static void
|
||||
get_cpu_percent (guint pid, gulong jiffies_user, gfloat *cpu_user, gulong jiffies_system, gfloat *cpu_system)
|
||||
get_cpu_percent (GPid pid, gulong jiffies_user, gfloat *cpu_user, gulong jiffies_system, gfloat *cpu_system)
|
||||
{
|
||||
static GHashTable *hash_cpu_user = NULL;
|
||||
static GHashTable *hash_cpu_system = NULL;
|
||||
@@ -168,10 +168,10 @@ get_cpu_percent (guint pid, gulong jiffies_user, gfloat *cpu_user, gulong jiffie
|
||||
hash_cpu_system = g_hash_table_new (NULL, NULL);
|
||||
}
|
||||
|
||||
jiffies_user_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_user, GUINT_TO_POINTER (pid)));
|
||||
jiffies_system_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_system, GUINT_TO_POINTER (pid)));
|
||||
g_hash_table_insert (hash_cpu_user, GUINT_TO_POINTER (pid), GUINT_TO_POINTER (jiffies_user));
|
||||
g_hash_table_insert (hash_cpu_system, GUINT_TO_POINTER (pid), GUINT_TO_POINTER (jiffies_system));
|
||||
jiffies_user_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_user, GINT_TO_POINTER (pid)));
|
||||
jiffies_system_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_system, GINT_TO_POINTER (pid)));
|
||||
g_hash_table_insert (hash_cpu_user, GINT_TO_POINTER (pid), GUINT_TO_POINTER (jiffies_user));
|
||||
g_hash_table_insert (hash_cpu_system, GINT_TO_POINTER (pid), GUINT_TO_POINTER (jiffies_system));
|
||||
|
||||
if (jiffies_user < jiffies_user_old || jiffies_system < jiffies_system_old)
|
||||
return;
|
||||
@@ -188,7 +188,7 @@ get_cpu_percent (guint pid, gulong jiffies_user, gfloat *cpu_user, gulong jiffie
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_task_details (guint pid, Task *task)
|
||||
get_task_details (GPid pid, Task *task)
|
||||
{
|
||||
FILE *file;
|
||||
gchar filename[96];
|
||||
@@ -314,7 +314,7 @@ get_task_list (GArray *task_list)
|
||||
{
|
||||
GDir *dir;
|
||||
const gchar *name;
|
||||
guint pid;
|
||||
GPid pid;
|
||||
Task task;
|
||||
|
||||
if ((dir = g_dir_open ("/proc", 0, NULL)) == NULL)
|
||||
@@ -322,7 +322,7 @@ get_task_list (GArray *task_list)
|
||||
|
||||
while ((name = g_dir_read_name(dir)) != NULL)
|
||||
{
|
||||
if ((pid = (guint)g_ascii_strtoull (name, NULL, 0)) > 0)
|
||||
if ((pid = (GPid)g_ascii_strtoull (name, NULL, 0)) > 0)
|
||||
{
|
||||
if (get_task_details (pid, &task))
|
||||
{
|
||||
@@ -339,7 +339,7 @@ get_task_list (GArray *task_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
pid_is_sleeping (GPid pid)
|
||||
{
|
||||
FILE *file;
|
||||
gchar filename[96];
|
||||
|
||||
@@ -48,7 +48,7 @@ get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_task_details (guint pid, Task *task)
|
||||
get_task_details (GPid pid, Task *task)
|
||||
{
|
||||
bzero(task, sizeof(Task));
|
||||
g_snprintf (task->name, sizeof(task->name), "foo");
|
||||
@@ -61,7 +61,7 @@ get_task_details (guint pid, Task *task)
|
||||
gboolean
|
||||
get_task_list (GArray *task_list)
|
||||
{
|
||||
guint pid = 0;
|
||||
GPid pid = 0;
|
||||
Task task;
|
||||
|
||||
//while (/* read all PIDs */)
|
||||
@@ -81,7 +81,7 @@ get_task_list (GArray *task_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
pid_is_sleeping (GPid pid)
|
||||
{
|
||||
/* Read state of PID @pid... */
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64 *memory_c
|
||||
}
|
||||
|
||||
static void
|
||||
get_cpu_percent (guint pid, gulong ticks_user, gfloat *cpu_user, gulong ticks_system, gfloat *cpu_system)
|
||||
get_cpu_percent (GPid pid, gulong ticks_user, gfloat *cpu_user, gulong ticks_system, gfloat *cpu_system)
|
||||
{
|
||||
static GHashTable *hash_cpu_user = NULL;
|
||||
static GHashTable *hash_cpu_system = NULL;
|
||||
@@ -102,10 +102,10 @@ get_cpu_percent (guint pid, gulong ticks_user, gfloat *cpu_user, gulong ticks_sy
|
||||
hash_cpu_system = g_hash_table_new (NULL, NULL);
|
||||
}
|
||||
|
||||
ticks_user_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_user, GUINT_TO_POINTER (pid)));
|
||||
ticks_system_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_system, GUINT_TO_POINTER (pid)));
|
||||
g_hash_table_insert (hash_cpu_user, GUINT_TO_POINTER (pid), GUINT_TO_POINTER (ticks_user));
|
||||
g_hash_table_insert (hash_cpu_system, GUINT_TO_POINTER (pid), GUINT_TO_POINTER (ticks_system));
|
||||
ticks_user_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_user, GINT_TO_POINTER (pid)));
|
||||
ticks_system_old = GPOINTER_TO_UINT (g_hash_table_lookup (hash_cpu_system, GINT_TO_POINTER (pid)));
|
||||
g_hash_table_insert (hash_cpu_user, GINT_TO_POINTER (pid), GUINT_TO_POINTER (ticks_user));
|
||||
g_hash_table_insert (hash_cpu_system, GINT_TO_POINTER (pid), GUINT_TO_POINTER (ticks_system));
|
||||
|
||||
if (ticks_user < ticks_user_old || ticks_system < ticks_system_old)
|
||||
return;
|
||||
@@ -169,7 +169,7 @@ get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_task_details (guint pid, Task *task)
|
||||
get_task_details (GPid pid, Task *task)
|
||||
{
|
||||
FILE *file;
|
||||
gchar filename[96];
|
||||
@@ -187,8 +187,8 @@ get_task_details (guint pid, Task *task)
|
||||
}
|
||||
|
||||
bzero(task, sizeof(Task));
|
||||
task->pid = (guint)process.pr_pid;
|
||||
task->ppid = (guint)process.pr_ppid;
|
||||
task->pid = process.pr_pid;
|
||||
task->ppid = process.pr_ppid;
|
||||
g_strlcpy (task->name, process.pr_fname, sizeof(task->name));
|
||||
snprintf (task->cmdline, sizeof(task->cmdline), "%s", process.pr_psargs);
|
||||
snprintf (task->state, sizeof(task->state), "%c", process.pr_lwp.pr_sname);
|
||||
@@ -210,7 +210,7 @@ get_task_list (GArray *task_list)
|
||||
{
|
||||
GDir *dir;
|
||||
const gchar *name;
|
||||
guint pid;
|
||||
GPid pid;
|
||||
Task task;
|
||||
|
||||
if ((dir = g_dir_open ("/proc", 0, NULL)) == NULL)
|
||||
@@ -218,7 +218,7 @@ get_task_list (GArray *task_list)
|
||||
|
||||
while ((name = g_dir_read_name(dir)) != NULL)
|
||||
{
|
||||
if ((pid = (guint)g_ascii_strtoull (name, NULL, 0)) > 0)
|
||||
if ((pid = (GPid)g_ascii_strtoull (name, NULL, 0)) > 0)
|
||||
{
|
||||
if (get_task_details (pid, &task))
|
||||
g_array_append_val(task_list, task);
|
||||
@@ -233,7 +233,7 @@ get_task_list (GArray *task_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
pid_is_sleeping (GPid pid)
|
||||
{
|
||||
FILE *file;
|
||||
gchar filename[96];
|
||||
|
||||
@@ -77,7 +77,7 @@ static void model_add_task (XtmTaskManager *manager, Task *task, glong times
|
||||
static void model_update_tree_iter (XtmTaskManager *manager, GtkTreeIter *iter, glong timestamp, gboolean update_cmd_line, Task *task);
|
||||
static void model_mark_tree_iter_as_removed (GtkTreeModel *model, GtkTreeIter *iter, glong timestamp);
|
||||
static void model_remove_tree_iter (GtkTreeModel *model, GtkTreeIter *iter);
|
||||
static gboolean task_list_find_for_pid (GArray *task_list, guint pid, Task **task, guint *idx);
|
||||
static gboolean task_list_find_for_pid (GArray *task_list, GPid pid, Task **task, guint *idx);
|
||||
static glong __current_timestamp (void);
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ model_update_tree_iter (XtmTaskManager *manager, GtkTreeIter *iter, glong timest
|
||||
}
|
||||
|
||||
static gboolean
|
||||
task_list_find_for_pid (GArray *task_list, guint pid, Task **task, guint *idx)
|
||||
task_list_find_for_pid (GArray *task_list, GPid pid, Task **task, guint *idx)
|
||||
{
|
||||
Task *task_tmp, tkey;
|
||||
tkey.pid = pid;
|
||||
@@ -409,7 +409,7 @@ xtm_task_manager_update_model (XtmTaskManager *manager)
|
||||
valid = gtk_tree_model_get_iter_first (manager->model, &iter);
|
||||
while (valid)
|
||||
{
|
||||
gint pid;
|
||||
GPid pid;
|
||||
gchar *cpu_str;
|
||||
glong old_timestamp;
|
||||
gboolean found;
|
||||
@@ -525,7 +525,7 @@ get_hostname (void)
|
||||
}
|
||||
|
||||
gboolean
|
||||
send_signal_to_pid (guint pid, gint xtm_signal)
|
||||
send_signal_to_pid (GPid pid, gint xtm_signal)
|
||||
{
|
||||
gint sig;
|
||||
gint res;
|
||||
@@ -551,7 +551,7 @@ send_signal_to_pid (guint pid, gint xtm_signal)
|
||||
}
|
||||
|
||||
gboolean
|
||||
set_priority_to_pid (guint pid, gint priority)
|
||||
set_priority_to_pid (GPid pid, gint priority)
|
||||
{
|
||||
gint prio;
|
||||
gint res;
|
||||
|
||||
@@ -26,8 +26,8 @@ struct _Task
|
||||
{
|
||||
guint uid;
|
||||
gchar uid_name[256];
|
||||
guint pid;
|
||||
guint ppid;
|
||||
GPid pid;
|
||||
GPid ppid;
|
||||
gchar name[256];
|
||||
gchar cmdline[1024];
|
||||
gchar state[16];
|
||||
@@ -45,7 +45,7 @@ struct _Task
|
||||
gboolean get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64 *memory_cache, guint64 *memory_buffers, guint64 *swap_total, guint64 *swap_free);
|
||||
gboolean get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system);
|
||||
gboolean get_task_list (GArray *task_list);
|
||||
gboolean pid_is_sleeping (guint pid);
|
||||
gboolean pid_is_sleeping (GPid pid);
|
||||
|
||||
/**
|
||||
* GObject class used to update the graphical widgets.
|
||||
@@ -94,9 +94,9 @@ enum
|
||||
|
||||
void get_owner_uid (guint *owner_uid, gchar **owner_uid_name);
|
||||
gchar * get_hostname (void);
|
||||
gboolean send_signal_to_pid (guint pid, gint xtm_signal);
|
||||
gboolean send_signal_to_pid (GPid pid, gint xtm_signal);
|
||||
gint task_pid_compare_fn (gconstpointer a, gconstpointer b);
|
||||
gboolean set_priority_to_pid (guint pid, gint priority);
|
||||
gboolean set_priority_to_pid (GPid pid, gint priority);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
|
||||
Reference in New Issue
Block a user