/*
* Start tracing for all trace of the session.
*/
-int lttng_start_tracing(struct lttng_handle *handle)
+int lttng_start_tracing(const char *session_name)
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (session_name == NULL) {
return -1;
}
lsm.cmd_type = LTTNG_START_TRACE;
- copy_string(lsm.session.name, handle->session_name,
- sizeof(lsm.session.name));
+
+ copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
return ask_sessiond(&lsm, NULL);
}
/*
* Stop tracing for all trace of the session.
*/
-int lttng_stop_tracing(struct lttng_handle *handle)
+int lttng_stop_tracing(const char *session_name)
{
struct lttcomm_session_msg lsm;
+ if (session_name == NULL) {
+ return -1;
+ }
+
lsm.cmd_type = LTTNG_STOP_TRACE;
- copy_string(lsm.session.name, handle->session_name,
- sizeof(lsm.session.name));
+
+ copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
return ask_sessiond(&lsm, NULL);
}
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /* Safety check. Both are mandatory */
+ if (handle == NULL || ctx == NULL) {
return -1;
}
copy_lttng_domain(&lsm.domain, &handle->domain);
- if (ctx) {
- memcpy(&lsm.u.context.ctx, ctx, sizeof(struct lttng_event_context));
- }
+ memcpy(&lsm.u.context.ctx, ctx, sizeof(struct lttng_event_context));
copy_string(lsm.session.name, handle->session_name,
sizeof(lsm.session.name));
{
struct lttcomm_session_msg lsm;
- if (!handle || ev == NULL) {
+ if (handle == NULL || ev == NULL) {
return -1;
}
+ /* If no channel name, we put the default name */
if (channel_name == NULL) {
copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME,
sizeof(lsm.u.enable.channel_name));
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (handle == NULL) {
return -1;
}
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /*
+ * NULL arguments are forbidden. No default values.
+ */
+ if (handle == NULL || chan == NULL) {
return -1;
}
- if (chan) {
- memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan));
- }
+ memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan));
lsm.cmd_type = LTTNG_ENABLE_CHANNEL;
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /* Safety check. Both are mandatory */
+ if (handle == NULL || name == NULL) {
return -1;
}
- if (name) {
- copy_string(lsm.u.disable.channel_name, name,
- sizeof(lsm.u.disable.channel_name));
- }
-
lsm.cmd_type = LTTNG_DISABLE_CHANNEL;
+ copy_string(lsm.u.disable.channel_name, name,
+ sizeof(lsm.u.disable.channel_name));
+
copy_lttng_domain(&lsm.domain, &handle->domain);
copy_string(lsm.session.name, handle->session_name,
int ret;
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (handle == NULL) {
return -1;
}
/*
* Destroy session using name.
*/
-int lttng_destroy_session(struct lttng_handle *handle)
+int lttng_destroy_session(const char *session_name)
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (session_name == NULL) {
return -1;
}
lsm.cmd_type = LTTNG_DESTROY_SESSION;
- copy_string(lsm.session.name, handle->session_name,
- sizeof(lsm.session.name));
+
+ copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
return ask_sessiond(&lsm, NULL);
}
/*
* List domain of a session.
*/
-int lttng_list_domains(struct lttng_handle *handle,
+int lttng_list_domains(const char *session_name,
struct lttng_domain **domains)
{
int ret;
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (session_name == NULL) {
return -1;
}
lsm.cmd_type = LTTNG_LIST_DOMAINS;
- copy_string(lsm.session.name, handle->session_name,
- sizeof(lsm.session.name));
+ copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
ret = ask_sessiond(&lsm, (void**) domains);
if (ret < 0) {
int ret;
struct lttcomm_session_msg lsm;
- if (!handle) {
+ if (handle == NULL) {
return -1;
}
int ret;
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /* Safety check. An handle and channel name are mandatory */
+ if (handle == NULL || channel_name == NULL) {
return -1;
}
*/
int lttng_set_tracing_group(const char *name)
{
+ if (name == NULL) {
+ return -1;
+ }
+
if (asprintf(&tracing_group, "%s", name) < 0) {
return -ENOMEM;
}
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /* Safety check. NULL pointer are forbidden */
+ if (handle == NULL || calibrate == NULL) {
return -1;
}