sessiond: rename syscall.h so it does not conflict with system
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 1 Mar 2018 22:11:41 +0000 (17:11 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 10 Apr 2018 20:05:09 +0000 (16:05 -0400)
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/Makefile.am
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/lttng-syscall.c [new file with mode: 0644]
src/bin/lttng-sessiond/lttng-syscall.h [new file with mode: 0644]
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/save.c
src/bin/lttng-sessiond/syscall.c [deleted file]
src/bin/lttng-sessiond/syscall.h [deleted file]

index f256aadb2477903cbc32f2aa3f1eeaa92289dd8d..156b6d822137845b3f330d8189673d8fe48918ab 100644 (file)
@@ -31,7 +31,7 @@ lttng_sessiond_SOURCES = utils.c utils.h \
                        agent.c agent.h \
                        save.h save.c \
                        load-session-thread.h load-session-thread.c \
-                       syscall.h syscall.c \
+                       lttng-syscall.h lttng-syscall.c \
                        notification-thread.h notification-thread.c \
                        notification-thread-internal.h \
                        notification-thread-commands.h notification-thread-commands.c \
index 4c5160764aac0612992610b985db805fd589e7ca..a1eb961ee544331f961202ee2b69d36ffbe87868 100644 (file)
@@ -47,7 +47,7 @@
 #include "kernel-consumer.h"
 #include "lttng-sessiond.h"
 #include "utils.h"
-#include "syscall.h"
+#include "lttng-syscall.h"
 #include "agent.h"
 #include "buffer-registry.h"
 #include "notification-thread.h"
diff --git a/src/bin/lttng-sessiond/lttng-syscall.c b/src/bin/lttng-sessiond/lttng-syscall.c
new file mode 100644 (file)
index 0000000..9a45a8a
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _LGPL_SOURCE
+#include <stdbool.h>
+
+#include <common/bitfield.h>
+#include <common/common.h>
+#include <common/kernel-ctl/kernel-ctl.h>
+
+#include "lttng-sessiond.h"
+#include "kernel.h"
+#include "lttng-syscall.h"
+#include "utils.h"
+
+/* Global syscall table. */
+struct syscall *syscall_table;
+
+/* Number of entry in the syscall table. */
+static size_t syscall_table_nb_entry;
+
+/*
+ * Populate the system call table using the kernel tracer.
+ *
+ * Return 0 on success and the syscall table is allocated. On error, a negative
+ * value is returned.
+ */
+int syscall_init_table(void)
+{
+       int ret, fd, err;
+       size_t nbmem;
+       FILE *fp;
+       /* Syscall data from the kernel. */
+       size_t index = 0;
+       bool at_least_one_syscall = false;
+       uint32_t bitness;
+       char name[SYSCALL_NAME_LEN];
+
+       DBG3("Syscall init system call table");
+
+       fd = kernctl_syscall_list(kernel_tracer_fd);
+       if (fd < 0) {
+               ret = fd;
+               PERROR("kernelctl syscall list");
+               goto error_ioctl;
+       }
+
+       fp = fdopen(fd, "r");
+       if (!fp) {
+               ret = -errno;
+               PERROR("syscall list fdopen");
+               goto error_fp;
+       }
+
+       nbmem = SYSCALL_TABLE_INIT_SIZE;
+       syscall_table = zmalloc(sizeof(struct syscall) * nbmem);
+       if (!syscall_table) {
+               ret = -errno;
+               PERROR("syscall list zmalloc");
+               goto error;
+       }
+
+       while (fscanf(fp,
+                               "syscall { index = %zu; \
+                               name = %" XSTR(SYSCALL_NAME_LEN) "[^;]; \
+                               bitness = %u; };\n",
+                               &index, name, &bitness) == 3) {
+               at_least_one_syscall = true;
+               if (index >= nbmem) {
+                       struct syscall *new_list;
+                       size_t new_nbmem;
+
+                       /* Double memory size. */
+                       new_nbmem = max(index + 1, nbmem << 1);
+                       if (new_nbmem > (SIZE_MAX / sizeof(*new_list))) {
+                               /* Overflow, stop everything, something went really wrong. */
+                               ERR("Syscall listing memory size overflow. Stopping");
+                               free(syscall_table);
+                               syscall_table = NULL;
+                               ret = -EINVAL;
+                               goto error;
+                       }
+
+                       DBG("Reallocating syscall table from %zu to %zu entries", nbmem,
+                                       new_nbmem);
+                       new_list = realloc(syscall_table, new_nbmem * sizeof(*new_list));
+                       if (!new_list) {
+                               ret = -errno;
+                               PERROR("syscall list realloc");
+                               goto error;
+                       }
+
+                       /* Zero out the new memory. */
+                       memset(new_list + nbmem, 0,
+                                       (new_nbmem - nbmem) * sizeof(*new_list));
+                       nbmem = new_nbmem;
+                       syscall_table = new_list;
+               }
+               syscall_table[index].index = index;
+               syscall_table[index].bitness = bitness;
+               if (lttng_strncpy(syscall_table[index].name, name,
+                               sizeof(syscall_table[index].name))) {
+                       ret = -EINVAL;
+                       free(syscall_table);
+                       syscall_table = NULL;
+                       goto error;
+               }
+               /*
+               DBG("Syscall name '%s' at index %" PRIu32 " of bitness %u",
+                               syscall_table[index].name,
+                               syscall_table[index].index,
+                               syscall_table[index].bitness);
+               */
+       }
+
+       /* Index starts at 0. */
+       if (at_least_one_syscall) {
+               syscall_table_nb_entry = index + 1;
+       }
+
+       ret = 0;
+
+error:
+       err = fclose(fp);
+       if (err) {
+               PERROR("syscall list fclose");
+       }
+       return ret;
+
+error_fp:
+       err = close(fd);
+       if (err) {
+               PERROR("syscall list close");
+       }
+
+error_ioctl:
+       return ret;
+}
+
+/*
+ * Helper function for the list syscalls command that empty the temporary
+ * syscall hashtable used to track duplicate between 32 and 64 bit arch.
+ *
+ * This empty the hash table and destroys it after. After this, the pointer is
+ * unsuable. RCU read side lock MUST be acquired before calling this.
+ */
+static void destroy_syscall_ht(struct lttng_ht *ht)
+{
+       struct lttng_ht_iter iter;
+       struct syscall *ksyscall;
+
+       DBG3("Destroying syscall hash table.");
+
+       if (!ht) {
+               return;
+       }
+
+       cds_lfht_for_each_entry(ht->ht, &iter.iter, ksyscall, node.node) {
+               int ret;
+
+               ret = lttng_ht_del(ht, &iter);
+               assert(!ret);
+               free(ksyscall);
+       }
+       ht_cleanup_push(ht);
+}
+
+/*
+ * Allocate the given hashtable pointer.
+ *
+ * Return 0 on success else a negative LTTNG error value.
+ */
+static int init_syscall_ht(struct lttng_ht **ht)
+{
+       int ret;
+
+       *ht = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
+       if (!*ht) {
+               ret = -LTTNG_ERR_NOMEM;
+       } else {
+               ret = 0;
+       }
+
+       return ret;
+}
+
+/*
+ * Lookup a syscall in the given hash table by name.
+ *
+ * Return syscall object if found or else NULL.
+ */
+static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
+{
+       struct lttng_ht_node_str *node;
+       struct lttng_ht_iter iter;
+       struct syscall *ksyscall = NULL;
+
+       assert(ht);
+       assert(name);
+
+       lttng_ht_lookup(ht, (void *) name, &iter);
+       node = lttng_ht_iter_get_node_str(&iter);
+       if (node) {
+               ksyscall = caa_container_of(node, struct syscall, node);
+       }
+
+       return ksyscall;
+}
+
+/*
+ * Using the given syscall object in the events array with the bitness of the
+ * syscall at index in the syscall table.
+ */
+static void update_event_syscall_bitness(struct lttng_event *events,
+               unsigned int index, unsigned int syscall_index)
+{
+       assert(events);
+
+       if (syscall_table[index].bitness == 32) {
+               events[syscall_index].flags |= LTTNG_EVENT_FLAG_SYSCALL_32;
+       } else {
+               events[syscall_index].flags |= LTTNG_EVENT_FLAG_SYSCALL_64;
+       }
+}
+
+/*
+ * Allocate and initialize syscall object and add it to the given hashtable.
+ *
+ * Return 0 on success else -LTTNG_ERR_NOMEM.
+ */
+static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index,
+               unsigned int syscall_index)
+{
+       int ret;
+       struct syscall *ksyscall;
+
+       assert(ht);
+
+       ksyscall = zmalloc(sizeof(*ksyscall));
+       if (!ksyscall) {
+               ret = -LTTNG_ERR_NOMEM;
+               goto error;
+       }
+
+       strncpy(ksyscall->name, syscall_table[index].name,
+                       sizeof(ksyscall->name));
+       ksyscall->bitness = syscall_table[index].bitness;
+       ksyscall->index = syscall_index;
+       lttng_ht_node_init_str(&ksyscall->node, ksyscall->name);
+       lttng_ht_add_unique_str(ht, &ksyscall->node);
+       ret = 0;
+
+error:
+       return ret;
+}
+
+/*
+ * List syscalls present in the kernel syscall global array, allocate and
+ * populate the events structure with them. Skip the empty syscall name.
+ *
+ * Return the number of entries in the array else a negative value.
+ */
+ssize_t syscall_table_list(struct lttng_event **_events)
+{
+       int i, index = 0;
+       ssize_t ret;
+       struct lttng_event *events;
+       /* Hash table used to filter duplicate out. */
+       struct lttng_ht *syscalls_ht = NULL;
+
+       assert(_events);
+
+       DBG("Syscall table listing.");
+
+       rcu_read_lock();
+
+       /*
+        * Allocate at least the number of total syscall we have even if some of
+        * them might not be valid. The count below will make sure to return the
+        * right size of the events array.
+        */
+       events = zmalloc(syscall_table_nb_entry * sizeof(*events));
+       if (!events) {
+               PERROR("syscall table list zmalloc");
+               ret = -LTTNG_ERR_NOMEM;
+               goto error;
+       }
+
+       ret = init_syscall_ht(&syscalls_ht);
+       if (ret < 0) {
+               goto error;
+       }
+
+       for (i = 0; i < syscall_table_nb_entry; i++) {
+               struct syscall *ksyscall;
+
+               /* Skip empty syscalls. */
+               if (*syscall_table[i].name == '\0') {
+                       continue;
+               }
+
+               ksyscall = lookup_syscall(syscalls_ht, syscall_table[i].name);
+               if (ksyscall) {
+                       update_event_syscall_bitness(events, i, ksyscall->index);
+                       continue;
+               }
+
+               ret = add_syscall_to_ht(syscalls_ht, i, index);
+               if (ret < 0) {
+                       goto error;
+               }
+
+               /* Copy the event information in the event's array. */
+               strncpy(events[index].name, syscall_table[i].name,
+                               sizeof(events[index].name));
+               update_event_syscall_bitness(events, i, index);
+               events[index].type = LTTNG_EVENT_SYSCALL;
+               /* This makes the command line not print the enabled/disabled field. */
+               events[index].enabled = -1;
+               index++;
+       }
+
+       destroy_syscall_ht(syscalls_ht);
+       *_events = events;
+       rcu_read_unlock();
+       return index;
+
+error:
+       destroy_syscall_ht(syscalls_ht);
+       free(events);
+       rcu_read_unlock();
+       return ret;
+}
diff --git a/src/bin/lttng-sessiond/lttng-syscall.h b/src/bin/lttng-sessiond/lttng-syscall.h
new file mode 100644 (file)
index 0000000..a270861
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef LTTNG_SYSCALL_H
+#define LTTNG_SYSCALL_H
+
+#include <common/hashtable/hashtable.h>
+#include <lttng/event.h>
+
+#include "trace-kernel.h"
+
+/*
+ * Default size of the kernel system call array. With this size, we usually
+ * reallocate twice considering a 32 bit compat layer also.
+ */
+#define SYSCALL_TABLE_INIT_SIZE    256
+
+/* Maximum length of a syscall name. */
+#define SYSCALL_NAME_LEN           255
+
+/*
+ * Represent a kernel syscall and used when we are populating the internal
+ * list.
+ */
+struct syscall {
+       uint32_t index;
+       uint32_t bitness;
+       char name[SYSCALL_NAME_LEN];
+       /* Used by the list syscalls command. */
+       struct lttng_ht_node_str node;
+};
+
+/*
+ * Allocated once when listing all syscalls at boot time. This is an array
+ * indexed by the syscall index provided in the listing.
+ */
+extern struct syscall *syscall_table;
+
+/* Use to list kernel system calls. */
+int syscall_init_table(void);
+ssize_t syscall_table_list(struct lttng_event **events);
+
+#endif /* LTTNG_SYSCALL_H */
index 4968ee2a937194d2f344fa6a2b232656eec6acc9..8e8b83b0f54a48d7d063f6cc668645ba804de7be 100644 (file)
@@ -74,7 +74,7 @@
 #include "notification-thread.h"
 #include "notification-thread-commands.h"
 #include "rotation-thread.h"
