You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...thanks to /proc/pid/fdinfo we can determine those as well: https://lwn.net/Articles/268728/
File position is easy to get. As for file mode, fdinfo file provides a flags octal number which can be converted with int(flags, 8). We need to convert that number by using O_* flags (os.O_RDONLY, os.O_WRONLY, os.O_RDWR, os.O_APPEND, ...) and turn that into a human readable mode string ("r", "w", "a", etc.).
The text was updated successfully, but these errors were encountered:
giampaolo
changed the title
(Linux) Process.open_files can return file position and mode
(Linux) Process.open_files can return file position and mode and flags
Feb 27, 2016
...thanks to /proc/pid/fdinfo we can determine those as well: https://lwn.net/Articles/268728/
File position is easy to get. As for file mode, fdinfo file provides a
flags
octal number which can be converted withint(flags, 8)
. We need to convert that number by usingO_*
flags (os.O_RDONLY, os.O_WRONLY, os.O_RDWR, os.O_APPEND,
...) and turn that into a human readable mode string ("r", "w", "a",
etc.).The text was updated successfully, but these errors were encountered: