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 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?


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 [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
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list