Skip to content

Commit

Permalink
tetragon: Use FUNC_INLINE in sensors code
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
olsajiri committed May 22, 2024
1 parent 10b749e commit 4f4d24d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions bpf/process/bpf_enforcer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

static inline __attribute__((always_inline)) int
do_enforcer(void *ctx)
FUNC_INLINE int do_enforcer(void *ctx)
{
__u64 id = get_current_pid_tgid();
struct enforcer_data *data;
Expand Down
10 changes: 5 additions & 5 deletions bpf/process/bpf_execve_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct {
__type(value, struct msg_data);
} data_heap SEC(".maps");

static inline __attribute__((always_inline)) __u32
FUNC_INLINE __u32
read_args(void *ctx, struct msg_execve_event *event)
{
struct task_struct *task = (struct task_struct *)get_current_task();
Expand Down Expand Up @@ -96,7 +96,7 @@ read_args(void *ctx, struct msg_execve_event *event)
return size;
}

static inline __attribute__((always_inline)) __u32
FUNC_INLINE __u32
read_path(void *ctx, struct msg_execve_event *event, void *filename)
{
struct msg_process *p = &event->process;
Expand Down Expand Up @@ -124,15 +124,15 @@ read_path(void *ctx, struct msg_execve_event *event, void *filename)
return size;
}

static inline __attribute__((always_inline)) __u32
FUNC_INLINE __u32
read_cwd(void *ctx, struct msg_process *p)
{
if (p->flags & EVENT_ERROR_CWD)
return 0;
return getcwd(p, p->size, p->pid);
}

static inline __attribute__((always_inline)) void
FUNC_INLINE void
read_execve_shared_info(void *ctx, struct msg_process *p, __u64 pid)
{
struct execve_info *info;
Expand Down Expand Up @@ -161,7 +161,7 @@ read_execve_shared_info(void *ctx, struct msg_process *p, __u64 pid)
* one remaining thread at its exit path.
*/
#ifdef __LARGE_BPF_PROG
static inline __attribute__((always_inline)) __u32
FUNC_INLINE __u32
read_exe(struct task_struct *task, struct heap_exe *exe)
{
struct file *file = BPF_CORE_READ(task, mm, exe_file);
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_generic_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct {
__type(value, struct event_config);
} config_map SEC(".maps");

static inline __attribute__((always_inline)) int
FUNC_INLINE int
generic_kprobe_start_process_filter(void *ctx)
{
struct msg_generic_kprobe *msg;
Expand Down
3 changes: 1 addition & 2 deletions bpf/process/bpf_generic_tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ struct generic_tracepoint_event_arg {
/* tracepoint specific fields ... */
};

static inline __attribute__((always_inline)) unsigned long get_ctx_ul(void *src,
int type)
FUNC_INLINE unsigned long get_ctx_ul(void *src, int type)
{
switch (type) {
case syscall64_type:
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_generic_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct {
__type(value, struct event_config);
} config_map SEC(".maps");

static inline __attribute__((always_inline)) int
FUNC_INLINE int
generic_uprobe_start_process_filter(void *ctx)
{
struct msg_generic_kprobe *msg;
Expand Down

0 comments on commit 4f4d24d

Please sign in to comment.