CDS_INIT_LIST_HEAD(&lks->channel_list.head);
/* Set session path */
ret = asprintf(&lks->trace_path, "%s/kernel", path);
if (ret < 0) {
CDS_INIT_LIST_HEAD(&lks->channel_list.head);
/* Set session path */
ret = asprintf(&lks->trace_path, "%s/kernel", path);
if (ret < 0) {
/* Set default trace output path */
ret = asprintf(&lkc->pathname, "%s", path);
if (ret < 0) {
/* Set default trace output path */
ret = asprintf(&lkc->pathname, "%s", path);
if (ret < 0) {
lke = zmalloc(sizeof(struct ltt_kernel_event));
attr = zmalloc(sizeof(struct lttng_kernel_event));
if (lke == NULL || attr == NULL) {
lke = zmalloc(sizeof(struct ltt_kernel_event));
attr = zmalloc(sizeof(struct lttng_kernel_event));
if (lke == NULL || attr == NULL) {
attr->u.kprobe.addr = ev->attr.probe.addr;
attr->u.kprobe.offset = ev->attr.probe.offset;
strncpy(attr->u.kprobe.symbol_name,
attr->u.kprobe.addr = ev->attr.probe.addr;
attr->u.kprobe.offset = ev->attr.probe.offset;
strncpy(attr->u.kprobe.symbol_name,
- ev->attr.probe.symbol_name, LTTNG_SYM_NAME_LEN);
- attr->u.kprobe.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0';
+ ev->attr.probe.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN);
+ attr->u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
attr->u.kretprobe.offset = ev->attr.probe.offset;
attr->u.kretprobe.offset = ev->attr.probe.offset;
strncpy(attr->u.kretprobe.symbol_name,
attr->u.kretprobe.offset = ev->attr.probe.offset;
attr->u.kretprobe.offset = ev->attr.probe.offset;
strncpy(attr->u.kretprobe.symbol_name,
- ev->attr.probe.symbol_name, LTTNG_SYM_NAME_LEN);
- attr->u.kretprobe.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0';
+ ev->attr.probe.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN);
+ attr->u.kretprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
break;
case LTTNG_EVENT_FUNCTION_ENTRY:
attr->instrumentation = LTTNG_KERNEL_FUNCTION;
strncpy(attr->u.ftrace.symbol_name,
break;
case LTTNG_EVENT_FUNCTION_ENTRY:
attr->instrumentation = LTTNG_KERNEL_FUNCTION;
strncpy(attr->u.ftrace.symbol_name,
- ev->attr.ftrace.symbol_name, LTTNG_SYM_NAME_LEN);
- attr->u.ftrace.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0';
+ ev->attr.ftrace.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN);
+ attr->u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
- strncpy(attr->name, ev->name, LTTNG_SYM_NAME_LEN);
- attr->name[LTTNG_SYM_NAME_LEN - 1] = '\0';
+ strncpy(attr->name, ev->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ attr->name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
lkm = zmalloc(sizeof(struct ltt_kernel_metadata));
chan = zmalloc(sizeof(struct lttng_channel));
if (lkm == NULL || chan == NULL) {
lkm = zmalloc(sizeof(struct ltt_kernel_metadata));
chan = zmalloc(sizeof(struct lttng_channel));
if (lkm == NULL || chan == NULL) {
lkm->conf = chan;
/* Set default metadata path */
ret = asprintf(&lkm->pathname, "%s/metadata", path);
if (ret < 0) {
lkm->conf = chan;
/* Set default metadata path */
ret = asprintf(&lkm->pathname, "%s/metadata", path);
if (ret < 0) {
- DBG("[trace] Closing event fd %d", event->fd);
- /* Close kernel fd */
- close(event->fd);
+ int ret;
+
+ if (event->fd >= 0) {
+ DBG("[trace] Closing event fd %d", event->fd);
+ /* Close kernel fd */
+ ret = close(event->fd);
+ if (ret) {
+ PERROR("close");
+ }
+ } else {
+ DBG("[trace] Tearing down event (no associated fd)");
+ }
{
struct ltt_kernel_stream *stream, *stmp;
struct ltt_kernel_event *event, *etmp;
{
struct ltt_kernel_stream *stream, *stmp;
struct ltt_kernel_event *event, *etmp;
/* For each stream in the channel list */
cds_list_for_each_entry_safe(stream, stmp, &channel->stream_list.head, list) {
/* For each stream in the channel list */
cds_list_for_each_entry_safe(stream, stmp, &channel->stream_list.head, list) {
void trace_kernel_destroy_session(struct ltt_kernel_session *session)
{
struct ltt_kernel_channel *channel, *ctmp;
void trace_kernel_destroy_session(struct ltt_kernel_session *session)
{
struct ltt_kernel_channel *channel, *ctmp;