File: log.h

package info (click to toggle)
criu 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,500 kB
  • sloc: ansic: 139,280; python: 7,484; sh: 3,824; java: 2,799; makefile: 2,659; asm: 1,137; perl: 206; xml: 117; exp: 45
file content (30 lines) | stat: -rw-r--r-- 1,225 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef COMPEL_PLUGIN_STD_LOG_H__
#define COMPEL_PLUGIN_STD_LOG_H__

#include "compel/loglevels.h"
#include "common/compiler.h"

#define STD_LOG_SIMPLE_CHUNK 256

extern void std_log_set_fd(int fd);
extern void std_log_set_loglevel(enum __compel_log_levels level);
extern void std_log_set_start(struct timeval *tv);

/*
 * 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);

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, ...)
	__attribute__((__format__(__printf__, 2, 3)));
extern void print_on_level(unsigned int loglevel, const char *format, ...)
	__attribute__((__format__(__printf__, 2, 3)));

#endif /* COMPEL_PLUGIN_STD_LOG_H__ */