2016-11-16 18:06:48 +03:00
|
|
|
#ifndef COMPEL_PLUGIN_STD_LOG_H__
|
|
|
|
#define COMPEL_PLUGIN_STD_LOG_H__
|
|
|
|
|
2019-07-25 23:01:07 +01:00
|
|
|
#include "compel/loglevels.h"
|
2019-11-09 22:20:45 +00:00
|
|
|
#include "common/compiler.h"
|
2019-07-25 23:01:07 +01:00
|
|
|
|
2021-07-19 07:39:51 +00:00
|
|
|
#define STD_LOG_SIMPLE_CHUNK 256
|
2016-11-16 18:06:48 +03:00
|
|
|
|
|
|
|
extern void std_log_set_fd(int fd);
|
2019-07-25 23:01:07 +01:00
|
|
|
extern void std_log_set_loglevel(enum __compel_log_levels level);
|
2016-11-16 18:06:49 +03:00
|
|
|
extern void std_log_set_start(struct timeval *tv);
|
2019-07-25 23:01:08 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Provides a function to get time *in the infected task* for log timings.
|
|
|
|
* Expected use-case: address on the vdso page to get time.
|
|
|
|
* If not set or called with NULL - compel will use raw syscall,
|
|
|
|
* which requires enter in the kernel and as a result affects performance.
|
|
|
|
*/
|
|
|
|
typedef int (*gettimeofday_t)(struct timeval *tv, struct timezone *tz);
|
|
|
|
extern void std_log_set_gettimeofday(gettimeofday_t gtod);
|
|
|
|
/* std plugin helper to get time (hopefully, efficiently) */
|
|
|
|
extern int std_gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
|
|
|
2016-11-16 18:06:48 +03:00
|
|
|
extern int std_vprint_num(char *buf, int blen, int num, char **ps);
|
|
|
|
extern void std_sprintf(char output[STD_LOG_SIMPLE_CHUNK], const char *format, ...)
|
2021-07-19 07:39:51 +00:00
|
|
|
__attribute__((__format__(__printf__, 2, 3)));
|
2016-11-16 18:06:48 +03:00
|
|
|
extern void print_on_level(unsigned int loglevel, const char *format, ...)
|
2021-07-19 07:39:51 +00:00
|
|
|
__attribute__((__format__(__printf__, 2, 3)));
|
2016-11-16 18:06:48 +03:00
|
|
|
|
|
|
|
#endif /* COMPEL_PLUGIN_STD_LOG_H__ */
|