We'd like to record all the open file descriptors in a process. Windows minidumps populate the MINIDUMP_HANDLE_DATA_STREAM for this purpose and I'm adding support to rust-minidump for it, see rust-minidump/rust-minidump#885
The idea is to repurpose this stream to capture Linux fd information by storing the contents of /proc/<pid>/fd. Every entry in the stream would be a MINIDUMP_HANDLE_DESCRIPTOR with the following fields set:
handle would contain the fd number
object_name_rva would point to a string holding the file path
attributes would hold the contents of the st_mode field of the stat structure
- All other fields would be zero
This would lose some information (e.g. number of hardlinks, UID/GID, etc...) but keep most of what interests us. In case we need it in the future we could extend this information with a custom MINIDUMP_HANDLE_OBJECT_INFORMATION structure that holds the missing bits (note that I'm reluctant to repurpose the other fields of MINIDUMP_HANDLE_DESCRIPTOR for these bits as IMHO it would be confusing).
We'd like to record all the open file descriptors in a process. Windows minidumps populate the
MINIDUMP_HANDLE_DATA_STREAMfor this purpose and I'm adding support to rust-minidump for it, see rust-minidump/rust-minidump#885The idea is to repurpose this stream to capture Linux fd information by storing the contents of
/proc/<pid>/fd. Every entry in the stream would be aMINIDUMP_HANDLE_DESCRIPTORwith the following fields set:handlewould contain the fd numberobject_name_rvawould point to a string holding the file pathattributeswould hold the contents of thest_modefield of thestatstructureThis would lose some information (e.g. number of hardlinks, UID/GID, etc...) but keep most of what interests us. In case we need it in the future we could extend this information with a custom
MINIDUMP_HANDLE_OBJECT_INFORMATIONstructure that holds the missing bits (note that I'm reluctant to repurpose the other fields ofMINIDUMP_HANDLE_DESCRIPTORfor these bits as IMHO it would be confusing).