Skip to content

Commit 217e760

Browse files
committed
docs: Fix decorators page in user-guide
1 parent 06c81ae commit 217e760

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

docs/user-guide/decorators.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def count_clones(ctx: c_void_p) -> c_int64:
181181
process_count.update(process_id, count + 1)
182182
else:
183183
process_count.update(process_id, c_uint64(1))
184-
return c_int64(0)
184+
return 0
185185
```
186186

187187
See {doc}`maps` for more details on available map types.
@@ -208,7 +208,7 @@ class Event:
208208

209209
Structs allow you to define custom data types for use in BPF programs. They can be used:
210210

211-
* As map values
211+
* As map keys and values
212212
* For perf event output
213213
* In ring buffer submissions
214214
* As local variables
@@ -248,11 +248,10 @@ def track_processes(ctx: c_void_p) -> c_int64:
248248
event = ProcessEvent()
249249
event.timestamp = ktime()
250250
event.pid = pid()
251-
# Note: comm() requires a buffer parameter
252-
# comm(event.comm) # Fills event.comm with process name
251+
comm(event.comm) # Fills event.comm with process name
253252

254253
events.output(event)
255-
return c_int64(0)
254+
return 0
256255
```
257256

258257
See {doc}`structs` for more details on working with structs.
@@ -392,9 +391,7 @@ def LICENSE() -> str:
392391

393392
1. **Always use @bpf first** - It must be the outermost decorator
394393
2. **Provide type hints** - Required for proper code generation
395-
3. **Use descriptive names** - Makes code easier to understand and debug
396-
4. **Keep functions simple** - BPF has restrictions on complexity
397-
5. **Test incrementally** - Verify each component works before combining
394+
3. **Test incrementally** - Verify each component works before combining
398395

399396
## Common Errors
400397

0 commit comments

Comments
 (0)