Skip to content

Commit

Permalink
Convenience fun to open character devices
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Apr 18, 2011
1 parent f90dd1b commit a1310c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bpf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@


open(Dev) ->
{ok, Socket} = procket:open(0, [{dev, "bpf"}]),
{ok, Socket} = procket:dev("bpf"),

% Set the interface for the bpf
{ok, _} = attr(Socket, setif, Dev),
Expand Down
4 changes: 4 additions & 0 deletions src/procket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
-export([
init/0,
open/1,open/2,
dev/1,
socket/3,
listen/1,listen/2,
connect/2,
Expand Down Expand Up @@ -136,6 +137,9 @@ setsockopt(_,_,_,_) ->
erlang:error(not_implemented).


dev(Dev) when is_list(Dev) ->
open(0, [{dev, Dev}]).

open(Port) ->
open(Port, []).
open(Port, Options) when is_integer(Port), is_list(Options) ->
Expand Down

0 comments on commit a1310c1

Please sign in to comment.