Eunomia  0.1.0
A lightweight eBPF-based CloudNative Monitor tool for Container Security and Observability
trace_helpers.c File Reference
#include "helpers/trace_helpers.h"
#include <bpf/bpf.h>
#include <bpf/btf.h>
#include <bpf/libbpf.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <time.h>
#include <unistd.h>
#include "helpers/uprobe_helpers.h"
Include dependency graph for trace_helpers.c:

Classes

struct  ksyms
 
struct  load_range
 
struct  dso
 
struct  map
 
struct  syms
 
struct  syms_cache
 
struct  partitions
 

Macros

#define _GNU_SOURCE
 
#define min(x, y)
 
#define DISK_NAME_LEN   32
 
#define MINORBITS   20
 
#define MINORMASK   ((1U << MINORBITS) - 1)
 
#define MKDEV(ma, mi)   (((ma) << MINORBITS) | (mi))
 
#define STARTS_WITH(mapname, prefix)   (!strncmp(mapname, prefix, sizeof(prefix) - 1))
 

Enumerations

enum  elf_type {
  EXEC, DYN, PERF_MAP, VDSO,
  UNKNOWN
}
 

Functions

struct ksymsksyms__load (void)
 
void ksyms__free (struct ksyms *ksyms)
 
const struct ksymksyms__map_addr (const struct ksyms *ksyms, unsigned long addr)
 
const struct ksymksyms__get_symbol (const struct ksyms *ksyms, const char *name)
 
struct symssyms__load_file (const char *fname)
 
struct symssyms__load_pid (pid_t tgid)
 
void syms__free (struct syms *syms)
 
const struct symsyms__map_addr (const struct syms *syms, unsigned long addr)
 
struct syms_cachesyms_cache__new (int nr)
 
void syms_cache__free (struct syms_cache *syms_cache)
 
struct symssyms_cache__get_syms (struct syms_cache *syms_cache, int tgid)
 
struct partitionspartitions__load (void)
 
void partitions__free (struct partitions *partitions)
 
const struct partitionpartitions__get_by_dev (const struct partitions *partitions, unsigned int dev)
 
const struct partitionpartitions__get_by_name (const struct partitions *partitions, const char *name)
 
void print_log2_hist (unsigned int *vals, int vals_size, const char *val_type)
 
void print_linear_hist (unsigned int *vals, int vals_size, unsigned int base, unsigned int step, const char *val_type)
 
unsigned long long get_ktime_ns (void)
 
bool is_kernel_module (const char *name)
 
bool fentry_can_attach (const char *name, const char *mod)
 
bool kprobe_exists (const char *name)
 
bool vmlinux_btf_exists (void)
 
bool module_btf_exists (const char *mod)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ DISK_NAME_LEN

#define DISK_NAME_LEN   32

◆ min

#define min (   x,
 
)
Value:
({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void)(&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; \
})

◆ MINORBITS

#define MINORBITS   20

◆ MINORMASK

#define MINORMASK   ((1U << MINORBITS) - 1)

◆ MKDEV

#define MKDEV (   ma,
  mi 
)    (((ma) << MINORBITS) | (mi))

◆ STARTS_WITH

#define STARTS_WITH (   mapname,
  prefix 
)    (!strncmp(mapname, prefix, sizeof(prefix) - 1))

Enumeration Type Documentation

◆ elf_type

enum elf_type
Enumerator
EXEC 
DYN 
PERF_MAP 
VDSO 
UNKNOWN 

Function Documentation

◆ fentry_can_attach()

bool fentry_can_attach ( const char *  name,
const char *  mod 
)
Here is the call graph for this function:

◆ get_ktime_ns()

unsigned long long get_ktime_ns ( void  )

◆ is_kernel_module()

bool is_kernel_module ( const char *  name)

◆ kprobe_exists()

bool kprobe_exists ( const char *  name)

◆ ksyms__free()

void ksyms__free ( struct ksyms ksyms)

◆ ksyms__get_symbol()

const struct ksym* ksyms__get_symbol ( const struct ksyms ksyms,
const char *  name 
)

◆ ksyms__load()

struct ksyms* ksyms__load ( void  )

◆ ksyms__map_addr()

const struct ksym* ksyms__map_addr ( const struct ksyms ksyms,
unsigned long  addr 
)

◆ module_btf_exists()

bool module_btf_exists ( const char *  mod)
Here is the caller graph for this function:

◆ partitions__free()

void partitions__free ( struct partitions partitions)

◆ partitions__get_by_dev()

const struct partition* partitions__get_by_dev ( const struct partitions partitions,
unsigned int  dev 
)

◆ partitions__get_by_name()

const struct partition* partitions__get_by_name ( const struct partitions partitions,
const char *  name 
)

◆ partitions__load()

struct partitions* partitions__load ( void  )

◆ print_linear_hist()

void print_linear_hist ( unsigned int *  vals,
int  vals_size,
unsigned int  base,
unsigned int  step,
const char *  val_type 
)

◆ print_log2_hist()

void print_log2_hist ( unsigned int *  vals,
int  vals_size,
const char *  val_type 
)

◆ syms__free()

void syms__free ( struct syms syms)
Here is the caller graph for this function:

◆ syms__load_file()

struct syms* syms__load_file ( const char *  fname)
Here is the caller graph for this function:

◆ syms__load_pid()

struct syms* syms__load_pid ( pid_t  tgid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ syms__map_addr()

const struct sym* syms__map_addr ( const struct syms syms,
unsigned long  addr 
)

◆ syms_cache__free()

void syms_cache__free ( struct syms_cache syms_cache)
Here is the call graph for this function:

◆ syms_cache__get_syms()

struct syms* syms_cache__get_syms ( struct syms_cache syms_cache,
int  tgid 
)
Here is the call graph for this function:

◆ syms_cache__new()

struct syms_cache* syms_cache__new ( int  nr)

◆ vmlinux_btf_exists()

bool vmlinux_btf_exists ( void  )
Here is the caller graph for this function: