File: plugin_net.c

package info (click to toggle)
libtraceevent 1%3A1.8.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,040 kB
  • sloc: ansic: 13,380; makefile: 671; sh: 85
file content (94 lines) | stat: -rw-r--r-- 2,623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// SPDX-License-Identifier: LGPL-2.1
#include <stdint.h>

#include "event-parse.h"
#include "trace-seq.h"

static unsigned long long
process_builtin_constant_p(struct trace_seq *s, unsigned long long *args)
{
	return 0;
}

static unsigned long long
process_builtin_bswap16(struct trace_seq *s, unsigned long long *args)
{
	return __builtin_bswap16((uint16_t)args[0]);
}

static unsigned long long
process_builtin_bswap32(struct trace_seq *s, unsigned long long *args)
{
	return __builtin_bswap32((uint32_t)args[0]);
}

static unsigned long long
process_builtin_bswap64(struct trace_seq *s, unsigned long long *args)
{
	return __builtin_bswap64(args[0]);
}

int TEP_PLUGIN_LOADER(struct tep_handle *tep)
{
	tep_register_print_function(tep,
				    process_builtin_constant_p,
				    TEP_FUNC_ARG_INT,
				    "__builtin_constant_p",
				    TEP_FUNC_ARG_INT,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap16,
				    TEP_FUNC_ARG_INT,
				    "__fswab16",
				    TEP_FUNC_ARG_INT,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap16,
				    TEP_FUNC_ARG_INT,
				    "__builtin_bswap16",
				    TEP_FUNC_ARG_INT,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap32,
				    TEP_FUNC_ARG_INT,
				    "__fswab32",
				    TEP_FUNC_ARG_INT,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap32,
				    TEP_FUNC_ARG_INT,
				    "__builtin_bswap32",
				    TEP_FUNC_ARG_INT,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap64,
				    TEP_FUNC_ARG_LONG,
				    "__fswab64",
				    TEP_FUNC_ARG_LONG,
				    TEP_FUNC_ARG_VOID);
	tep_register_print_function(tep,
				    process_builtin_bswap64,
				    TEP_FUNC_ARG_LONG,
				    "__builtin_bswap64",
				    TEP_FUNC_ARG_LONG,
				    TEP_FUNC_ARG_VOID);
	return 0;
}

void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
{
	tep_unregister_print_function(tep, process_builtin_constant_p,
				      "__builtin_constant_p");
	tep_unregister_print_function(tep, process_builtin_bswap16,
				      "__fswab16");
	tep_unregister_print_function(tep, process_builtin_bswap16,
				      "__builtin_bswap16");
	tep_unregister_print_function(tep, process_builtin_bswap32,
				      "__fswab32");
	tep_unregister_print_function(tep, process_builtin_bswap32,
				      "__builtin_bswap32");
	tep_unregister_print_function(tep, process_builtin_bswap64,
				      "__fswab64");
	tep_unregister_print_function(tep, process_builtin_bswap64,
				      "__builtin_bswap64");
}