Skip to content

Commit

Permalink
Fall back to lsof if reading /proc/<pid>/fd does not work on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon MacMullen committed Nov 11, 2011
1 parent 4a3ec48 commit 05e712b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rabbit_mgmt_external_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ get_used_fd() ->
get_used_fd(os:type()).

get_used_fd({unix, linux}) ->
{ok, Files} = file:list_dir("/proc/" ++ os:getpid() ++ "/fd"),
length(Files);
case file:list_dir("/proc/" ++ os:getpid() ++ "/fd") of
{ok, Files} -> length(Files);
{error, _} -> get_used_fd({unix, generic})
end;

get_used_fd({unix, _}) ->
get_used_fd_lsof();
Expand Down

0 comments on commit 05e712b

Please sign in to comment.