Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


tracefs_binary_init(3) — Linux manual page

NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |EXAMPLE |FILES |SEE ALSO |AUTHOR |REPORTING BUGS |LICENSE |RESOURCES |COPYING |NOTES |COLOPHON

LIBTRACEFS(3)               libtracefs ManualLIBTRACEFS(3)

NAME        top

       tracefs_binary_init, tracefs_binary_close, tracefs_binary_write -       Open, close and write binary data in the trace buffer.

SYNOPSIS        top

#include <tracefs.h>       inttracefs_binary_init(struct tracefs_instance *instance);       inttracefs_binary_write(struct tracefs_instance *instance, void *data, intlen);       voidtracefs_binary_close(struct tracefs_instance *instance);

DESCRIPTION        top

       Set of functions to write binary data in the trace buffer. See       Documentation/trace/ftrace.rst from the Linux kernel tree for more       information about writing data from user space in the trace       buffer. All these APIs haveinstance as a first argument. If NULL       is passed asinstance, the top trace instance is used.       Thetracefs_binary_init()function initializes the library for       writing into the trace buffer of the selectedinstance. It is not       mandatory to call this API before writing data, thetracefs_binary_write()will call it automatically, if the library       is not yet initialized. But callingtracefs_binary_init()in       advance will speed up the writing.       Thetracefs_binary_write()function writes a binary data in the       trace buffer of the selectedinstance. Thedata points to the data       with lengthlen, that is going to be written in the trace buffer.       Thetracefs_binary_close()function closes the resources, used by       the library for writing in the trace buffer of the selected       instance.

RETURN VALUE        top

       Thetracefs_binary_init(), andtracefs_binary_write()functions       return 0 if the operation is successful, or -1 in case of an       error.

EXAMPLE        top

           #include <tracefs.h>           if (tracefs_binary_init(NULL) < 0) {            /* Failed to initialize the library for writing in the trace buffer of the top trace instance */           }           unsigned int data = 0xdeadbeef;                   if (tracefs_binary_write(NULL, &data, sizeof(data)) < 0) {                           /* Failed to write in the trace buffer */                   }           tracefs_binary_close();

FILES        top

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.

SEE ALSO        top

libtracefs(3),libtraceevent(3),trace-cmd(1),       Documentation/trace/ftrace.rst from the Linux kernel tree

AUTHOR        top

Steven Rostedt<rostedt@goodmis.org[1]>Tzvetomir Stoyanov<tz.stoyanov@gmail.com[2]>

REPORTING BUGS        top

       Report bugs to <linux-trace-devel@vger.kernel.org[3]>

LICENSE        top

       libtracefs is Free Software licensed under the GNU LGPL 2.1

RESOURCES        top

https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/

COPYING        top

       Copyright (C) 2021 VMware, Inc. Free use of this software is       granted under the terms of the GNU Public License (GPL).

NOTES        top

        1. rostedt@goodmis.org           mailto:rostedt@goodmis.org        2. tz.stoyanov@gmail.com           mailto:tz.stoyanov@gmail.com        3. linux-trace-devel@vger.kernel.org           mailto:linux-trace-devel@vger.kernel.org

COLOPHON        top

       This page is part of thelibtracefs (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       2025-08-11.  (At that time, the date of the most recent commit       that was found in the repository was 2025-06-02.)  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 isnot part of the original manual page), send a       mail to man-pages@man7.orglibtracefs 1.7.0                12/22/2023LIBTRACEFS(3)


HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp