Skip to content

Commit

Permalink
Get node identifiers for pipes on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Jun 30, 2016
1 parent 74acd34 commit dead135
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion px/px_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def call_lsof():
# Output lines can be in one of two formats:
# 1. "pPID@" (with @ meaning NUL)
# 2. "fFD@aACCESSMODE@tTYPE@nNAME@"
lsof = subprocess.Popen(["lsof", '-n', '-F', 'fnaptd0'],
lsof = subprocess.Popen(["lsof", '-n', '-F', 'fnaptd0i'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
return lsof.communicate()[0]
Expand Down Expand Up @@ -157,6 +157,7 @@ def lsof_to_files(lsof, file_types=None):
file.pid = pid
file.type = "??"
file.device = None
file.inode = None

if not files:
# No files, just add the new one
Expand All @@ -181,6 +182,8 @@ def lsof_to_files(lsof, file_types=None):
file.device = value
elif type == 'n':
file.name = value
elif type == 'i':
file.inode = value

else:
raise Exception("Unhandled type <{}> for shard <{}>".format(type, shard))
Expand Down

0 comments on commit dead135

Please sign in to comment.