projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: rename session list count to "next_uuid"
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
kernel.c
diff --git
a/src/bin/lttng-sessiond/kernel.c
b/src/bin/lttng-sessiond/kernel.c
index dd815c44536fd8629d01537d6a6d749f70033147..484ea304e7398057da92ea872a814a0326d1f5b8 100644
(file)
--- a/
src/bin/lttng-sessiond/kernel.c
+++ b/
src/bin/lttng-sessiond/kernel.c
@@
-169,8
+169,7
@@
int kernel_create_channel(struct ltt_kernel_session *session,
cds_list_add(&lkc->list, &session->channel_list.head);
session->channel_count++;
cds_list_add(&lkc->list, &session->channel_list.head);
session->channel_count++;
- DBG("Kernel channel %s created (fd: %d and path: %s)",
- lkc->channel->name, lkc->fd, lkc->pathname);
+ DBG("Kernel channel %s created (fd: %d)", lkc->channel->name, lkc->fd);
return 0;
return 0;
@@
-196,7
+195,13
@@
int kernel_create_event(struct lttng_event *ev,
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
- if (errno != EEXIST) {
+ switch (errno) {
+ case EEXIST:
+ break;
+ case ENOSYS:
+ WARN("Event type not implemented");
+ break;
+ default:
PERROR("create event ioctl");
}
ret = -errno;
PERROR("create event ioctl");
}
ret = -errno;
@@
-371,7
+376,7
@@
int kernel_open_metadata(struct ltt_kernel_session *session, char *path)
session->metadata = lkm;
session->metadata = lkm;
- DBG("Kernel metadata opened (fd: %d
and path: %s)", lkm->fd, lkm->pathname
);
+ DBG("Kernel metadata opened (fd: %d
)", lkm->fd
);
return 0;
return 0;
@@
-442,7
+447,7
@@
int kernel_metadata_flush_buffer(int fd)
ret = kernctl_buffer_flush(fd);
if (ret < 0) {
ret = kernctl_buffer_flush(fd);
if (ret < 0) {
- ERR("Fail to flush metadata buffers %d (ret: %d", fd, ret);
+ ERR("Fail to flush metadata buffers %d (ret: %d
)
", fd, ret);
}
return 0;
}
return 0;
@@
-499,11
+504,11
@@
error:
*/
int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
{
*/
int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
{
- int ret;
+ int ret
, count = 0
;
struct ltt_kernel_stream *lks;
while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
struct ltt_kernel_stream *lks;
while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
- lks = trace_kernel_create_stream();
+ lks = trace_kernel_create_stream(
channel->channel->name, count
);
if (lks == NULL) {
ret = close(ret);
if (ret) {
if (lks == NULL) {
ret = close(ret);
if (ret) {
@@
-519,19
+524,15
@@
int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
PERROR("fcntl session fd");
}
PERROR("fcntl session fd");
}
- ret = asprintf(&lks->pathname, "%s/%s_%d",
- channel->pathname, channel->channel->name, channel->stream_count);
- if (ret < 0) {
- PERROR("asprintf kernel create stream");
- goto error;
- }
-
/* Add stream to channe stream list */
cds_list_add(&lks->list, &channel->stream_list.head);
channel->stream_count++;
/* Add stream to channe stream list */
cds_list_add(&lks->list, &channel->stream_list.head);
channel->stream_count++;
- DBG("Kernel stream %d created (fd: %d, state: %d, path: %s)",
- channel->stream_count, lks->fd, lks->state, lks->pathname);
+ /* Increment counter which represent CPU number. */
+ count++;
+
+ DBG("Kernel stream %s created (fd: %d, state: %d)", lks->name, lks->fd,
+ lks->state);
}
return channel->stream_count;
}
return channel->stream_count;
@@
-597,24
+598,35
@@
ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
*/
nbmem = KERNEL_EVENT_INIT_LIST_SIZE;
elist = zmalloc(sizeof(struct lttng_event) * nbmem);
*/
nbmem = KERNEL_EVENT_INIT_LIST_SIZE;
elist = zmalloc(sizeof(struct lttng_event) * nbmem);
+ if (elist == NULL) {
+ PERROR("alloc list events");
+ count = -ENOMEM;
+ goto end;
+ }
while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
if (count >= nbmem) {
while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
if (count >= nbmem) {
+ struct lttng_event *new_elist;
+
DBG("Reallocating event list from %zu to %zu bytes", nbmem,
nbmem * 2);
/* Double the size */
nbmem <<= 1;
DBG("Reallocating event list from %zu to %zu bytes", nbmem,
nbmem * 2);
/* Double the size */
nbmem <<= 1;
- elist = realloc(elist, nbmem * sizeof(struct lttng_event));
- if (elist == NULL) {
+
new_
elist = realloc(elist, nbmem * sizeof(struct lttng_event));
+ if (
new_
elist == NULL) {
PERROR("realloc list events");
PERROR("realloc list events");
+ free(event);
+ free(elist);
count = -ENOMEM;
goto end;
}
count = -ENOMEM;
goto end;
}
+ elist = new_elist;
}
strncpy(elist[count].name, event, LTTNG_SYMBOL_NAME_LEN);
elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
elist[count].enabled = -1;
count++;
}
strncpy(elist[count].name, event, LTTNG_SYMBOL_NAME_LEN);
elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
elist[count].enabled = -1;
count++;
+ free(event);
}
*events = elist;
}
*events = elist;
This page took
0.029399 seconds
and
4
git commands to generate.