tracefs_kprobe_alloc() allocates a new kprobe context. The kbrobe
is not configured in the system. The kprobe can be added to the
system by passing in the returned descriptor into
tracefs_dynevent_create(3). The new kprobe will be in the system
group (or kprobes if system is NULL) and have the name of event
(or addr if event is NULL). The kprobe will be inserted to addr
(function name, with or without offset, or a address), and the
format will define the format of the kprobe. See the Linux
documentation file under: Documentation/trace/kprobetrace.rst
tracefs_kretprobe_alloc() is the same as tracefs_kprobe_alloc,
but allocates context for kretprobe. It has one additional
parameter, which is optional, max - maxactive count. See
description of kretprobes in the
Documentation/trace/kprobetrace.rst file.
tracefs_kprobe_raw() will create a kprobe event. If system is
NULL, then the default "kprobes" is used for the group (event
system). Otherwise if system is specified then the kprobe will be
created under the group by that name. The event is the name of
the kprobe event to create. The addr can be a function, a
function and offset, or a kernel address. This is where the
location of the kprobe will be inserted in the kernel. The format
is the kprobe format as specified as FETCHARGS in the Linux
kernel source in the Documentation/trace/kprobetrace.rst
document.
tracefs_kretprobe_raw() is the same as tracefs_kprobe_raw(),
except that it creates a kretprobe instead of a kprobe. The
difference is also described in the Linux kernel source in the
Documentation/trace/kprobetrace.rst file.
tracefs_kprobe_destroy() will destroy a specific kprobe or
kretprobe created by tracefs_kprobe_raw() or
tracefs_kretprobe_raw() with the same parameters.
ЗНАЧЕНИЕ, ВОЗВРАЩАЕМОЕ ФУНКЦИЕЙ
tracefs_kprobe_raw() and tracefs_kretprobe_raw() return 0 on
success, or -1 on error. If a parsing error occurs on
tracefs_kprobe_raw() or tracefs_kretprobe_raw() then
tracefs_error_last(3) may be used to retrieve the error message
explaining the parsing issue.
The tracefs_kprobe_alloc() and tracefs_kretprobe_alloc() APIs
return a pointer to an allocated tracefs_dynevent structure,
describing the probe. This pointer must be freed by
tracefs_dynevent_free(3). Note, this only allocates a descriptor
representing the kprobe. It does not modify the running system.
The tracefs_kprobe_destroy() returns 0 on success or -1 on error
if it was not able to successful destory (or find) the kprobe or
kretprobe.
ОШИБКИ
The following errors are for all the above calls:
EPERM Not run as root user
ENODEV Kprobe events are not configured for the running kernel.
ENOMEM Memory allocation error.
tracefs_kprobe_raw(), tracefs_kretprobe_raw(),
tracefs_kprobe_alloc(), and tracefs_kretprobe_alloc() can fail
with the following errors:
EBADMSG if addr is NULL.
EINVAL Most likely a parsing error occurred (use
tracefs_error_last(3) to possibly see what that error was).
Other errors may also happen caused by internal system calls.
tracefs.h
Header file to include in order to have access to the library APIs.
-ltracefs
Linker switch to add when building a program that uses the library.
This page is part of the libtracefs (Linux kernel trace file
system library) project. Information about the project can be
found at ⟨https://www.trace-cmd.org/⟩. If you have a bug report
for this manual page, see ⟨https://www.trace-cmd.org/⟩. This
page was obtained from the project's upstream Git repository
⟨https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git⟩ on
2024-06-14. (At that time, the date of the most recent commit
that was found in the repository was 2024-05-17.) If you
discover any rendering problems in this HTML version of the page,
or you believe there is a better or more up-to-date source for
the page, or you have corrections or improvements to the
information in this COLOPHON (which is not part of the original
manual page), send a mail to man-pages@man7.org
libtracefs 1.7.0 12/22/2023 LIBTRACEFS(3)