/* 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 = malloc(grp_list_size * sizeof(gid_t));
+ 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;
}
ret = lttcomm_close_unix_sock(ret);
if (ret < 0) {
- perror("lttcomm_close_unix_sock");
+ PERROR("lttcomm_close_unix_sock");
}
return 0;
goto end;
}
- data = (void*) malloc(size);
+ data = zmalloc(size);
+ if (!data) {
+ ret = -ENOMEM;
+ goto end;
+ }
/* Get payload data */
ret = recv_data_sessiond(data, size);
goto end;
}
- handle = malloc(sizeof(struct lttng_handle));
+ handle = zmalloc(sizeof(struct lttng_handle));
if (handle == NULL) {
PERROR("malloc handle");
goto end;
/* No need to keep the memory stream. */
if (fclose(fmem) != 0) {
- perror("fclose");
+ PERROR("fclose");
}
*ctxp = ctx;
filter_parser_ctx_free(ctx);
filter_alloc_error:
if (fclose(fmem) != 0) {
- perror("fclose");
+ PERROR("fclose");
}
error:
return ret;
struct lttng_event ev;
memset(&ev, 0, sizeof(ev));
+ ev.loglevel = -1;
ev.type = LTTNG_EVENT_ALL;
lttng_ctl_copy_string(ev.name, name, sizeof(ev.name));
return lttng_disable_event_ext(handle, &ev, channel_name, NULL);
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.