From 11c056197614443f097aa1f86fb117123b30ba76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann?= Date: Sun, 8 May 2005 20:34:04 +0000 Subject: [PATCH] more updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sun May 8 16:31:32 2005 Søren Sandmann * TODO: more updates * sysprof.c: Try loading the module before complaining --- ChangeLog | 6 ++++++ TODO | 29 +++++++++++++++++------------ sysprof.c | 38 ++++++++++++++++++++++++++++---------- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28ccea4f..2ccad819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun May 8 16:31:32 2005 Søren Sandmann + + * TODO: more updates + + * sysprof.c: Try loading the module before complaining + Sun May 8 15:45:08 2005 Søren Sandmann * sysprof-module.c (do_generate): Restore lost wake_up(). diff --git a/TODO b/TODO index 21ebb3f5..e0ca5703 100644 --- a/TODO +++ b/TODO @@ -6,26 +6,16 @@ Before 1.0: * Interface - If the current profile has a name, display it in the title bar - - Sould just install the kernel module if it running as root, pop up - a dialog if not. Note we must be able to start without module now, - since it is useful to just load profiles from disk. - - Is there a portable way of asking for the root password? - - Install a small suid program that only inserts the module? - (instant security hole ..) - hook up menu items view/start etc (or possibly get rid of them or move them) - Consider expanding a few more levels of a new descendants tree * Build system - - Need to make "make install" work (how do you know where to install - kernel modules?) - - in /lib/modules/`uname -r`/kernel/drivers/ - - need to run depmod as root after that - - Then modprobe run as root should correctly find it. + - Find out if that PREFIX business in Makefile was really such + a great idea. - Find out what distributions it actually works on (ask for sucess/failure-stories in 0.9.x releases) - auto*? - - .desktop file Before 1.2: @@ -158,6 +148,9 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html Later: +- .desktop file + [Is this worth it? You will often want to start it as root, + and you will need to insert the module from the command line] - Applications should be able to say "start profiling", "stop profiling" so that you can limit the profiling to specific areas. @@ -252,6 +245,18 @@ Later: DONE: +- Sould just install the kernel module if it running as root, pop up + a dialog if not. Note we must be able to start without module now, + since it is useful to just load profiles from disk. + - Is there a portable way of asking for the root password? + - Install a small suid program that only inserts the module? + (instant security hole ..) +- Need to make "make install" work (how do you know where to install + kernel modules?) + - in /lib/modules/`uname -r`/kernel/drivers/ + - need to run depmod as root after that + - Then modprobe run as root should correctly find it. + - grep FIXME - give profiles on the command line diff --git a/sysprof.c b/sysprof.c index cbc2908b..dc9bdb74 100644 --- a/sysprof.c +++ b/sysprof.c @@ -430,6 +430,15 @@ sorry (GtkWidget *parent_window, gtk_widget_destroy (dialog); } + +static gboolean +load_module (void) +{ + int retval = system ("/sbin/modprobe sysprof-module"); + + return (retval == 0); +} + static void on_start_toggled (GtkWidget *widget, gpointer data) { @@ -441,19 +450,28 @@ on_start_toggled (GtkWidget *widget, gpointer data) if (app->input_fd == -1) { - int fd = open ("/proc/sysprof-trace", O_RDONLY); + int fd; + + fd = open ("/proc/sysprof-trace", O_RDONLY); if (fd < 0) { - sorry (app->main_window, - "Can't open /proc/sysprof-trace. You need to insert\n" - "the sysprof kernel module. Type\n" - "\n" - " modprobe sysprof-module\n" - "\n" - "as root."); + load_module(); - update_sensitivity (app); - return; + fd = open ("/proc/sysprof-trace", O_RDONLY); + + if (fd < 0) + { + sorry (app->main_window, + "Can't open /proc/sysprof-trace. You need to insert\n" + "the sysprof kernel module. Run\n" + "\n" + " modprobe sysprof-module\n" + "\n" + "as root."); + + update_sensitivity (app); + return; + } } app->input_fd = fd;