Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Retrieve BPF stats

  • Loading branch information...
commit 19766801d9c0c015052ab5894e66bd4d5ac5e7bc 1 parent d24b8b5
@msantos authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/bpf.erl
View
13 src/bpf.erl
@@ -126,6 +126,19 @@ ctl(Socket, seesent) ->
Error
end;
+%% struct bpf_stat {
+%% u_int bs_recv;
+%% u_int bs_drop;
+%% };
+ctl(Socket, stats) ->
+ case procket:ioctl(Socket, ?BIOCGSTATS, <<0:32, 0:32>>) of
+ {ok, <<Recv:4/native-unsigned-integer-unit:8,
+ Drop:4/native-unsigned-integer-unit:8>>} ->
+ {ok, {Recv, Drop}};
+ Error ->
+ Error
+ end;
+
%ctl(Socket, timeout) ->
% Size = sizeof(timeval),
% procket:ioctl(Socket, ?BIOCGRTIMEOUT, <<0:Size/bytes>>);
Please sign in to comment.
Something went wrong with that request. Please try again.