zmitchell / proctrace

A high-level profiler for process-level events such as fork, exec, exit, setpgid, and setsid
https://proctrace.xyz
Apache License 2.0
26 stars 0 forks source link

File descriptor accounting #3

Open zmitchell opened 1 week ago

zmitchell commented 1 week ago

It would be convenient if proctrace could keep track of which file descriptors were open at which points in time, including which ones were inherited via a fork.

Monitoring open and close syscalls is pretty straightforward, but determining which fds were inherited is less straightforward. I think you find the file table through the $cur_task builtin variable, but it seems like in the actual kernel you're supposed to do this while holding some kind of lock, and we don't have that lock.