Skip to content

Instantly share code, notes, and snippets.

@dramforever
Created August 30, 2025 20:45
Show Gist options
  • Save dramforever/2e7c3f0a485ba8a45facaec991d81eb1 to your computer and use it in GitHub Desktop.
Save dramforever/2e7c3f0a485ba8a45facaec991d81eb1 to your computer and use it in GitHub Desktop.
#ifndef __VMLINUX_H__
#define __VMLINUX_H__
#ifndef BPF_NO_PRESERVE_ACCESS_INDEX
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
#endif
/* 16-bit */
typedef short unsigned int __u16;
typedef __u16 __be16;
typedef __u16 umode_t;
/* 32-bit */
typedef int __s32;
typedef int pid_t;
typedef unsigned int __u32;
typedef __u32 __be32;
typedef __u32 u32;
typedef __u32 __wsum;
/* 64-bit */
typedef long long int __s64;
typedef long long unsigned int __u64;
typedef __u64 u64;
typedef __u64 uint64_t;
typedef long unsigned int size_t;
enum bpf_map_type {
BPF_MAP_TYPE_HASH = 1,
BPF_MAP_TYPE_CGROUP_ARRAY = 8,
BPF_MAP_TYPE_HASH_OF_MAPS = 13,
BPF_MAP_TYPE_RINGBUF = 27,
};
struct bpf_sysctl {
__u32 write;
};
struct user_namespace;
struct cred {
struct user_namespace *user_ns;
};
struct inode;
struct dentry {
struct inode *d_inode;
};
struct file {
struct inode *f_inode;
};
struct super_block;
struct inode {
struct super_block *i_sb;
};
struct mnt_namespace {
struct user_namespace *user_ns;
};
struct vfsmount {
};
struct mount {
struct vfsmount mnt;
struct mnt_namespace *mnt_ns;
int mnt_id;
};
struct ns_common {
unsigned int inum;
};
struct path {
struct vfsmount *mnt;
struct dentry *dentry;
};
struct super_block {
long unsigned int s_magic;
};
struct task_struct {
const struct cred *cred;
};
struct work_struct {
};
struct user_namespace {
struct user_namespace *parent;
struct ns_common ns;
struct work_struct work;
};
// TODO This is arm64 specific
struct user_pt_regs {
__u64 regs[31];
};
#ifndef BPF_NO_PRESERVE_ACCESS_INDEX
#pragma clang attribute pop
#endif
#endif /* __VMLINUX_H__ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment