Commit Graph

111 Commits

Author SHA1 Message Date
bc56dd821a Examples: Let bpfsnake draw in the terminal with --terminal
Both front ends share one Game that queues turns, drives the kernel's
tick and reads the maps back. The terminal one reads keys in cbreak mode
(an arrow's last byte is already the kernel's key code) and draws on the
alternate screen, so it needs no pygame; pygame is imported only for the
window.
2026-09-25 18:53:00 +05:30
851c7efea4 Examples: Draw bpfsnake with pygame and steer it from the window
A pygame window takes the keyboard from the terminal, so the pty_write
probe would never see a key. Python writes the key code into the state
map instead, one queued turn per tick, ignoring reversals. The board
grows to 20x30 with food anywhere inside the walls, and the snake to 32.
2026-09-25 18:45:09 +05:30
cba2c894b3 Examples: Port bpfsnake, the game logic in eBPF and the board in Python 2026-09-25 18:25:54 +05:30
ad6adb14c9 x 2026-09-25 10:26:22 +05:30
749b06020d move examples to examples folder 2025-12-08 21:39:50 +05:30
76a873cb0d Update clone-matplotlib example 2025-10-22 21:47:16 +05:30
cb1ad15f43 Fix examples/clone_plot to use new syntax and pylibbpf API 2025-10-22 20:54:59 +05:30
beaad996db Fix map access syntax in examples/xdp_pass 2025-10-22 20:07:38 +05:30
99b92e44e3 Fix exapmles/kprobes to use latest pylibbpf 2025-10-22 20:04:02 +05:30
ce7adaadb6 Fix examples/hello_world to use latest pylibbpf 2025-10-22 19:57:47 +05:30
5ac316a1ac Fix examples/binops_demo.py syntax 2025-10-22 19:52:23 +05:30
abbf17748d format chore 2025-10-11 21:34:28 +05:30
b95fbd0ed0 rollback example 2025-10-08 14:53:51 +05:30
d84ce0c6fa update helpers and change examples. 2025-10-08 13:57:09 +05:30
8d07a4cd05 add xdp struct to args
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-10-08 11:40:12 +05:30
1207730ce3 update vmlinux.py 2025-10-08 05:27:56 +05:30
8a69e05ee2 fix duplicate variable in example
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-10-08 05:18:49 +05:30
976af290af Revert "format chore"
This reverts commit a3443ab1d5.
2025-10-08 05:17:59 +05:30
a3443ab1d5 format chore
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-10-08 05:16:36 +05:30
a27360482b complete vmlinux transpiler.
TODO: struct_kioctx for x86_64 vmlinux.h has anonymous structs that refused to transpile well, so an extra rule has been written to make only the structs of that external. Fix this in the future.
2025-10-08 05:15:29 +05:30
86b9ec56d7 update formatter and pre-commit
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-10-02 22:43:05 +05:30
9dbca410c2 Remove calls from map in sys_sync 2025-10-02 21:24:15 +05:30
1a66887f48 move helper annotations to helpers module 2025-10-02 01:55:32 +05:30
59b3d6514b fix ruff errors 2025-10-02 01:23:55 +05:30
6831f11179 Fix fstrings in examples, add alternate map attr access 2025-10-02 00:22:59 +05:30
c38ecf6623 Merge branch 'master' into helper-refactor 2025-10-02 00:06:19 +05:30
8d9ff2df3b Fix import in sys_sync example 2025-10-01 18:28:40 +05:30
c27da22bcb remove ruff errors. May contain breaking changes. 2025-10-01 00:54:04 +05:30
8d5067996f format chore and pre commit hook addition 2025-10-01 00:41:00 +05:30
7e45864552 Move helper scripts to a new dir, make temp fixes to allow this 2025-09-30 23:57:31 +05:30
0d0a318e46 cleanup and rename 2025-09-30 21:05:07 +05:30
af004cb864 janitorial 2025-09-30 20:09:04 +05:30
d943b78a25 Add __init__ to maps to improve imports 2025-09-30 19:51:28 +05:30
cbc6b93cd8 restructure maps dir, fix imports 2025-09-30 19:01:46 +05:30
de5cc438ab Allow access from struct fields 2025-09-26 23:02:51 +05:30
0f365be65e Add some support for strings in structs 2025-09-26 18:26:07 +05:30
4ebf0480dd tweak commit to add placeholder string 2025-09-26 04:54:01 +05:30
b9ddecd6b1 Add string as a primitve to struct defs 2025-09-26 04:44:38 +05:30
737c4d3039 Support storing and printing string type 2025-09-26 04:17:29 +05:30
35969c4ff7 Add string example 2025-09-25 22:15:14 +05:30
9e87ee52f2 Move relevant vmlinux files to ex7.bpf.c 2025-09-25 00:10:39 +05:30
d0be8893eb Add setuid C example 2025-09-24 23:48:42 +05:30
69a86c2433 Add perf_event_output boilerplate 2025-09-21 15:14:55 +05:30
0f9a4078ee Complete struct field assignment 2025-09-21 05:22:00 +05:30
36c2c0b695 Add struct malloc, add struct instantiation to example 2025-09-21 04:48:50 +05:30
8e231845ef Add struct example and decorator 2025-09-21 03:01:13 +05:30
a124476583 big overhaul of debug info and params passed to maps 2025-09-20 04:30:08 +05:30
73862f0084 Make max_entries optional in map BTF, add PerfEventArray to execve5 2025-09-20 03:15:09 +05:30
b0f18229d9 Add PID helper 2025-09-19 22:58:16 +05:30
95727e3374 init execve5.py to emulate ex6.bpf.c 2025-09-19 22:35:47 +05:30