lttng {add,list,remove}-trigger: rename user id to owner uid
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 15 Apr 2021 11:31:01 +0000 (07:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 05:12:22 +0000 (01:12 -0400)
Implement the proposal to rename the --user-id option to --owner-uid in
the add-trigger and remove-trigger commands.  Update the output of
list-triggers as well.

Change-Id: I79977a0efe80d96917fcaf55909a78c81047c388
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/add_trigger.c
src/bin/lttng/commands/list_triggers.c
src/bin/lttng/commands/remove_trigger.c
tests/regression/tools/trigger/test_list_triggers_cli
tests/regression/tools/trigger/test_remove_trigger_cli

index 9344643496c9ac044d1b5d732eaced4907ffb3b1..b1ec6dd4780b11008a9583765b7ade979207e7d0 100644 (file)
@@ -40,7 +40,7 @@ enum {
        OPT_CONDITION,
        OPT_ACTION,
        OPT_ID,
-       OPT_USER_ID,
+       OPT_OWNER_UID,
        OPT_RATE_POLICY,
 
        OPT_NAME,
@@ -2089,7 +2089,7 @@ struct argpar_opt_descr add_trigger_options[] = {
        { OPT_CONDITION, '\0', "condition", true },
        { OPT_ACTION, '\0', "action", true },
        { OPT_NAME, '\0', "name", true },
-       { OPT_USER_ID, '\0', "user-id", true },
+       { OPT_OWNER_UID, '\0', "owner-uid", true },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
@@ -2116,7 +2116,7 @@ int cmd_add_trigger(int argc, const char **argv)
        char *error = NULL;
        char *name = NULL;
        int i;
-       char *user_id = NULL;
+       char *owner_uid = NULL;
 
        lttng_dynamic_pointer_array_init(&actions, lttng_actions_destructor);
 
@@ -2222,10 +2222,10 @@ int cmd_add_trigger(int argc, const char **argv)
 
                        break;
                }
-               case OPT_USER_ID:
+               case OPT_OWNER_UID:
                {
-                       if (!assign_string(&user_id, item_opt->arg,
-                                       "--user-id")) {
+                       if (!assign_string(&owner_uid, item_opt->arg,
+                                       "--owner-uid")) {
                                goto error;
                        }
 
@@ -2284,15 +2284,15 @@ int cmd_add_trigger(int argc, const char **argv)
                }
        }
 
-       if (user_id) {
+       if (owner_uid) {
                enum lttng_trigger_status trigger_status;
                char *end;
                long long uid;
 
                errno = 0;
-               uid = strtol(user_id, &end, 10);
-               if (end == user_id || *end != '\0' || errno != 0) {
-                       ERR("Failed to parse `%s` as a user id.", user_id);
+               uid = strtol(owner_uid, &end, 10);
+               if (end == owner_uid || *end != '\0' || errno != 0) {
+                       ERR("Failed to parse `%s` as a user id.", owner_uid);
                }
 
                trigger_status = lttng_trigger_set_owner_uid(trigger, uid);
@@ -2325,6 +2325,6 @@ end:
        lttng_trigger_destroy(trigger);
        free(error);
        free(name);
-       free(user_id);
+       free(owner_uid);
        return ret;
 }
index 3b806e7ea2bd98b15ae78595c84849c4794f321d..91ff1c06850222584bcdb9b3d721bee5f7fd101d 100644 (file)
@@ -817,7 +817,7 @@ void print_one_trigger(const struct lttng_trigger *trigger)
        assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        MSG("- name: %s", name);
-       MSG("  user id: %d", trigger_uid);
+       MSG("  owner uid: %d", trigger_uid);
 
        condition = lttng_trigger_get_const_condition(trigger);
        condition_type = lttng_condition_get_type(condition);
index 1fabc70ec91e698db134f90332156339f83a4135..401b597420dcb82407a3203433a9cc8ebc49eb57 100644 (file)
@@ -19,14 +19,14 @@ static const char help_msg[] =
 enum {
        OPT_HELP,
        OPT_LIST_OPTIONS,
-       OPT_USER_ID,
+       OPT_OWNER_UID,
 };
 
 static const
 struct argpar_opt_descr remove_trigger_options[] = {
        { OPT_HELP, 'h', "help", false },
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
-       { OPT_USER_ID, '\0', "user-id", true },
+       { OPT_OWNER_UID, '\0', "owner-uid", true },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
@@ -66,7 +66,7 @@ int cmd_remove_trigger(int argc, const char **argv)
        unsigned int triggers_count;
        enum lttng_trigger_status trigger_status;
        const struct lttng_trigger *trigger_to_remove = NULL;
-       char *user_id = NULL;
+       char *owner_uid = NULL;
        long long uid;
 
        argpar_parse_ret = argpar_parse(argc - 1, argv + 1,
@@ -94,10 +94,10 @@ int cmd_remove_trigger(int argc, const char **argv)
                                        remove_trigger_options);
                                ret = 0;
                                goto end;
-                       case OPT_USER_ID:
+                       case OPT_OWNER_UID:
                        {
-                               if (!assign_string(&user_id, item_opt->arg,
-                                               "--user-id")) {
+                               if (!assign_string(&owner_uid, item_opt->arg,
+                                               "--owner-uid")) {
                                        goto error;
                                }
                                break;
@@ -123,13 +123,13 @@ int cmd_remove_trigger(int argc, const char **argv)
                goto error;
        }
 
-       if (user_id) {
+       if (owner_uid) {
                char *end;
 
                errno = 0;
-               uid = strtol(user_id, &end, 10);
-               if (end == user_id || *end != '\0' || errno != 0) {
-                       ERR("Failed to parse `%s` as an integer.", user_id);
+               uid = strtol(owner_uid, &end, 10);
+               if (end == owner_uid || *end != '\0' || errno != 0) {
+                       ERR("Failed to parse `%s` as an integer.", owner_uid);
                }
        } else {
                uid = geteuid();
@@ -185,7 +185,7 @@ error:
 end:
        argpar_parse_ret_fini(&argpar_parse_ret);
        lttng_triggers_destroy(triggers);
-       free(user_id);
+       free(owner_uid);
 
        return ret;
 }
index f5d34f967b142817d2d4e0ce2c160c1b68a47aca..31ba7b366c114d4dd2c1febbf9da555233342302 100755 (executable)
@@ -73,7 +73,7 @@ test_top_level_options ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: hello
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: test-name (type: tracepoint, domain: ust)
          actions:
@@ -104,7 +104,7 @@ test_on_event_tracepoint ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: A
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
          actions:
@@ -112,7 +112,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: B
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
          actions:
@@ -120,7 +120,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: C
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: * (type: tracepoint, domain: ust)
          actions:
@@ -128,7 +128,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: D
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
          actions:
@@ -136,7 +136,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: E
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
          actions:
@@ -144,7 +144,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: F
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: capture-payload-field (type: tracepoint, domain: ust)
            captures:
@@ -154,7 +154,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: G
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: capture-array (type: tracepoint, domain: ust)
            captures:
@@ -165,7 +165,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: H
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: capture-chan-ctx (type: tracepoint, domain: ust)
            captures:
@@ -175,7 +175,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: I
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: capture-app-ctx (type: tracepoint, domain: ust)
            captures:
@@ -185,7 +185,7 @@ test_on_event_tracepoint ()
              errors: none
          errors: none
        - name: J
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: lemming (type: tracepoint, domain: ust)
          actions:
@@ -237,7 +237,7 @@ test_on_event_probe ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: lttng_channel_enable)
          actions:
@@ -245,7 +245,7 @@ test_on_event_probe ()
              errors: none
          errors: none
        - name: T1
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: ${base_symbol}+${offset_hex})
          actions:
@@ -253,7 +253,7 @@ test_on_event_probe ()
              errors: none
          errors: none
        - name: T2
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: 0x${channel_enable_addr})
          actions:
@@ -279,7 +279,7 @@ test_on_event_userspace_probe_elf ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: ma-probe-elf (type: userspace probe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name})
          actions:
@@ -327,7 +327,7 @@ test_on_event_syscall ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: open (type: syscall)
          actions:
@@ -335,7 +335,7 @@ test_on_event_syscall ()
              errors: none
          errors: none
        - name: T1
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: ptrace (type: syscall, filter: a > 2)
          actions:
@@ -367,7 +367,7 @@ test_snapshot_action ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -375,7 +375,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T1
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -383,7 +383,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T2
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -391,7 +391,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T3
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -399,7 +399,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T4
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -407,7 +407,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T5
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -415,7 +415,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T6
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -423,7 +423,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T7
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -431,7 +431,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T8
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -439,7 +439,7 @@ test_snapshot_action ()
              errors: none
          errors: none
        - name: T9
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -469,7 +469,7 @@ test_notify_action ()
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
@@ -477,7 +477,7 @@ test_notify_action ()
              errors: none
          errors: none
        - name: T1
-         user id: ${uid}
+         owner uid: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
          actions:
index fbfc202b6d50271eef297fe68be0aef3058af1d8..8d539d4b2670173a7df42a37df4b0e17000c6e62 100755 (executable)
@@ -73,7 +73,7 @@ lttng_add_trigger_ok "DEF" --condition event-rule-matches --domain=user --action
 
 cat > "${tmp_expected_stdout}" <<- EOF
 - name: ABC
-  user id: ${uid}
+  owner uid: ${uid}
   condition: event rule hit
     rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
   actions:
@@ -81,7 +81,7 @@ cat > "${tmp_expected_stdout}" <<- EOF
       errors: none
   errors: none
 - name: DEF
-  user id: ${uid}
+  owner uid: ${uid}
   condition: event rule hit
     rule: * (type: tracepoint, domain: ust)
   actions:
@@ -95,7 +95,7 @@ remove_trigger "ABC"
 
 cat > "${tmp_expected_stdout}" <<- EOF
 - name: DEF
-  user id: ${uid}
+  owner uid: ${uid}
   condition: event rule hit
     rule: * (type: tracepoint, domain: ust)
   actions:
This page took 0.049758 seconds and 4 git commands to generate.