-#include "syscall.h"
+#include "lttng-syscall.h"
 #include "agent.h"
 #include "ht-cleanup.h"
 #include "sessiond-config.h"
index ea4feb0c314696e4742a68aae7beea86944dbaec..b7d0cc80a40d4d9fb47d4b17aaaa9e683c7e2776 100644 (file)
@@ -32,7 +32,7 @@
 #include "kernel.h"
 #include "save.h"
 #include "session.h"
-#include "syscall.h"
+#include "lttng-syscall.h"
 #include "trace-ust.h"
 #include "agent.h"
 
diff --git a/src/bin/lttng-sessiond/syscall.c b/src/bin/lttng-sessiond/syscall.c
deleted file mode 100644 (file)
index 7d0a92b..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define _LGPL_SOURCE
-#include <stdbool.h>
-
-#include <common/bitfield.h>
-#include <common/common.h>
-#include <common/kernel-ctl/kernel-ctl.h>
-
-#include "lttng-sessiond.h"
-#include "kernel.h"
-#include "syscall.h"
-#include "utils.h"
-
-/* Global syscall table. */
-struct syscall *syscall_table;
-
-/* Number of entry in the syscall table. */
-static size_t syscall_table_nb_entry;
-
-/*
- * Populate the system call table using the kernel tracer.
- *
- * Return 0 on success and the syscall table is allocated. On error, a negative
- * value is returned.
- */
-int syscall_init_table(void)
-{
-       int ret, fd, err;
-       size_t nbmem;
-       FILE *fp;
-       /* Syscall data from the kernel. */
-       size_t index = 0;
-       bool at_least_one_syscall = false;
-       uint32_t bitness;
-       char name[SYSCALL_NAME_LEN];
-
-       DBG3("Syscall init system call table");
-
-       fd = kernctl_syscall_list(kernel_tracer_fd);
-       if (fd < 0) {
-               ret = fd;
-               PERROR("kernelctl syscall list");
-               goto error_ioctl;
-       }
-
-       fp = fdopen(fd, "r");
-       if (!fp) {
-               ret = -errno;
-               PERROR("syscall list fdopen");
-               goto error_fp;
-       }
-
-       nbmem = SYSCALL_TABLE_INIT_SIZE;
-       syscall_table = zmalloc(sizeof(struct syscall) * nbmem);
-       if (!syscall_table) {
-               ret = -errno;
-               PERROR("syscall list zmalloc");
-               goto error;
-       }
-
-       while (fscanf(fp,
-                               "syscall { index = %zu; \
-                               name = %" XSTR(SYSCALL_NAME_LEN) "[^;]; \
-                               bitness = %u; };\n",
-                               &index, name, &bitness) == 3) {
-               at_least_one_syscall = true;
-               if (index >= nbmem) {
-                       struct syscall *new_list;
-                       size_t new_nbmem;
-
-                       /* Double memory size. */
-                       new_nbmem = max(index + 1, nbmem << 1);
-                       if (new_nbmem > (SIZE_MAX / sizeof(*new_list))) {
-                               /* Overflow, stop everything, something went really wrong. */
-                               ERR("Syscall listing memory size overflow. Stopping");
-                               free(syscall_table);
-                               syscall_table = NULL;
-                               ret = -EINVAL;
-                               goto error;
-                       }
-
-                       DBG("Reallocating syscall table from %zu to %zu entries", nbmem,
-                                       new_nbmem);
-                       new_list = realloc(syscall_table, new_nbmem * sizeof(*new_list));
-                       if (!new_list) {
-                               ret = -errno;
-                               PERROR("syscall list realloc");
-                               goto error;
-                       }
-
-                       /* Zero out the new memory. */
-                       memset(new_list + nbmem, 0,
-                                       (new_nbmem - nbmem) * sizeof(*new_list));
-                       nbmem = new_nbmem;
-                       syscall_table = new_list;
-               }
-               syscall_table[index].index = index;
-               syscall_table[index].bitness = bitness;
-               if (lttng_strncpy(syscall_table[index].name, name,
-                               sizeof(syscall_table[index].name))) {
-                       ret = -EINVAL;
-                       free(syscall_table);
-                       syscall_table = NULL;
-                       goto error;
-               }
-               /*
-               DBG("Syscall name '%s' at index %" PRIu32 " of bitness %u",
-                               syscall_table[index].name,
-                               syscall_table[index].index,
-                               syscall_table[index].bitness);
-               */
-       }
-
-       /* Index starts at 0. */
-       if (at_least_one_syscall) {
-               syscall_table_nb_entry = index + 1;
-       }
-
-       ret = 0;
-
-error:
-       err = fclose(fp);
-       if (err) {
-               PERROR("syscall list fclose");
-       }
-       return ret;
-
-error_fp:
-       err = close(fd);
-       if (err) {
-               PERROR("syscall list close");
-       }
-
-error_ioctl:
-       return ret;
-}
-
-/*
- * Helper function for the list syscalls command that empty the temporary
- * syscall hashtable used to track duplicate between 32 and 64 bit arch.
- *
- * This empty the hash table and destroys it after. After this, the pointer is
- * unsuable. RCU read side lock MUST be acquired before calling this.
- */
-static void destroy_syscall_ht(struct lttng_ht *ht)
-{
-       struct lttng_ht_iter iter;
-       struct syscall *ksyscall;
-
-       DBG3("Destroying syscall hash table.");
-
-       if (!ht) {
-               return;
-       }
-
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, ksyscall, node.node) {
-               int ret;
-
-               ret = lttng_ht_del(ht, &iter);
-               assert(!ret);
-               free(ksyscall);
-       }
-       ht_cleanup_push(ht);
-}
-
-/*
- * Allocate the given hashtable pointer.
- *
- * Return 0 on success else a negative LTTNG error value.
- */
-static int init_syscall_ht(struct lttng_ht **ht)
-{
-       int ret;
-
-       *ht = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
-       if (!*ht) {
-               ret = -LTTNG_ERR_NOMEM;
-       } else {
-               ret = 0;
-       }
-
-       return ret;
-}
-
-/*
- * Lookup a syscall in the given hash table by name.
- *
- * Return syscall object if found or else NULL.
- */
-static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
-{
-       struct lttng_ht_node_str *node;
-       struct lttng_ht_iter iter;
-       struct syscall *ksyscall = NULL;
-
-       assert(ht);
-       assert(name);
-
-       lttng_ht_lookup(ht, (void *) name, &iter);
-       node = lttng_ht_iter_get_node_str(&iter);
-       if (node) {
-               ksyscall = caa_container_of(node, struct syscall, node);
-       }
-
-       return ksyscall;
-}
-
-/*
- * Using the given syscall object in the events array with the bitness of the
- * syscall at index in the syscall table.
- */
-static void update_event_syscall_bitness(struct lttng_event *events,
-               unsigned int index, unsigned int syscall_index)
-{
-       assert(events);
-
-       if (syscall_table[index].bitness == 32) {
-               events[syscall_index].flags |= LTTNG_EVENT_FLAG_SYSCALL_32;
-       } else {
-               events[syscall_index].flags |= LTTNG_EVENT_FLAG_SYSCALL_64;
-       }
-}
-
-/*
- * Allocate and initialize syscall object and add it to the given hashtable.
- *
- * Return 0 on success else -LTTNG_ERR_NOMEM.
- */
-static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index,
-               unsigned int syscall_index)
-{
-       int ret;
-       struct syscall *ksyscall;
-
-       assert(ht);
-
-       ksyscall = zmalloc(sizeof(*ksyscall));
-       if (!ksyscall) {
-               ret = -LTTNG_ERR_NOMEM;
-               goto error;
-       }
-
-       strncpy(ksyscall->name, syscall_table[index].name,
-                       sizeof(ksyscall->name));
-       ksyscall->bitness = syscall_table[index].bitness;
-       ksyscall->index = syscall_index;
-       lttng_ht_node_init_str(&ksyscall->node, ksyscall->name);
-       lttng_ht_add_unique_str(ht, &ksyscall->node);
-       ret = 0;
-
-error:
-       return ret;
-}
-
-/*
- * List syscalls present in the kernel syscall global array, allocate and
- * populate the events structure with them. Skip the empty syscall name.
- *
- * Return the number of entries in the array else a negative value.
- */
-ssize_t syscall_table_list(struct lttng_event **_events)
-{
-       int i, index = 0;
-       ssize_t ret;
-       struct lttng_event *events;
-       /* Hash table used to filter duplicate out. */
-       struct lttng_ht *syscalls_ht = NULL;
-
-       assert(_events);
-
-       DBG("Syscall table listing.");
-
-       rcu_read_lock();
-
-       /*
-        * Allocate at least the number of total syscall we have even if some of
-        * them might not be valid. The count below will make sure to return the
-        * right size of the events array.
-        */
-       events = zmalloc(syscall_table_nb_entry * sizeof(*events));
-       if (!events) {
-               PERROR("syscall table list zmalloc");
-               ret = -LTTNG_ERR_NOMEM;
-               goto error;
-       }
-
-       ret = init_syscall_ht(&syscalls_ht);
-       if (ret < 0) {
-               goto error;
-       }
-
-       for (i = 0; i < syscall_table_nb_entry; i++) {
-               struct syscall *ksyscall;
-
-               /* Skip empty syscalls. */
-               if (*syscall_table[i].name == '\0') {
-                       continue;
-               }
-
-               ksyscall = lookup_syscall(syscalls_ht, syscall_table[i].name);
-               if (ksyscall) {
-                       update_event_syscall_bitness(events, i, ksyscall->index);
-                       continue;
-               }
-
-               ret = add_syscall_to_ht(syscalls_ht, i, index);
-               if (ret < 0) {
-                       goto error;
-               }
-
-               /* Copy the event information in the event's array. */
-               strncpy(events[index].name, syscall_table[i].name,
-                               sizeof(events[index].name));
-               update_event_syscall_bitness(events, i, index);
-               events[index].type = LTTNG_EVENT_SYSCALL;
-               /* This makes the command line not print the enabled/disabled field. */
-               events[index].enabled = -1;
-               index++;
-       }
-
-       destroy_syscall_ht(syscalls_ht);
-       *_events = events;
-       rcu_read_unlock();
-       return index;
-
-error:
-       destroy_syscall_ht(syscalls_ht);
-       free(events);
-       rcu_read_unlock();
-       return ret;
-}
diff --git a/src/bin/lttng-sessiond/syscall.h b/src/bin/lttng-sessiond/syscall.h
deleted file mode 100644 (file)
index 5f065cd..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef SYSCALL_H
-#define SYSCALL_H
-
-#include <common/hashtable/hashtable.h>
-#include <lttng/event.h>
-
-#include "trace-kernel.h"
-
-/*
- * Default size of the kernel system call array. With this size, we usually
- * reallocate twice considering a 32 bit compat layer also.
- */
-#define SYSCALL_TABLE_INIT_SIZE    256
-
-/* Maximum length of a syscall name. */
-#define SYSCALL_NAME_LEN           255
-
-/*
- * Represent a kernel syscall and used when we are populating the internal
- * list.
- */
-struct syscall {
-       uint32_t index;
-       uint32_t bitness;
-       char name[SYSCALL_NAME_LEN];
-       /* Used by the list syscalls command. */
-       struct lttng_ht_node_str node;
-};
-
-/*
- * Allocated once when listing all syscalls at boot time. This is an array
- * indexed by the syscall index provided in the listing.
- */
-extern struct syscall *syscall_table;
-
-/* Use to list kernel system calls. */
-int syscall_init_table(void);
-ssize_t syscall_table_list(struct lttng_event **events);
-
-#endif /* SYSCALL_H */
This page took 0.036543 seconds and 4 git commands to generate.