Implement --shm-path option for UST sessions (per-uid channels)
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 4a0a07b14ec1a08faba8c2b94199f2ef7a6e7f54..4332881c6eb7a41f538189a3dd3dcc41aed0ae30 100644 (file)
@@ -221,19 +221,19 @@ int lttng_check_tracing_group(void)
        /* Get number of supplementary group IDs */
        grp_list_size = getgroups(0, NULL);
        if (grp_list_size < 0) {
-               perror("getgroups");
+               PERROR("getgroups");
                goto end;
        }
 
        /* Alloc group list of the right size */
        grp_list = zmalloc(grp_list_size * sizeof(gid_t));
        if (!grp_list) {
-               perror("malloc");
+               PERROR("malloc");
                goto end;
        }
        grp_id = getgroups(grp_list_size, grp_list);
        if (grp_id < 0) {
-               perror("getgroups");
+               PERROR("getgroups");
                goto free_list;
        }
 
@@ -275,7 +275,7 @@ static int try_connect_sessiond(const char *sock_path)
 
        ret = lttcomm_close_unix_sock(ret);
        if (ret < 0) {
-               perror("lttcomm_close_unix_sock");
+               PERROR("lttcomm_close_unix_sock");
        }
 
        return 0;
@@ -858,7 +858,7 @@ static int generate_filter(char *filter_expression,
 
        /* No need to keep the memory stream. */
        if (fclose(fmem) != 0) {
-               perror("fclose");
+               PERROR("fclose");
        }
 
        *ctxp = ctx;
@@ -869,7 +869,7 @@ parse_error:
        filter_parser_ctx_free(ctx);
 filter_alloc_error:
        if (fclose(fmem) != 0) {
-               perror("fclose");
+               PERROR("fclose");
        }
 error:
        return ret;
@@ -1452,6 +1452,26 @@ int lttng_list_sessions(struct lttng_session **sessions)
        return ret / sizeof(struct lttng_session);
 }
 
+int lttng_set_session_shm_path(const char *session_name,
+               const char *shm_path)
+{
+       struct lttcomm_session_msg lsm;
+
+       if (session_name == NULL) {
+               return -LTTNG_ERR_INVALID;
+       }
+
+       memset(&lsm, 0, sizeof(lsm));
+       lsm.cmd_type = LTTNG_SET_SESSION_SHM_PATH;
+
+       lttng_ctl_copy_string(lsm.session.name, session_name,
+                       sizeof(lsm.session.name));
+       lttng_ctl_copy_string(lsm.u.set_shm_path.shm_path, shm_path,
+                       sizeof(lsm.u.set_shm_path.shm_path));
+
+       return lttng_ctl_ask_sessiond(&lsm, NULL);
+}
+
 /*
  *  Ask the session daemon for all available domains of a session.
  *  Sets the contents of the domains array.
This page took 0.026218 seconds and 5 git commands to generate.