#include <stdio.h>
#include <err.h>
#include <errno.h>
#include <string.h>
#include <sysexits.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <syslog.h>
#include <stdarg.h>
#include <linux/limits.h>
#include <sys/sendfile.h>
#include <sys/utsname.h>
#include "motr/init.h"
#include "lib/uuid.h"
#include "lib/misc.h"
#include "lib/getopts.h"
#include "lib/thread.h"
#include "lib/user_space/types.h"
#include "lib/trace.h"
#include "lib/mutex.h"
#include "lib/cond.h"
#include "lib/trace_internal.h"
#include "module/instance.h"
Go to the source code of this file.
|
| #define | DEFAULT_IN_FILE_NAME "/sys/kernel/debug/motr/trace/buffer" |
| |
| #define | DEFAULT_OUT_FILE_NAME "/var/log/motr/m0trace.bin" |
| |
| #define | MOTR_KO_CORE_IN_FILE_NAME "/sys/kernel/debug/motr/core" |
| |
| #define | MOTR_KO_CORE_OUT_FILE_NAME "/var/log/motr/m0tr_ko.img" |
| |
| #define | log_err(fmt, ...) plog(LOG_ERR, fmt, ## __VA_ARGS__) |
| |
| #define | log_warn(fmt, ...) plog(LOG_WARNING, fmt, ## __VA_ARGS__) |
| |
| #define | log_info(fmt, ...) plog(LOG_INFO, fmt, ## __VA_ARGS__) |
| |
| #define | log_debug(fmt, ...) plog(LOG_DEBUG, fmt, ## __VA_ARGS__) |
| |
|
| static void | plog (int level, const char *format,...) __attribute__((format(printf |
| |
| void | sig_term_quit_int_handler (int signum, siginfo_t *siginfo, void *uctx) |
| |
| static const struct m0_trace_buf_header * | read_trace_buf_header (int ifd) |
| |
| static int | write_trace_header (const struct m0_trace_buf_header *header, int *ofd, const char *ofname) |
| |
| static int | write_trace_data (int *fd_ptr, const void *buf, size_t size) |
| |
| static const char * | get_cur_pos (const struct m0_trace_buf_header *logheader, const char *logbuf) |
| |
| static bool | is_log_rotation_needed (int *fd_ptr) |
| |
| static void | wake_up_rotator_thread (enum lr_action a) |
| |
| static int | rotate_original_log (struct rotator_ctx *rctx) |
| |
| static void | log_rotator_thread (struct rotator_ctx *rctx) |
| |
| static int | process_trace_buffer (int *ofd_ptr, const struct m0_trace_buf_header *logheader, const char *logbuf) |
| |
| static int | init_log_names (void) |
| |
| int | save_kore_file (void) |
| |
| int | main (int argc, char *argv[]) |
| |