Skip to content
Browse files

copied defintions to afunix.erl, since some distros use none source k…

…ernel/lib include failed, fixed some warnings for R15
  • Loading branch information...
1 parent 1059d30 commit de205e5899aa6c3f0aca28fcd46de2bcc2896bff @tonyrog committed Feb 28, 2014
Showing with 46 additions and 3 deletions.
  1. +1 −1 c_src/afunix_drv.c
  2. +45 −2 src/afunix.erl
View
2 c_src/afunix_drv.c
@@ -3861,7 +3861,7 @@ static tcp_descriptor* afunix_copy(tcp_descriptor* desc,SOCKET s,
copy_desc->send_timeout_close = desc->send_timeout_close;
/* The new port will be linked and connected to the original caller */
- port = driver_create_port(port, owner, "tcp_inet", (ErlDrvData) copy_desc);
+ port = (ErlDrvPort) driver_create_port((long)port, owner, "tcp_inet", (ErlDrvData) ((long)copy_desc));
if ((long)port == -1) {
*err = INET_ERRNO_SYSTEM_LIMIT;
FREE(copy_desc);
View
47 src/afunix.erl
@@ -27,13 +27,56 @@
-export([get_peercred/1]).
-export([get_peerpid/1]).
--include_lib("kernel/src/inet_int.hrl").
-
+%% rasperry pi distribute non-source
+%% -include_lib("kernel/src/inet_int.hrl").
+-define(INET_REQ_OPEN, 1).
+-define(INET_REQ_CONNECT, 3).
+-define(INET_REQ_BIND, 6).
+-define(INET_REQ_GETOPTS, 8).
+-define(INET_REQ_FDOPEN, 13).
+
+-define(INET_REP_ERROR, 0).
+-define(INET_REP_OK, 1).
+-define(INET_REP, 2).
+
+-define(int32(X),
+ [((X) bsr 24) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 8) band 16#ff, (X) band 16#ff]).
+-define(u16(X1,X0),
+ (((X1) bsl 8) bor (X0))).
+-define(u32(X3,X2,X1,X0),
+ (((X3) bsl 24) bor ((X2) bsl 16) bor ((X1) bsl 8) bor (X0))).
+
+-define(INET_AF_INET, 1).
+-define(INET_AF_INET6, 2).
-define(INET_AF_UNIX, 5).
+-define(INET_TYPE_STREAM, 1).
+-define(INET_TYPE_DGRAM, 2).
+-define(INET_TYPE_SEQPACKET, 3).
+
-define(UNIX_OPT_PEERCRED, 101).
-define(UNIX_OPT_PEERPID, 102).
+-define(LISTEN_BACKLOG, 5). %% default backlog
+
+-record(connect_opts,
+ {
+ ifaddr = any, %% bind to interface address
+ port = 0, %% bind to port (default is dynamic port)
+ fd = -1, %% fd >= 0 => already bound
+ opts = [] %% [{active,true}] added in inet:connect_options
+ }).
+
+-record(listen_opts,
+ {
+ ifaddr = any, %% bind to interface address
+ port = 0, %% bind to port (default is dynamic port)
+ backlog = ?LISTEN_BACKLOG, %% backlog
+ fd = -1, %% %% fd >= 0 => already bound
+ opts = [] %% [{active,true}] added in
+ %% inet:listen_options
+ }).
%-define(DEBUG, 1).
-ifdef(DEBUG).

0 comments on commit de205e5

Please sign in to comment.
Something went wrong with that request. Please try again.