trigger: introduce firing policies
[lttng-tools.git] / include / lttng / userspace-probe.h
index 2d8c6f1257346dc22059d19441532a1ef3b8f962..5a6fa51a0318d8d1cf07e30d36692ea463bb1ab2 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef LTTNG_USERSPACE_PROBE_H
@@ -69,9 +59,17 @@ lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void);
  */
 struct lttng_userspace_probe_location;
 
+enum lttng_userspace_probe_location_status {
+       LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK        = 0,
+       /* Invalid parameters provided. */
+       LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID   = -1,
+};
+
 enum lttng_userspace_probe_location_type {
        LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN     = -1,
+       /* Function. */
        LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION    = 0,
+       /* SDT probe's callsites. */
        LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT  = 1,
 };
 
@@ -88,6 +86,13 @@ lttng_userspace_probe_location_get_type(
 extern void lttng_userspace_probe_location_destroy(
                struct lttng_userspace_probe_location *location);
 
+
+enum lttng_userspace_probe_location_function_instrumentation_type {
+       LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_UNKNOWN = -1,
+       /* Only instrument the function's entry. */
+       LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY = 0,
+};
+
 /*
  * Create a probe location of the function type.
  * Receives the target binary file path and function to instrument.
@@ -115,11 +120,32 @@ extern const char *lttng_userspace_probe_location_function_get_function_name(
 
 /*
  * Get the FD to the target binary file to the probe location of the function
- * type.
+ * type. The FD is only valid for the duration of the lifetime of `location`.
  */
 extern int lttng_userspace_probe_location_function_get_binary_fd(
                const struct lttng_userspace_probe_location *location);
 
+/*
+ * Get the instrumentation type of the function probe location.
+ */
+extern enum lttng_userspace_probe_location_function_instrumentation_type
+lttng_userspace_probe_location_function_get_instrumentation_type(
+               const struct lttng_userspace_probe_location *location);
+
+/*
+ * Get the instrumentation type of the function probe location.
+ * Defaults to
+ * LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY.
+ *
+ * Returns LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK on success,
+ * LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID if invalid parameters
+ * are provided.
+ */
+extern enum lttng_userspace_probe_location_status
+lttng_userspace_probe_location_function_set_instrumentation_type(
+               const struct lttng_userspace_probe_location *location,
+               enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type);
+
 /*
  * Get the lookup method of the given userspace probe location.
  * Returns NULL if the probe location type is unsupported.
@@ -165,7 +191,7 @@ extern const char *lttng_userspace_probe_location_tracepoint_get_provider_name(
 
 /*
  * Get the FD to the target binary file to the probe location of the tracepoint
- * type.
+ * type. The FD is only valid for the duration of the lifetime of `location`.
  */
 extern int lttng_userspace_probe_location_tracepoint_get_binary_fd(
                const struct lttng_userspace_probe_location *location);
This page took 0.025429 seconds and 4 git commands to generate.