struct ctx_type *type;
char *ptr;
+ memset(&context, 0, sizeof(context));
+ memset(&dom, 0, sizeof(dom));
+
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
} else if (opt_userspace) {
struct lttng_domain dom;
struct lttng_calibrate calibrate;
+ memset(&dom, 0, sizeof(dom));
+ memset(&calibrate, 0, sizeof(calibrate));
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
char *channel_name;
struct lttng_domain dom;
+ memset(&dom, 0, sizeof(dom));
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
char *event_name, *channel_name = NULL;
struct lttng_domain dom;
+ memset(&dom, 0, sizeof(dom));
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
char *channel_name;
struct lttng_domain dom;
+ memset(&dom, 0, sizeof(dom));
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
struct lttng_event ev;
struct lttng_domain dom;
+ memset(&ev, 0, sizeof(ev));
+ memset(&dom, 0, sizeof(dom));
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
struct lttng_event *event_list;
pid_t cur_pid = 0;
+ memset(&domain, 0, sizeof(domain));
+
DBG("Getting UST tracing events");
domain.type = LTTNG_DOMAIN_UST;
struct lttng_handle *handle;
struct lttng_event *event_list;
+ memset(&domain, 0, sizeof(domain));
+
DBG("Getting kernel tracing events");
domain.type = LTTNG_DOMAIN_KERNEL;
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
+ memset(&domain, 0, sizeof(domain));
+
if (argc < 1) {
usage(stderr);
ret = CMD_ERROR;
memcpy(dst, src, sizeof(struct lttng_domain));
break;
default:
+ memset(dst, 0, sizeof(struct lttng_domain));
dst->type = LTTNG_DOMAIN_KERNEL;
break;
}
return -1;
}
+ memset(&lsm, 0, sizeof(lsm));
+
lsm.cmd_type = LTTNG_ADD_CONTEXT;
/* Copy channel name */
return -1;
}
+ memset(&lsm, 0, sizeof(lsm));
+
/* If no channel name, we put the default name */
if (channel_name == NULL) {
copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME,
return -1;
}
+ memset(&lsm, 0, sizeof(lsm));
+
if (channel_name) {
copy_string(lsm.u.disable.channel_name, channel_name,
sizeof(lsm.u.disable.channel_name));
return -1;
}
+ memset(&lsm, 0, sizeof(lsm));
+
memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan));
lsm.cmd_type = LTTNG_ENABLE_CHANNEL;
return -1;
}
+ memset(&lsm, 0, sizeof(lsm));
+
lsm.cmd_type = LTTNG_DISABLE_CHANNEL;
copy_string(lsm.u.disable.channel_name, name,
/*
* Set default channel attributes.
- * If either or both of the arguments are null, nothing happens.
+ * If either or both of the arguments are null, attr content is zeroe'd.
*/
void lttng_channel_set_default_attr(struct lttng_domain *domain,
struct lttng_channel_attr *attr)
{
+ memset(attr, 0, sizeof(struct lttng_channel_attr));
+
/* Safety check */
if (attr == NULL || domain == NULL) {
return;
attr->output = DEFAULT_UST_CHANNEL_OUTPUT;
break;
default:
- /* Default behavior */
- memset(attr, 0, sizeof(struct lttng_channel_attr));
+ /* Default behavior: leave set to 0. */
break;
}
}
int main(int argc, char **argv)
{
- struct lttng_handle *handle = NULL;
- struct lttng_domain dom;
+ struct lttng_handle *handle = NULL;
+ struct lttng_domain dom;
struct lttng_event event;
- char *channel_name = "channel0";
+ char *channel_name = "channel0";
char *session_name = "kernel_all_events_basic";
- int ret = 0;
+ int ret = 0;
- dom.type = LTTNG_DOMAIN_KERNEL;
-
- memset(&event, 0, sizeof(struct lttng_event));
+ memset(&dom, 0, sizeof(dom));
+ memset(&event, 0, sizeof(event));
+ dom.type = LTTNG_DOMAIN_KERNEL;
event.type = LTTNG_EVENT_TRACEPOINT;
+ event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
printf("\nTesting tracing all kernel events:\n");
printf("-----------\n");
int main(int argc, char **argv)
{
- struct lttng_handle *handle = NULL;
- struct lttng_domain dom;
+ struct lttng_handle *handle = NULL;
+ struct lttng_domain dom;
struct lttng_channel channel;
struct lttng_event sched_switch;
struct lttng_event sched_process_exit;
struct lttng_event sched_process_free;
-
- int ret = 0;
-
char *session_name = "kernel_event_basic";
+ int ret = 0;
+
+ memset(&dom, 0, sizeof(dom));
+ memset(&channel, 0, sizeof(channel));
+ memset(&sched_switch, 0, sizeof(sched_switch));
+ memset(&sched_process_exit, 0, sizeof(sched_process_exit));
+ memset(&sched_process_free, 0, sizeof(sched_process_free));
- dom.type = LTTNG_DOMAIN_KERNEL;
+ dom.type = LTTNG_DOMAIN_KERNEL;
strcpy(channel.name, "mychan");
channel.attr.overwrite = 0;
strcpy(sched_switch.name, "sched_switch");
sched_switch.type = LTTNG_EVENT_TRACEPOINT;
+ sched_switch.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
strcpy(sched_process_exit.name, "sched_process_exit");
sched_process_exit.type = LTTNG_EVENT_TRACEPOINT;
+ sched_process_exit.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
strcpy(sched_process_free.name, "sched_process_free");
sched_process_free.type = LTTNG_EVENT_TRACEPOINT;
+ sched_process_free.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
printf("\nTesting tracing kernel events:\n");
printf("-----------\n");
int main(int argc, char **argv)
{
- struct lttng_handle *handle = NULL;
- struct lttng_domain dom;
+ struct lttng_handle *handle = NULL;
+ struct lttng_domain dom;
struct lttng_event event;
- char *channel_name = "channel0";
+ char *channel_name = "channel0";
char *session_name = "ust_global_all_events_basic";
- int ret = 0;
+ int ret = 0;
- dom.type = LTTNG_DOMAIN_UST;
-
- memset(&event, 0, sizeof(struct lttng_event));
+ memset(&dom, 0, sizeof(dom));
+ memset(&event, 0, sizeof(event));
+ dom.type = LTTNG_DOMAIN_UST;
event.type = LTTNG_EVENT_TRACEPOINT;
event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
int main(int argc, char **argv)
{
- struct lttng_handle *handle = NULL;
- struct lttng_domain dom;
+ struct lttng_handle *handle = NULL;
+ struct lttng_domain dom;
struct lttng_channel channel;
struct lttng_event ev1, ev2, ev3;
-
- int ret = 0;
-
char *session_name = "ust_global_event_basic";
+ int ret = 0;
- dom.type = LTTNG_DOMAIN_UST;
+ memset(&dom, 0, sizeof(dom));
+ memset(&channel, 0, sizeof(channel));
+ memset(&ev1, 0, sizeof(ev1));
+ memset(&ev2, 0, sizeof(ev2));
+ memset(&ev3, 0, sizeof(ev3));
+ dom.type = LTTNG_DOMAIN_UST;
strcpy(channel.name, "mychan");
channel.attr.overwrite = 0;
channel.attr.subbuf_size = 4096;
struct ltt_kernel_channel *chan;
struct lttng_channel attr;
+ memset(&attr, 0, sizeof(attr));
+
printf("Creating kernel channel: ");
chan = trace_kernel_create_channel(&attr, PATH1);
assert(chan != NULL);
struct ltt_kernel_event *event;
struct lttng_event ev;
+ memset(&ev, 0, sizeof(ev));
strncpy(ev.name, get_random_string(), LTTNG_KERNEL_SYM_NAME_LEN);
ev.type = LTTNG_EVENT_TRACEPOINT;
+ ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
printf("Creating kernel event: ");
event = trace_kernel_create_event(&ev);
struct ltt_ust_channel *uchan;
struct lttng_channel attr;
+ memset(&attr, 0, sizeof(attr));
+
strncpy(attr.name, "channel0", 8);
printf("Creating UST channel: ");
struct ltt_ust_event *event;
struct lttng_event ev;
+ memset(&ev, 0, sizeof(ev));
strncpy(ev.name, get_random_string(), LTTNG_SYMBOL_NAME_LEN);
ev.type = LTTNG_EVENT_TRACEPOINT;
+ ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
printf("Creating UST event: ");
event = trace_ust_create_event(&ev);