diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 12 | ||||
-rw-r--r-- | tools/msm_execute_helper.c | 17 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..204a42b --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,12 @@ +pkglibexec_PROGRAMS = msm-renice msm-kill + +AM_CPPFLAGS = $(TOOLS_CFLAGS) + +msm_renice_SOURCES = msm_execute_helper.c +msm_renice_LDADD = $(TOOLS_LIBS) +msm_renice_CFLAGS = -DCOMMAND=\"renice\" + +msm_kill_SOURCES = msm_execute_helper.c +msm_kill_LDADD = $(TOOLS_LIBS) +msm_kill_CFLAGS = -DCOMMAND=\"kill\" + diff --git a/tools/msm_execute_helper.c b/tools/msm_execute_helper.c new file mode 100644 index 0000000..eff687a --- /dev/null +++ b/tools/msm_execute_helper.c @@ -0,0 +1,17 @@ +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <glib.h> + +int main(int argc, char* argv[]) +{ + gchar **argv_modified = g_new0 (gchar *, argc + 1); + memcpy (argv_modified, argv, argc * sizeof (char*)); + argv_modified[0] = COMMAND; + + if (execvp (COMMAND, argv_modified) == -1) { + return errno; + } + + return 0; +} |