2 * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef _LTT_KERNEL_CTL_H
9 #define _LTT_KERNEL_CTL_H
11 #include "lttng/lttng-error.h"
12 #include "lttng/tracker.h"
15 #include "trace-kernel.h"
18 * Default size for the event list when kernel_list_events is called. This size
19 * value is based on the initial LTTng 2.0 version set of tracepoints.
21 * This is NOT an upper bound because if the real event list size is bigger,
22 * dynamic reallocation is performed.
24 #define KERNEL_EVENT_INIT_LIST_SIZE 64
26 int kernel_add_channel_context(struct ltt_kernel_channel
*chan
,
27 struct ltt_kernel_context
*ctx
);
28 int kernel_create_session(struct ltt_session
*session
);
29 int kernel_create_channel(struct ltt_kernel_session
*session
,
30 struct lttng_channel
*chan
);
31 int kernel_create_event(struct lttng_event
*ev
, struct ltt_kernel_channel
*channel
,
32 char *filter_expression
, struct lttng_filter_bytecode
*filter
);
33 int kernel_disable_channel(struct ltt_kernel_channel
*chan
);
34 int kernel_disable_event(struct ltt_kernel_event
*event
);
35 int kernel_enable_event(struct ltt_kernel_event
*event
);
36 int kernel_enable_channel(struct ltt_kernel_channel
*chan
);
37 enum lttng_error_code
kernel_process_attr_tracker_set_tracking_policy(
38 struct ltt_kernel_session
*session
,
39 enum lttng_process_attr process_attr
,
40 enum lttng_tracking_policy policy
);
41 enum lttng_error_code
kernel_process_attr_tracker_inclusion_set_add_value(
42 struct ltt_kernel_session
*session
,
43 enum lttng_process_attr process_attr
,
44 const struct process_attr_value
*value
);
45 enum lttng_error_code
kernel_process_attr_tracker_inclusion_set_remove_value(
46 struct ltt_kernel_session
*session
,
47 enum lttng_process_attr process_attr
,
48 const struct process_attr_value
*value
);
49 const struct process_attr_tracker
*kernel_get_process_attr_tracker(
50 struct ltt_kernel_session
*session
,
51 enum lttng_process_attr process_attr
);
52 int kernel_open_metadata(struct ltt_kernel_session
*session
);
53 int kernel_open_metadata_stream(struct ltt_kernel_session
*session
);
54 int kernel_open_channel_stream(struct ltt_kernel_channel
*channel
);
55 int kernel_flush_buffer(struct ltt_kernel_channel
*channel
);
56 int kernel_metadata_flush_buffer(int fd
);
57 int kernel_start_session(struct ltt_kernel_session
*session
);
58 int kernel_stop_session(struct ltt_kernel_session
*session
);
59 ssize_t
kernel_list_events(struct lttng_event
**event_list
);
60 void kernel_wait_quiescent(void);
61 int kernel_validate_version(struct lttng_kernel_tracer_version
*kernel_tracer_version
,
62 struct lttng_kernel_tracer_abi_version
*kernel_tracer_abi_version
);
63 void kernel_destroy_session(struct ltt_kernel_session
*ksess
);
64 void kernel_free_session(struct ltt_kernel_session
*ksess
);
65 void kernel_destroy_channel(struct ltt_kernel_channel
*kchan
);
66 enum lttng_error_code
kernel_snapshot_record(
67 struct ltt_kernel_session
*ksess
,
68 const struct consumer_output
*output
, int wait
,
69 uint64_t nb_packets_per_stream
);
70 int kernel_syscall_mask(int chan_fd
, char **syscall_mask
, uint32_t *nr_bits
);
71 enum lttng_error_code
kernel_rotate_session(struct ltt_session
*session
);
72 enum lttng_error_code
kernel_clear_session(struct ltt_session
*session
);
74 int init_kernel_workarounds(void);
75 int kernel_supports_ring_buffer_snapshot_sample_positions(void);
76 int kernel_supports_ring_buffer_packet_sequence_number(void);
77 int init_kernel_tracer(void);
78 void cleanup_kernel_tracer(void);
79 bool kernel_tracer_is_initialized(void);
81 enum lttng_error_code
kernel_create_channel_subdirectories(
82 const struct ltt_kernel_session
*ksess
);
84 #endif /* _LTT_KERNEL_CTL_H */