trace.c (876f7a438e4247a948268ad77b67c494f709cc30) trace.c (1a6229096bb501495442ab47761d746c1ae791e1)
1// SPDX-License-Identifier: GPL-2.0
2#define _GNU_SOURCE
3#include <sys/sendfile.h>
4#include <tracefs.h>
5#include <signal.h>
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>

--- 6 unchanged lines hidden (view full) ---

15 */
16int enable_tracer_by_name(struct tracefs_instance *inst, const char *tracer_name)
17{
18 enum tracefs_tracers tracer;
19 int retval;
20
21 tracer = TRACEFS_TRACER_CUSTOM;
22
1// SPDX-License-Identifier: GPL-2.0
2#define _GNU_SOURCE
3#include <sys/sendfile.h>
4#include <tracefs.h>
5#include <signal.h>
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>

--- 6 unchanged lines hidden (view full) ---

15 */
16int enable_tracer_by_name(struct tracefs_instance *inst, const char *tracer_name)
17{
18 enum tracefs_tracers tracer;
19 int retval;
20
21 tracer = TRACEFS_TRACER_CUSTOM;
22
23 debug_msg("enabling %s tracer\n", tracer_name);
23 debug_msg("Enabling %s tracer\n", tracer_name);
24
25 retval = tracefs_tracer_set(inst, tracer, tracer_name);
26 if (retval < 0) {
27 if (errno == ENODEV)
24
25 retval = tracefs_tracer_set(inst, tracer, tracer_name);
26 if (retval < 0) {
27 if (errno == ENODEV)
28 err_msg("tracer %s not found!\n", tracer_name);
28 err_msg("Tracer %s not found!\n", tracer_name);
29
29
30 err_msg("failed to enable the tracer %s\n", tracer_name);
30 err_msg("Failed to enable the %s tracer\n", tracer_name);
31 return -1;
32 }
33
34 return 0;
35}
36
37/*
38 * disable_tracer - set nop tracer to the insta
39 */
40void disable_tracer(struct tracefs_instance *inst)
41{
42 enum tracefs_tracers t = TRACEFS_TRACER_NOP;
43 int retval;
44
45 retval = tracefs_tracer_set(inst, t);
46 if (retval < 0)
31 return -1;
32 }
33
34 return 0;
35}
36
37/*
38 * disable_tracer - set nop tracer to the insta
39 */
40void disable_tracer(struct tracefs_instance *inst)
41{
42 enum tracefs_tracers t = TRACEFS_TRACER_NOP;
43 int retval;
44
45 retval = tracefs_tracer_set(inst, t);
46 if (retval < 0)
47 err_msg("oops, error disabling tracer\n");
47 err_msg("Oops, error disabling tracer\n");
48}
49
50/*
51 * create_instance - create a trace instance with *instance_name
52 */
53struct tracefs_instance *create_instance(char *instance_name)
54{
55 return tracefs_instance_create(instance_name);

--- 137 unchanged lines hidden ---
48}
49
50/*
51 * create_instance - create a trace instance with *instance_name
52 */
53struct tracefs_instance *create_instance(char *instance_name)
54{
55 return tracefs_instance_create(instance_name);

--- 137 unchanged lines hidden ---