trackers: update lttng-modules tracer ABI
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 4 Jul 2018 20:15:07 +0000 (16:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Dec 2019 05:28:11 +0000 (00:28 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I27e1e552b13b5a541b43ff250d1d4839e399f1f3
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/kernel-ctl/kernel-ctl.c
src/common/kernel-ctl/kernel-ctl.h
src/common/kernel-ctl/kernel-ioctl.h
src/common/lttng-kernel.h

index 5f25adf02dc269debabcbdad5d04729ec0d46eb3..1df6849a9c06e721f27897f86639d43b0cc83a73 100644 (file)
@@ -230,6 +230,67 @@ int kernctl_list_tracker_pids(int fd)
        return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS);
 }
 
+static enum lttng_kernel_tracker_type get_kernel_tracker_type(
+               enum lttng_tracker_type type)
+{
+       switch (type) {
+       case LTTNG_TRACKER_PID:
+               return LTTNG_KERNEL_TRACKER_PID;
+       case LTTNG_TRACKER_VPID:
+               return LTTNG_KERNEL_TRACKER_VPID;
+       case LTTNG_TRACKER_UID:
+               return LTTNG_KERNEL_TRACKER_UID;
+       case LTTNG_TRACKER_VUID:
+               return LTTNG_KERNEL_TRACKER_VUID;
+       case LTTNG_TRACKER_GID:
+               return LTTNG_KERNEL_TRACKER_GID;
+       case LTTNG_TRACKER_VGID:
+               return LTTNG_KERNEL_TRACKER_VGID;
+       default:
+               return LTTNG_KERNEL_TRACKER_UNKNOWN;
+       }
+}
+
+int kernctl_track_id(int fd, enum lttng_tracker_type tracker_type, int id)
+{
+       struct lttng_kernel_tracker_args args;
+
+       args.id = id;
+       args.type = get_kernel_tracker_type(tracker_type);
+       if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) {
+               errno = EINVAL;
+               return -1;
+       }
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_TRACK_ID, &args);
+}
+
+int kernctl_untrack_id(int fd, enum lttng_tracker_type tracker_type, int id)
+{
+       struct lttng_kernel_tracker_args args;
+
+       args.id = id;
+       args.type = get_kernel_tracker_type(tracker_type);
+       if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) {
+               errno = EINVAL;
+               return -1;
+       }
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_UNTRACK_ID, &args);
+}
+
+int kernctl_list_tracker_ids(int fd, enum lttng_tracker_type tracker_type)
+{
+       struct lttng_kernel_tracker_args args;
+
+       args.id = -1;
+       args.type = get_kernel_tracker_type(tracker_type);
+       if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) {
+               errno = EINVAL;
+               return -1;
+       }
+       return LTTNG_IOCTL_NO_CHECK(
+                       fd, LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS, &args);
+}
+
 int kernctl_session_regenerate_metadata(int fd)
 {
        return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_METADATA_REGEN);
index fcaca84fe3d43ae1a3ba3a49ec265e982c7f2efd..a662ac90b591e2b44384dc3a348f74d58407dd38 100644 (file)
@@ -65,6 +65,10 @@ int kernctl_track_pid(int fd, int pid);
 int kernctl_untrack_pid(int fd, int pid);
 int kernctl_list_tracker_pids(int fd);
 
+int kernctl_track_id(int fd, enum lttng_tracker_type tracker_type, int id);
+int kernctl_untrack_id(int fd, enum lttng_tracker_type tracker_type, int id);
+int kernctl_list_tracker_ids(int fd, enum lttng_tracker_type tracker_type);
+
 int kernctl_session_regenerate_metadata(int fd);
 int kernctl_session_regenerate_statedump(int fd);
 int kernctl_session_set_name(int fd, const char *name);
index f38f5dd671d3577c1de8d18d8a138c17fa07e04a..4fef928d68eb9739dfdb5e09a757bc9f219adb15 100644 (file)
 #define LTTNG_KERNEL_FILTER                    _IO(0xF6, 0x90)
 #define LTTNG_KERNEL_ADD_CALLSITE      _IO(0xF6, 0x91)
 
+/* Session FD ioctl (continued) */
+#define LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS  \
+       _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args)
+#define LTTNG_KERNEL_SESSION_TRACK_ID          \
+       _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args)
+#define LTTNG_KERNEL_SESSION_UNTRACK_ID                \
+       _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)
+
 #endif /* _LTT_KERNEL_IOCTL_H */
index 4008b50cf6d2999fbe987a8d81fd17d49eda95fb..151137004e2f026e15b04c84f5c9e1ff72c94dbb 100644 (file)
@@ -213,4 +213,20 @@ struct lttng_kernel_session_creation_time {
        char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
 } LTTNG_PACKED;
 
+enum lttng_kernel_tracker_type {
+       LTTNG_KERNEL_TRACKER_UNKNOWN            = -1,
+
+       LTTNG_KERNEL_TRACKER_PID                = 0,
+       LTTNG_KERNEL_TRACKER_VPID               = 1,
+       LTTNG_KERNEL_TRACKER_UID                = 2,
+       LTTNG_KERNEL_TRACKER_VUID               = 3,
+       LTTNG_KERNEL_TRACKER_GID                = 4,
+       LTTNG_KERNEL_TRACKER_VGID               = 5,
+};
+
+struct lttng_kernel_tracker_args {
+       enum lttng_kernel_tracker_type type;
+       int32_t id;
+};
+
 #endif /* _LTTNG_KERNEL_H */
This page took 0.037734 seconds and 4 git commands to generate.