Add words about adding support for a new OS
Add a skel file (task-manager-skel.c) and make it possible in the build-env to build the task manager with this file (--with-skel).
This commit is contained in:
@@ -36,6 +36,9 @@ endif
|
||||
if OS_LINUX
|
||||
xfce4_taskmanager_SOURCES += task-manager-linux.c
|
||||
endif
|
||||
if OS_SKEL
|
||||
xfce4_taskmanager_SOURCES += task-manager-skel.c
|
||||
endif
|
||||
|
||||
if MAINTAINER_MODE
|
||||
BUILT_SOURCES = process-window_ui.h
|
||||
|
||||
87
src/task-manager-skel.c
Normal file
87
src/task-manager-skel.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) <YEAR> <AUTHOR> <EMAIL>
|
||||
*
|
||||
* <LICENCE, BELOW IS GPL2+ AS EXAMPLE>
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
/* Add includes for system functions needed */
|
||||
/* Example:
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "task-manager.h"
|
||||
|
||||
/* Cache some values */
|
||||
/* Example:
|
||||
static gushort _cpu_count = 0;
|
||||
*/
|
||||
|
||||
gboolean
|
||||
get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64 *memory_cache, guint64 *memory_buffers, guint64 *swap_total, guint64 *swap_free)
|
||||
{
|
||||
*memory_total = 0;
|
||||
*memory_free = 0;
|
||||
*memory_cache = 0;
|
||||
*memory_buffers = 0;
|
||||
*swap_total = 0;
|
||||
*swap_free = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system)
|
||||
{
|
||||
*cpu_user = *cpu_system = 0.0;
|
||||
*cpu_count = 0; /*_cpu_count;*/
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_task_details (guint pid, Task *task)
|
||||
{
|
||||
g_snprintf (task->name, 256, "foo");
|
||||
g_snprintf (task->cmdline, 1024, "foo -bar");
|
||||
g_snprintf (task->uid_name, 256, "baz");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
get_task_list (GArray *task_list)
|
||||
{
|
||||
guint pid;
|
||||
Task task = { 0 };
|
||||
|
||||
//while (/* read all PIDs */)
|
||||
{
|
||||
// if (/* pid is valid */)
|
||||
{
|
||||
if (get_task_details (pid, &task))
|
||||
{
|
||||
g_array_append_val (task_list, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
pid_is_sleeping (guint pid)
|
||||
{
|
||||
/* Read state of PID @pid... */
|
||||
|
||||
return FALSE; /* (state == sleeping) ? TRUE : FALSE;*/
|
||||
}
|
||||
|
||||
@@ -38,27 +38,6 @@ struct _Task
|
||||
gshort prio;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumerations of virtual values between the interface and the OS implementation.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
XTM_SIGNAL_TERMINATE = 0,
|
||||
XTM_SIGNAL_STOP,
|
||||
XTM_SIGNAL_CONTINUE,
|
||||
XTM_SIGNAL_KILL,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
XTM_PRIORITY_VERY_LOW = 0,
|
||||
XTM_PRIORITY_LOW,
|
||||
XTM_PRIORITY_NORMAL,
|
||||
XTM_PRIORITY_HIGH,
|
||||
XTM_PRIORITY_VERY_HIGH,
|
||||
};
|
||||
|
||||
/**
|
||||
* OS specific implementation.
|
||||
*/
|
||||
@@ -94,6 +73,23 @@ void xtm_task_manager_update_model (XtmTaskManager *manager);
|
||||
* Helper functions.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
XTM_SIGNAL_TERMINATE = 0,
|
||||
XTM_SIGNAL_STOP,
|
||||
XTM_SIGNAL_CONTINUE,
|
||||
XTM_SIGNAL_KILL,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
XTM_PRIORITY_VERY_LOW = 0,
|
||||
XTM_PRIORITY_LOW,
|
||||
XTM_PRIORITY_NORMAL,
|
||||
XTM_PRIORITY_HIGH,
|
||||
XTM_PRIORITY_VERY_HIGH,
|
||||
};
|
||||
|
||||
void get_owner_uid (guint *owner_uid, gchar **owner_uid_name);
|
||||
gchar * get_hostname ();
|
||||
gboolean send_signal_to_pid (guint pid, gint signal);
|
||||
|
||||
Reference in New Issue
Block a user