Fix: tests: use SIGSTOP for crash extraction test
[lttng-tools.git] / src / bin / lttng / utils.c
index ef8d0235a019229cf0c4c1b92c33a58275f8a6de..ea9108fba5e207a0830e4468f492caea6b3ab1dc 100644 (file)
@@ -15,7 +15,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#define _GNU_SOURCE
 #define _LGPL_SOURCE
 #include <assert.h>
 #include <stdlib.h>
@@ -40,13 +39,8 @@ static const char *str_jul = "JUL";
 static const char *str_log4j = "LOG4J";
 static const char *str_python = "Python";
 
-/*
- *  get_session_name
- *
- *  Return allocated string with the session name found in the config
- *  directory.
- */
-char *get_session_name(void)
+static
+char *_get_session_name(int quiet)
 {
        char *path, *session_name = NULL;
 
@@ -57,7 +51,8 @@ char *get_session_name(void)
        }
 
        /* Get session name from config */
-       session_name = config_read_session_name(path);
+       session_name = quiet ? config_read_session_name_quiet(path) :
+               config_read_session_name(path);
        if (session_name == NULL) {
                goto error;
        }
@@ -70,6 +65,28 @@ error:
        return NULL;
 }
 
+/*
+ *  get_session_name
+ *
+ *  Return allocated string with the session name found in the config
+ *  directory.
+ */
+char *get_session_name(void)
+{
+       return _get_session_name(0);
+}
+
+/*
+ *  get_session_name_quiet (no warnings/errors emitted)
+ *
+ *  Return allocated string with the session name found in the config
+ *  directory.
+ */
+char *get_session_name_quiet(void)
+{
+       return _get_session_name(1);
+}
+
 /*
  *  list_commands
  *
@@ -383,3 +400,18 @@ error:
 error_socket:
        return ret;
 }
+
+int print_missing_or_multiple_domains(unsigned int sum)
+{
+       int ret = 0;
+
+       if (sum == 0) {
+               ERR("Please specify a domain (-k/-u/-j).");
+               ret = -1;
+       } else if (sum > 1) {
+               ERR("Multiple domains specified.");
+               ret = -1;
+       }
+
+       return ret;
+}
This page took 0.025288 seconds and 5 git commands to generate.