sessiond: main.cpp: iterate on list using list_iteration_adapter
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-syscall.hpp
CommitLineData
834978fd 1/*
ab5be9fa 2 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
834978fd 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
834978fd 5 *
834978fd
DG
6 */
7
0dbc2034
GB
8#ifndef LTTNG_SYSCALL_H
9#define LTTNG_SYSCALL_H
834978fd 10
28f23191
JG
11#include "trace-kernel.hpp"
12
f3985622 13#include <common/exception.hpp>
c9e313bc 14#include <common/hashtable/hashtable.hpp>
f3985622
JG
15#include <common/macros.hpp>
16#include <common/string-utils/c-string-view.hpp>
834978fd 17
28f23191 18#include <lttng/event.h>
834978fd
DG
19
20/*
21 * Default size of the kernel system call array. With this size, we usually
22 * reallocate twice considering a 32 bit compat layer also.
23 */
28f23191 24#define SYSCALL_TABLE_INIT_SIZE 256
834978fd
DG
25
26/* Maximum length of a syscall name. */
28f23191 27#define SYSCALL_NAME_LEN 255
834978fd
DG
28
29/*
30 * Represent a kernel syscall and used when we are populating the internal
31 * list.
32 */
33struct syscall {
f3985622
JG
34 syscall(std::uint32_t index_, std::uint32_t bitness_, const lttng::c_string_view name_) :
35 index(index_), bitness(bitness_)
36 {
37 if (lttng_strncpy(name, name_.data(), sizeof(name))) {
38 LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
39 "Invalid syscall name: name=`{}`, length={}, max_length={}",
40 name_.data(),
41 name_.len(),
42 sizeof(name)));
43 }
44
45 lttng_ht_node_init_str(&node, name);
46 }
47
48 std::uint32_t index = 0;
49 std::uint32_t bitness = 0;
50 char name[SYSCALL_NAME_LEN] = {};
834978fd 51 /* Used by the list syscalls command. */
f3985622 52 struct lttng_ht_node_str node = {};
834978fd
DG
53};
54
55/*
56 * Allocated once when listing all syscalls at boot time. This is an array
57 * indexed by the syscall index provided in the listing.
58 */
f3985622 59extern std::vector<struct syscall> syscall_table;
834978fd
DG
60
61/* Use to list kernel system calls. */
7d268848 62int syscall_init_table(int tracer_fd);
834978fd 63ssize_t syscall_table_list(struct lttng_event **events);
834978fd 64
0dbc2034 65#endif /* LTTNG_SYSCALL_H */
This page took 0.081511 seconds and 5 git commands to generate.