e81ee309e7e91527861eb6090475ba645f814bbd
[lttng-tools.git] / src / common / tracker.h
1 /*
2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 *
7 */
8
9 #ifndef LTTNG_COMMON_TRACKER_H
10 #define LTTNG_COMMON_TRACKER_H
11
12 #include <lttng/lttng-error.h>
13 #include <lttng/tracker.h>
14
15 #include <common/buffer-view.h>
16 #include <common/dynamic-array.h>
17 #include <common/macros.h>
18 #include <common/sessiond-comm/sessiond-comm.h>
19
20 #if defined(__cplusplus)
21 extern "C" {
22 #endif
23
24 struct process_attr_value {
25 enum lttng_process_attr_value_type type;
26 union value {
27 pid_t pid;
28 uid_t uid;
29 char *user_name;
30 gid_t gid;
31 char *group_name;
32 } value;
33 };
34
35 struct lttng_process_attr_values {
36 /* Array of struct process_attr_tracker_value. */
37 struct lttng_dynamic_pointer_array array;
38 };
39
40 const char *lttng_process_attr_to_string(enum lttng_process_attr process_attr);
41
42 struct lttng_process_attr_values *lttng_process_attr_values_create(void);
43
44 /* Prefixed with '_' since the name conflicts with a public API. */
45 unsigned int _lttng_process_attr_values_get_count(
46 const struct lttng_process_attr_values *values);
47
48 const struct process_attr_value *lttng_process_attr_tracker_values_get_at_index(
49 const struct lttng_process_attr_values *values,
50 unsigned int index);
51
52 int lttng_process_attr_values_serialize(
53 const struct lttng_process_attr_values *values,
54 struct lttng_dynamic_buffer *buffer);
55
56 ssize_t lttng_process_attr_values_create_from_buffer(
57 enum lttng_domain_type domain,
58 enum lttng_process_attr process_attr,
59 const struct lttng_buffer_view *buffer_view,
60 struct lttng_process_attr_values **_values);
61
62 void lttng_process_attr_values_destroy(
63 struct lttng_process_attr_values *values);
64
65 struct process_attr_value *process_attr_value_copy(
66 const struct process_attr_value *value);
67
68 unsigned long process_attr_value_hash(const struct process_attr_value *a);
69
70 bool process_attr_tracker_value_equal(const struct process_attr_value *a,
71 const struct process_attr_value *b);
72
73 void process_attr_value_destroy(struct process_attr_value *value);
74
75 enum lttng_error_code process_attr_value_from_comm(
76 enum lttng_domain_type domain,
77 enum lttng_process_attr process_attr,
78 enum lttng_process_attr_value_type value_type,
79 const struct process_attr_integral_value_comm *integral_value,
80 const struct lttng_buffer_view *value_view,
81 struct process_attr_value **value);
82
83 #if defined(__cplusplus)
84 }
85 #endif
86
87 #endif /* LTTNG_COMMON_TRACKER_H */
This page took 0.032668 seconds and 3 git commands to generate.