From: <slf...@us...> - 2004-02-23 08:59:34
|
Update of /cvsroot/jungerl/jungerl/lib/unixdom_drv In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24105 Added Files: LICENSE Makefile README Log Message: Initial checkin of unixdom_drv (based on EDTK-generated code). --- NEW FILE: LICENSE --- Copyright (c) 2003, Scott Lystig Fritchie, <slf...@sn...> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Mr. Fritchie nor the names of any other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --- NEW FILE: Makefile --- include ../../support/subdir.mk --- NEW FILE: README --- This is a very incomplete reimplementation of the UNIX domain socket driver that I wrote and added to the www.erlang.org "User Contributions" collection. There are two things that this driver can do that the original UNIX domain socket driver cannot: 1. It has a "getfd" call so that Erlang can discover the underlying UNIX file descriptor for the socket. 2. Has the ability to use BSD-style file descriptor passing to pass file descriptors between Erlang nodes running on the same machine. The file descriptor passing has been tested under Linux and FreeBSD. It should work under Solaris (minor tweaking perhaps necessary?) and any other platform that supports BSD-style file descriptor passing over UNIX domain sockets. To test the file descriptor passing, to the following: On machine-A: % make ... GNU make is required, sorry! % cd test % make % make test ... optional, but shows some instructions % erl -pz ../ebin 1> file:delete("/tmp/sock"). 2> unixdom_test:tcp_listen(5555, "/tmp/sock"). On machine-A, but in another login session: % cd test % erl -pz ../ebin 1> unixdom_test:receive_fd("/tmp/sock"). [... some time later ...] TCP socket fd 8 received, looping now On machine-B: % telnet machine-A 5555 Trying 10.1.1.1... Connected to machine-A Escape character is '^]'. Hello, there! Please type some stuff: If someone would like to fix this driver up, they are more than welcome to! I have only done enough to implement the file descriptor passing. My intention was to create a minimal implementation this time, relying on using gen_tcp:fdopen() or prim_inet:fdopen() to create a full-featured socket port, rather than trying to re-invent the wheel (including all of the gadgets, like packet encoding types, that the inets driver currently supports!). -Scott 23 February 2004 |