Implement UST PID tracker
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.c
index 6cc962703e03b11d8475212c4007c12408a32645..7168c362c9fdf9785833006e8fa5e2c5911f6954 100644 (file)
@@ -16,6 +16,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#define _GNU_SOURCE
+#define _LGPL_SOURCE
 #define __USE_LINUX_IOCTL_DEFS
 #include <sys/ioctl.h>
 #include <string.h>
@@ -188,6 +190,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits)
        }
 
        array_alloc_len = ALIGN(kmask_len.len, 8) >> 3;
+
        kmask = zmalloc(sizeof(*kmask) + array_alloc_len);
        if (!kmask) {
                ret = -1;
@@ -200,7 +203,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits)
                goto end;
        }
 
-       new_mask = realloc(syscall_mask, array_alloc_len);
+       new_mask = realloc(*syscall_mask, array_alloc_len);
        if (!new_mask) {
                ret = -1;
                goto end;
@@ -214,6 +217,16 @@ end:
        return ret;
 }
 
+int kernctl_track_pid(int fd, int pid)
+{
+       return ioctl(fd, LTTNG_KERNEL_SESSION_TRACK_PID, pid);
+}
+
+int kernctl_untrack_pid(int fd, int pid)
+{
+       return ioctl(fd, LTTNG_KERNEL_SESSION_UNTRACK_PID, pid);
+}
+
 int kernctl_create_stream(int fd)
 {
        return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,
@@ -345,6 +358,12 @@ end:
        return ret;
 }
 
+int kernctl_tracer_abi_version(int fd,
+               struct lttng_kernel_tracer_abi_version *v)
+{
+       return ioctl(fd, LTTNG_KERNEL_TRACER_ABI_VERSION, v);
+}
+
 int kernctl_wait_quiescent(int fd)
 {
        return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_WAIT_QUIESCENT,
This page took 0.024535 seconds and 4 git commands to generate.