sysprofd: add API to get a FD for a file in proc

This is useful for optimized parsing of proc files such as necessary by
the memory source to seek() back to the start (instead of re-opening a
new file).
This commit is contained in:
Christian Hergert
2019-05-12 16:06:02 -07:00
parent 16bc6f970e
commit 9d72203687
6 changed files with 142 additions and 1 deletions

View File

@ -27,7 +27,7 @@
GetProcFile:
@path: the path including "/proc/" prefix.
Gets a file from /proc.
Gets a file from /proc/ or /sys/.
The file must be a C-string (no embedded NUL bytes) but need not be UTF-8.
@ -40,6 +40,24 @@
<arg name="contents" type="ay" direction="out"/>
</method>
<!--
GetProcFd:
@path: the path within /proc or /sys
Like GetProcFile, but returns a FD for the file.
This is useful for situations where you need to seek() back to 0 to
optimize the parsing of the file contents.
Returns: a file-descriptor
Since: 3.34
-->
<method name="GetProcFd">
<arg name="path" type="ay" direction="in"/>
<arg name="fd" type="h" direction="out"/>
</method>
<!--
ListProcesses: