2 * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
9 #ifndef _LTTNG_KERNEL_CTL_H
10 #define _LTTNG_KERNEL_CTL_H
14 #include <lttng/lttng.h>
15 #include <common/lttng-kernel.h>
16 #include <common/lttng-kernel-old.h>
17 #include <common/sessiond-comm/sessiond-comm.h> /* for struct lttng_filter_bytecode */
19 int kernctl_create_session(int fd
);
20 int kernctl_open_metadata(int fd
, struct lttng_channel_attr
*chops
);
21 int kernctl_create_channel(int fd
, struct lttng_channel_attr
*chops
);
22 int kernctl_create_session_counter(int session_fd
, struct lttng_kernel_counter_conf
*counter_conf
);
23 int kernctl_create_stream(int fd
);
24 int kernctl_create_event(int fd
, struct lttng_kernel_event
*ev
);
25 int kernctl_create_counter_event(int fd
, struct lttng_kernel_counter_event
*ev
);
26 int kernctl_add_context(int fd
, struct lttng_kernel_context
*ctx
);
28 int kernctl_enable(int fd
);
29 int kernctl_disable(int fd
);
30 int kernctl_start_session(int fd
);
31 int kernctl_stop_session(int fd
);
33 int kernctl_create_event_notifier_group(int fd
);
35 /* Apply on event notifier_group file descriptor. */
36 int kernctl_create_event_notifier_group_notification_fd(int fd
);
37 int kernctl_create_event_notifier_group_error_counter(int fd
,
38 struct lttng_kernel_counter_conf
*error_counter_conf
);
39 int kernctl_create_event_notifier(int fd
,
40 const struct lttng_kernel_event_notifier
*event_notifier
);
42 int kernctl_counter_read_value(int counter_fd
,
43 struct lttng_kernel_counter_read
*value
);
44 int kernctl_counter_get_aggregate_value(int counter_fd
,
45 struct lttng_kernel_counter_aggregate
*value
);
46 int kernctl_counter_clear(int counter_fd
,
47 struct lttng_kernel_counter_clear
*clear
);
49 int kernctl_counter_map_descriptor_count(int counter_fd
, uint64_t *count
);
50 int kernctl_counter_map_descriptor(int counter_fd
,
51 struct lttng_kernel_counter_map_descriptor
*descriptor
);
53 /* Apply on event file descriptor. */
54 int kernctl_filter(int fd
, const struct lttng_bytecode
*filter
);
55 int kernctl_add_callsite(int fd
, struct lttng_kernel_event_callsite
*callsite
);
56 int kernctl_capture(int fd
, const struct lttng_bytecode
*capture
);
58 int kernctl_tracepoint_list(int fd
);
59 int kernctl_syscall_list(int fd
);
60 int kernctl_tracer_version(int fd
, struct lttng_kernel_tracer_version
*v
);
61 int kernctl_tracer_abi_version(int fd
, struct lttng_kernel_tracer_abi_version
*v
);
62 int kernctl_wait_quiescent(int fd
);
65 * kernctl_syscall_mask - Get syscall mask associated to a channel file
68 * The parameter @syscall_mask should initially be either NULL or point
69 * to memory allocated with malloc(3) or realloc(3). When the function
70 * returns, it will point to a memory area of the size required for the
71 * bitmask (using realloc(3) to resize the memory).
73 * It returns 0 if OK, -1 on error. In all cases (error and OK),
74 * @syscall_mask should be freed by the caller with free(3).
76 int kernctl_syscall_mask(int fd
, char **syscall_mask
,
79 /* Process ID tracking can be applied to session file descriptor. */
80 int kernctl_track_pid(int fd
, int pid
);
81 int kernctl_untrack_pid(int fd
, int pid
);
82 int kernctl_list_tracker_pids(int fd
);
84 int kernctl_track_id(int fd
, enum lttng_process_attr process_attr
, int id
);
85 int kernctl_untrack_id(int fd
, enum lttng_process_attr process_attr
, int id
);
86 int kernctl_list_tracker_ids(int fd
, enum lttng_process_attr process_attr
);
88 int kernctl_session_regenerate_metadata(int fd
);
89 int kernctl_session_regenerate_statedump(int fd
);
90 int kernctl_session_set_name(int fd
, const char *name
);
91 int kernctl_session_set_creation_time(int fd
, time_t time
);
93 /* Buffer operations */
95 /* For mmap mode, readable without "get" operation */
96 int kernctl_get_mmap_len(int fd
, unsigned long *len
);
97 int kernctl_get_max_subbuf_size(int fd
, unsigned long *len
);
100 * For mmap mode, operate on the current packet (between get/put or
101 * get_next/put_next).
103 int kernctl_get_mmap_read_offset(int fd
, unsigned long *len
);
104 int kernctl_get_subbuf_size(int fd
, unsigned long *len
);
105 int kernctl_get_padded_subbuf_size(int fd
, unsigned long *len
);
107 int kernctl_get_next_subbuf(int fd
);
108 int kernctl_put_next_subbuf(int fd
);
111 int kernctl_snapshot(int fd
);
112 int kernctl_snapshot_sample_positions(int fd
);
113 int kernctl_snapshot_get_consumed(int fd
, unsigned long *pos
);
114 int kernctl_snapshot_get_produced(int fd
, unsigned long *pos
);
115 int kernctl_get_subbuf(int fd
, unsigned long *pos
);
116 int kernctl_put_subbuf(int fd
);
118 int kernctl_buffer_flush(int fd
);
119 int kernctl_buffer_flush_empty(int fd
);
120 int kernctl_buffer_clear(int fd
);
121 int kernctl_get_metadata_version(int fd
, uint64_t *version
);
122 int kernctl_metadata_cache_dump(int fd
);
123 int kernctl_get_next_subbuf_metadata_check(int fd
, bool *consistent
);
126 int kernctl_get_timestamp_begin(int fd
, uint64_t *timestamp_begin
);
127 int kernctl_get_timestamp_end(int fd
, uint64_t *timestamp_end
);
128 int kernctl_get_events_discarded(int fd
, uint64_t *events_discarded
);
129 int kernctl_get_content_size(int fd
, uint64_t *content_size
);
130 int kernctl_get_packet_size(int fd
, uint64_t *packet_size
);
131 int kernctl_get_stream_id(int fd
, uint64_t *stream_id
);
132 int kernctl_get_current_timestamp(int fd
, uint64_t *ts
);
133 int kernctl_get_sequence_number(int fd
, uint64_t *seq
);
134 int kernctl_get_instance_id(int fd
, uint64_t *seq
);
136 #endif /* _LTTNG_KERNEL_CTL_H */