Port: Add Solaris string compat
[lttng-tools.git] / src / bin / lttng / commands / enable_events.c
index d9b8591b3afbdf99a39052356359df0bffd2c18b..573725d5c1ba8d79bad1e4de43db310640b04681 100644 (file)
@@ -21,7 +21,6 @@
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -29,6 +28,7 @@
 #include <ctype.h>
 
 #include <src/common/sessiond-comm/sessiond-comm.h>
+#include <common/compat/string.h>
 
 /* Mi dependancy */
 #include <common/mi-lttng.h>
@@ -109,9 +109,9 @@ static void usage(FILE *ofp)
        fprintf(ofp, "  -s, --session NAME       Apply to session name\n");
        fprintf(ofp, "  -c, --channel NAME       Apply to this channel\n");
        fprintf(ofp, "  -a, --all                Enable all tracepoints and syscalls\n");
-       fprintf(ofp, "  -k, --kernel             Apply for the kernel tracer\n");
+       fprintf(ofp, "  -k, --kernel             Apply to the kernel tracer\n");
        fprintf(ofp, "  -u, --userspace          Apply to the user-space tracer\n");
-       fprintf(ofp, "  -j, --jul                Apply for Java application using JUL\n");
+       fprintf(ofp, "  -j, --jul                Apply to Java application using JUL\n");
        fprintf(ofp, "  -l, --log4j              Apply for Java application using LOG4j\n");
        fprintf(ofp, "  -p, --python             Apply for Python application\n");
        fprintf(ofp, "\n");
@@ -626,9 +626,9 @@ int check_exclusion_subsets(const char *event_name,
                                char **new_exclusion_list;
 
                                /* Excluder is a proper subset of event */
-                               string = strndup(next_excluder, excluder_length);
+                               string = lttng_strndup(next_excluder, excluder_length);
                                if (!string) {
-                                       PERROR("strndup error");
+                                       PERROR("lttng_strndup error");
                                        goto error;
                                }
                                new_exclusion_list = realloc(exclusion_list,
@@ -721,9 +721,8 @@ static int enable_events(char *session_name)
                /* Default. */
                dom.buf_type = LTTNG_BUFFER_PER_UID;
        } else {
-               print_missing_domain();
-               ret = CMD_ERROR;
-               goto error;
+               /* Checked by the caller. */
+               assert(0);
        }
 
        if (opt_exclude) {
@@ -1150,9 +1149,7 @@ static int enable_events(char *session_name)
                        strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
                        ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                } else {
-                       print_missing_domain();
-                       ret = CMD_ERROR;
-                       goto error;
+                       assert(0);
                }
 
                if (!opt_filter) {
@@ -1217,7 +1214,7 @@ static int enable_events(char *session_name)
                                         * Don't print the default channel
                                         * name for agent domains.
                                         */
-                                       MSG("%s event %s%s enabled.",
+                                       MSG("%s event %s%s enabled",
                                                get_domain_str(dom.type),
                                                event_name,
                                                exclusion_string);
@@ -1431,6 +1428,13 @@ int cmd_enable_events(int argc, const char **argv)
                }
        }
 
+       ret = print_missing_or_multiple_domains(
+               opt_kernel + opt_userspace + opt_jul + opt_log4j + opt_python);
+       if (ret) {
+               ret = CMD_ERROR;
+               goto end;
+       }
+
        /* Mi check */
        if (lttng_opt_mi) {
                writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
This page took 0.024403 seconds and 4 git commands to generate.