Accept filters on FreeBSD?

Thomas Fee thomas@REDACTED
Sat May 31 02:46:34 CEST 2003


You mean the documentation is available as man pages?!!
I've been using the erlang.org web site as my html lookup resource
but I'd prefer man pages. Doing something in the shell is _so_
much quicker.

How would I get the Erlang man pages into my system?

~Thomas



Scott Lystig Fritchie wrote:

>>>>>>"nd" == Niall Dalton <ndalton@REDACTED> writes:
>>>>>>            
>>>>>>
>
>nd> Hello, Does anyone have experience using accept filters on FreeBSD
>nd> in Erlang applications? 
>
>I'd never even heard of them until you mentioned them.  I should spend
>more time reading "man" pages.  :-)
>
>There's an undocumented function in the inet module that you could use
>to get the OS file descriptor associated with the socket.
>
>    % erl
>    Erlang (BEAM) emulator version 5.2.3.3 [source] [threads:0]
>    
>    Eshell V5.2.3.3  (abort with ^G)
>    1> {ok, Port} = gen_tcp:connect("localhost", 25, []).
>    {ok,#Port<0.28>}
>    2> inet:getfd(Port).
>    {ok,7}
>    3> 
>
>According to the accf_http(9) man page, you'd need to call
>setsockopt() to invoke the proper magic.  However, the inets driver
>doesn't know how to do that.  Your options are:
>
>1. Hack your "beam" executable to add the sockopt you need.
>
>2. Create a linked-in driver that would take the file descriptor from
>   inet:getfd() and invoke the setsockopt() as required.
>
>#2 would be really easy to do with EDTK.  See
>http://www.snookles.com/erlang/edtk/ for the source code.  Sorry it's
>a hassle to set up, but it really does work quite well once you've
>compiled the "gslgen" utility.
>
>Though I haven't tested it, this ought to work pretty well.  Writing
>int my_setsockopt(int) is easy enough -- put it in my-sockopt.{h,c}.
>
>    <erldriver name="simple0_drv" abbrev="" default_debug_verbose="0">
>    
>    <summary>A very simple setsockopt() driver</summary>
>    
>    <verbatim place="top_cpp_stuff">
>    #include <errno.h>
>    #include <my-sockopt.h> /* Just for prototype */
>    </verbatim>
>    
>    <func name="my_sockopt">
>     <arg name="fd" ctype="int"/>
>     <return ctype="int" name="ret_int" expect="== 0" expect_errval="errno"/>
>    </func>
>    
>    </erldriver>
>
>To make your life easier (probably), borrow the Makefile from the
>examples/simple0 driver to assist compiling & linking everything.
>
>-Scott
>
>
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030530/3c54b6e8/attachment.htm>


More information about the erlang-questions mailing list