uprobe: Receive file descriptor from session instead of path to file
[lttng-modules.git] / lttng-events.c
index 48e1760174569e449a330c766a7c3fca3ecba206..67ed16972a10fbdfe949f4abf8e57bf4a2be0bbd 100644 (file)
@@ -395,6 +395,7 @@ int lttng_event_enable(struct lttng_event *event)
                break;
        case LTTNG_KERNEL_KPROBE:
        case LTTNG_KERNEL_FUNCTION:
+       case LTTNG_KERNEL_UPROBE:
        case LTTNG_KERNEL_NOOP:
                WRITE_ONCE(event->enabled, 1);
                break;
@@ -430,6 +431,7 @@ int lttng_event_disable(struct lttng_event *event)
                break;
        case LTTNG_KERNEL_KPROBE:
        case LTTNG_KERNEL_FUNCTION:
+       case LTTNG_KERNEL_UPROBE:
        case LTTNG_KERNEL_NOOP:
                WRITE_ONCE(event->enabled, 0);
                break;
@@ -576,6 +578,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                event_name = event_desc->name;
                break;
        case LTTNG_KERNEL_KPROBE:
+       case LTTNG_KERNEL_UPROBE:
        case LTTNG_KERNEL_KRETPROBE:
        case LTTNG_KERNEL_FUNCTION:
        case LTTNG_KERNEL_NOOP:
@@ -739,6 +742,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                        goto register_error;
                }
                break;
+       case LTTNG_KERNEL_UPROBE:
+               /*
+                * Needs to be explicitly enabled after creation, since
+                * we may want to apply filters.
+                */
+               event->enabled = 0;
+               event->registered = 1;
+               /*
+                * Populate lttng_event structure before event
+                * registration.
+                */
+               smp_wmb();
+
+               ret = lttng_uprobes_register(event_param->name,
+                               event_param->u.uprobe.fd,
+                               event_param->u.uprobe.offset,
+                               event);
+               if (ret)
+                       goto register_error;
+               ret = try_module_get(event->desc->owner);
+               WARN_ON_ONCE(!ret);
+               break;
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -801,6 +826,7 @@ void register_event(struct lttng_event *event)
                        desc->name);
                break;
        case LTTNG_KERNEL_KPROBE:
+       case LTTNG_KERNEL_UPROBE:
        case LTTNG_KERNEL_KRETPROBE:
        case LTTNG_KERNEL_FUNCTION:
        case LTTNG_KERNEL_NOOP:
@@ -850,6 +876,10 @@ int _lttng_event_unregister(struct lttng_event *event)
        case LTTNG_KERNEL_NOOP:
                ret = 0;
                break;
+       case LTTNG_KERNEL_UPROBE:
+               lttng_uprobes_unregister(event);
+               ret = 0;
+               break;
        default:
                WARN_ON_ONCE(1);
        }
@@ -883,6 +913,10 @@ void _lttng_event_destroy(struct lttng_event *event)
        case LTTNG_KERNEL_NOOP:
        case LTTNG_KERNEL_SYSCALL:
                break;
+       case LTTNG_KERNEL_UPROBE:
+               module_put(event->desc->owner);
+               lttng_uprobes_destroy_private(event);
+               break;
        default:
                WARN_ON_ONCE(1);
        }
This page took 0.024215 seconds and 4 git commands to generate.