+ /* Setup arguments to su */
+ /* child */
+ gchar args[MAX_ARGS_LEN];
+ gint args_left = MAX_ARGS_LEN - 1; /* for \0 */
+
+ args[0] = '\0';
+
+ /* Command */
+ strncat(args, "exec", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ if(strcmp(lttctl_path, "") == 0)
+ strncat(args, "lttctl", args_left);
+ else
+ strncat(args, lttctl_path, args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* name */
+ strncat(args, "-n ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+ strncat(args, trace_name, args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* Simply pause tracing */
+ strncat(args, "-q", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ int retval = execute_command(args, username, password, lttd_path, fac_path);
+ if(retval) {
+ gchar msg[256];
+ guint msg_left = 256;
+
+ strcpy(msg, "A problem occured when executing the su command : ");
+ msg_left = 256 - strlen(msg) - 1;
+ strncat(msg, strerror(retval), msg_left);
+ GtkWidget *dialogue =
+ gtk_message_dialog_new(
+ GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button))),
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ msg);
+ gtk_dialog_run(GTK_DIALOG(dialogue));
+ gtk_widget_destroy(dialogue);
+ }
+
+}
+
+void unpause_clicked (GtkButton *button, gpointer user_data)
+{
+ ControlData *tcd = (ControlData*)user_data;
+
+ const gchar *username = gtk_entry_get_text(GTK_ENTRY(tcd->username_entry));
+ const gchar *password = gtk_entry_get_text(GTK_ENTRY(tcd->password_entry));
+ const gchar *trace_name =
+ gtk_entry_get_text(GTK_ENTRY(tcd->trace_name_entry));
+ const gchar *lttd_path = "";
+ const gchar *fac_path = "";
+
+ const gchar *lttctl_path =
+ gtk_entry_get_text(GTK_ENTRY(tcd->lttctl_path_entry));
+
+ /* Setup arguments to su */
+ /* child */
+ gchar args[MAX_ARGS_LEN];
+ gint args_left = MAX_ARGS_LEN - 1; /* for \0 */
+
+ args[0] = '\0';
+
+ /* Command */
+ strncat(args, "exec", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ if(strcmp(lttctl_path, "") == 0)
+ strncat(args, "lttctl", args_left);
+ else
+ strncat(args, lttctl_path, args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* name */
+ strncat(args, "-n ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+ strncat(args, trace_name, args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* space */
+ strncat(args, " ", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ /* Simply unpause tracing */
+ strncat(args, "-s", args_left);
+ args_left = MAX_ARGS_LEN - strlen(args) - 1;
+
+ int retval = execute_command(args, username, password, lttd_path, fac_path);
+ if(retval) {
+ gchar msg[256];
+ guint msg_left = 256;
+
+ strcpy(msg, "A problem occured when executing the su command : ");
+ msg_left = 256 - strlen(msg) - 1;
+ strncat(msg, strerror(retval), msg_left);
+ GtkWidget *dialogue =
+ gtk_message_dialog_new(
+ GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button))),
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ msg);
+ gtk_dialog_run(GTK_DIALOG(dialogue));
+ gtk_widget_destroy(dialogue);
+ }
+