# libtracefs(3) Manual Page

## NAME

tracefs_error_last, tracefs_error_all, tracefs_error_clear - functions to read and clear the tracefs error log.

## SYNOPSIS

    #include <tracefs.h>

    char *tracefs_error_last(struct tracefs_instance *instance);
    char *tracefs_error_all(struct tracefs_instance *instance);
    int tracefs_error_clear(struct tracefs_instance *instance);

## DESCRIPTION

The tracefs_error_last() returns the last error message in the tracefs error log. Several actions that require proper syntax written into the tracefs file system may produce error messages in the error log. This function will show the most recent error in the error log.

The tracefs_error_all() returns all messages saved in the error log. Note, this may not be all messages that were ever produced, as the kernel only keeps a limited amount of messages, and older ones may be discarded by the kernel.

The tracefs_error_clear() will clear the error log.

## RETURN VALUE

Both tracefs_error_last() and tracefs_error_all() will return an allocated string an error exists in the log, otherwise NULL is returned. If an error occurs, errno will be set, otherwise if there is no error messages to display then errno is not touched.

tracefs_error_clear() returns 0 on success or -1 on error.

## EXAMPLE

## FILES

    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

libtracefs(3), libtraceevent(3), trace-cmd(1)

## AUTHOR

    Steven Rostedt <rostedt@goodmis.org>
    Tzvetomir Stoyanov <tz.stoyanov@gmail.com>

## REPORTING BUGS

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

## LICENSE

libtracefs is Free Software licensed under the GNU LGPL 2.1

## RESOURCES

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

## COPYING

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