First, when enabling syscall tracing, on success 0 is return so we don't
add this value to the event list or else we were polling on fd 0 which
is not a valid event fd. A normal kernel create event, the fd of that
event is returned from the ioctl which is not the case for syscalls.
Second, the poll size was not reset when updating the kernel poll set so
at each kernel poll update, the value was not coherent with the real
poll size and thus creating unstable behavior (unknown).
This commit MIGHT fix a blocking problem happening when using a custom
channel and enabling syscall on it. This issue was reported by Julien
Desfossez <julien.desfossez@polymtl.ca>.
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
*/
enum lttng_kernel_instrumentation {
*/
enum lttng_kernel_instrumentation {
- LTTNG_KERNEL_ALL = -1, /* Used within lttng-tools */
+ LTTNG_KERNEL_ALL = -1, /* Used within lttng-tools */
LTTNG_KERNEL_TRACEPOINT = 0,
LTTNG_KERNEL_KPROBE = 1,
LTTNG_KERNEL_FUNCTION = 2,
LTTNG_KERNEL_TRACEPOINT = 0,
LTTNG_KERNEL_KPROBE = 1,
LTTNG_KERNEL_FUNCTION = 2,
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
- perror("create event ioctl");
+ PERROR("create event ioctl");
+ /*
+ * LTTNG_KERNEL_SYSCALL event creation will return 0 on success. However
+ * this FD must not be added to the event list.
+ */
+ if (ret == 0 && event->event->instrumentation == LTTNG_KERNEL_SYSCALL) {
+ DBG2("Kernel event syscall creation success");
+ goto end;
+ }
+
event->fd = ret;
/* Prevent fd duplication after execlp() */
ret = fcntl(event->fd, F_SETFD, FD_CLOEXEC);
event->fd = ret;
/* Prevent fd duplication after execlp() */
ret = fcntl(event->fd, F_SETFD, FD_CLOEXEC);
DBG("Event %s created (fd: %d)", ev->name, event->fd);
DBG("Event %s created (fd: %d)", ev->name, event->fd);
while (1) {
if (update_poll_flag == 1) {
while (1) {
if (update_poll_flag == 1) {
+ /*
+ * Reset number of fd in the poll set. Always 2 since there is the thread
+ * quit pipe and the kernel pipe.
+ */
+ events.nb_fd = 2;
+
ret = update_kernel_poll(&events);
if (ret < 0) {
goto error;
ret = update_kernel_poll(&events);
if (ret < 0) {
goto error;
int found = 0;
struct ltt_session *iter;
int found = 0;
struct ltt_session *iter;
+ DBG2("Trying to find session by name %s", name);
+
session_lock_list();
cds_list_for_each_entry(iter, <t_session_list.head, list) {
if (strncmp(iter->name, name, NAME_MAX) == 0) {
session_lock_list();
cds_list_for_each_entry(iter, <t_session_list.head, list) {
if (strncmp(iter->name, name, NAME_MAX) == 0) {