diff --git a/LICENSE b/LICENSE index 314544f..a3a41e1 100644 --- a/LICENSE +++ b/LICENSE @@ -6,11 +6,11 @@ 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. + 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. + 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. diff --git a/README b/README index 291b13c..be75a28 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ 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 + 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 diff --git a/c_src/erl_driver_tk.c b/c_src/erl_driver_tk.c index b5b3f2f..7ad8a55 100644 --- a/c_src/erl_driver_tk.c +++ b/c_src/erl_driver_tk.c @@ -84,7 +84,7 @@ edtk_debug(char *f, ...) return res; } -void +void edtk_debug_errcall(const char *errpfx, char *msg) { if (edtk_debug_flag) @@ -101,7 +101,7 @@ edtk_free_data(void *data) /* ** Arg want_contiguous: if true, return error if the 'n' we're forwarding ** past are in a single contiguous buffer. -** +** ** Return value: ** -1 = error ** 0 = Success, there is no more data to be read diff --git a/c_src/my-unixdom.c b/c_src/my-unixdom.c index 49fbe91..bbdfd41 100644 --- a/c_src/my-unixdom.c +++ b/c_src/my-unixdom.c @@ -31,7 +31,7 @@ my_open(char *path, int flags) int is_server = !!(flags & IS_SERVER); int is_abstract = !!(flags & IS_ABSTRACT); int is_nullterm = !!(flags & IS_NULLTERM); - + /* Race condition exists, but is better than nothing */ if (is_server && !is_abstract && stat(path, &sb) == 0) { errno = EEXIST; diff --git a/c_src/unixdom_drv.c b/c_src/unixdom_drv.c index 8822ce9..3efc66e 100644 --- a/c_src/unixdom_drv.c +++ b/c_src/unixdom_drv.c @@ -1,11 +1,11 @@ /* ** File : unixdom_drv.c ** Summary : EDTK implementation of UNIX domain socket driver (incomplete!) -** +** ** NOTICE: This file was generated by the tools of the Erlang Driver ** toolkit. Do not edit this file by hand unless you know ** what you're doing! -** +** ** Copyright (c) 2004, Scott Lystig Fritchie. All rights reserved. ** See the file "LICENSE" at the top of the source distribution for ** full license terms. @@ -19,7 +19,7 @@ ** indexes could result in Erlang being able to access a later ** incarnation of a valmap table entry by simply remembering a ** previous valmap {valmap_blah, Integer} and resending it to the -** driver, hoping to get (un)lucky. +** driver, hoping to get (un)lucky. ** ** The solution would be to choose a valmap index from a larger, very ** unlikely to repeat set, and use a mapping data structure less naive @@ -215,7 +215,7 @@ s1_stop(ErlDrvData drv_data) if (! still_in_use) { port = desc->port; - sys_free(desc); + sys_free(desc); edtk_debug("%s: port = %ld finished", __FUNCTION__, port); } else { /* @@ -405,13 +405,13 @@ s1_outputv(ErlDrvData drv_data, ErlIOVec *ev) if ((c->i.ptr = (char *) edtk_driver_alloc_wrapper(c->i.size)) == NULL) { goto error; } - + /* */ break; default: edtk_debug("%s: invalid command %d", __FUNCTION__, cmd); goto error; - break; + break; } if (c != NULL) { if (do_async_call) { @@ -422,7 +422,7 @@ s1_outputv(ErlDrvData drv_data, ErlIOVec *ev) */ (*(c->invoke))((void *) c); s1_ready_async((ErlDrvData) desc, (ErlDrvThreadData) c); - /* + /* ** c is already freed for us by s1_ready_async() */ } @@ -505,7 +505,7 @@ s1_ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data) default: edtk_debug("%s: bogus command, should never happen", __FUNCTION__); break; - } + } sys_free(c); } @@ -529,7 +529,7 @@ invoke_s1_open(void *data) c = c; edtk_debug("%s: threadid = %lx", __FUNCTION__, pthread_self()); c->o.ret_int = my_open( - c->i.filename, + c->i.filename, c->i.flags ); if (c->o.ret_int >= 0) { @@ -564,7 +564,7 @@ invoke_s1_sendfd(void *data) c = c; edtk_debug("%s: threadid = %lx", __FUNCTION__, pthread_self()); c->o.ret_int_t = my_sendfd( - c->i.unixdom_fd, + c->i.unixdom_fd, c->i.fd_to_be_sent ); if (c->o.ret_int_t == 0) { @@ -628,8 +628,8 @@ invoke_s1_write(void *data) c = c; edtk_debug("%s: threadid = %lx", __FUNCTION__, pthread_self()); c->o.ret_ssize_t = write( - c->i.fd, - c->i.ptr, + c->i.fd, + c->i.ptr, c->i.__stash[0] ); edtk_debug("%s: threadid = %lx done", __FUNCTION__, pthread_self()); @@ -643,8 +643,8 @@ invoke_s1_read(void *data) c = c; edtk_debug("%s: threadid = %lx", __FUNCTION__, pthread_self()); c->o.ret_ssize_t = read( - c->i.fd, - c->i.ptr, + c->i.fd, + c->i.ptr, c->i.size ); edtk_debug("%s: threadid = %lx done", __FUNCTION__, pthread_self()); diff --git a/config/aclocal.m4 b/config/aclocal.m4 index 43de2db..02f7c95 100644 --- a/config/aclocal.m4 +++ b/config/aclocal.m4 @@ -9,12 +9,12 @@ AC_DEFUN(BT_MSG_CONTROL, AC_CACHE_CHECK([for msg_control member in msghdr], bt_cv_have_msghdr_msg_control, [AC_TRY_COMPILE([#include -#include ], +#include ], [struct msghdr msg; msg.msg_control;], bt_cv_have_msghdr_msg_control=yes, bt_cv_have_msghdr_msg_control=no)]) if test $bt_cv_have_msghdr_msg_control = yes; then - AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL,,HAVE_MSGHDR_MSG_CONTROL) + AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL,,HAVE_MSGHDR_MSG_CONTROL) fi if test $bt_cv_have_msghdr_msg_control = yes; then diff --git a/config/install-sh b/config/install-sh index e843669..2df3e3b 100755 --- a/config/install-sh +++ b/config/install-sh @@ -115,7 +115,7 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: else @@ -124,7 +124,7 @@ if [ x"$dir_arg" != x ]; then else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] @@ -134,7 +134,7 @@ else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" @@ -162,7 +162,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' +defaultIFS=' ' IFS="${IFS-${defaultIFS}}" @@ -201,17 +201,17 @@ else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then dstfile=`basename $dst` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then dstfile=`basename $dst` else @@ -242,7 +242,7 @@ else # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/doc/short-desc b/doc/short-desc index b429e97..b9aaeb6 100644 --- a/doc/short-desc +++ b/doc/short-desc @@ -1 +1 @@ -A reimplementation of UNIX domain socket support. +A reimplementation of UNIX domain socket support. diff --git a/src/unixdom_drv.erl b/src/unixdom_drv.erl index 2c93086..e5f064b 100644 --- a/src/unixdom_drv.erl +++ b/src/unixdom_drv.erl @@ -31,13 +31,13 @@ -export([shutdown/1]). -export([debug/2]). -export([ - null/1, - open/3, - getfd/2, - sendfd/3, - receivefd/2, - close/2, - write/3, + null/1, + open/3, + getfd/2, + sendfd/3, + receivefd/2, + close/2, + write/3, read/3 ]). @@ -73,7 +73,7 @@ shutdown(Port) when port(Port) -> {'EXIT', Port, normal} -> {ok, normal}; {'EXIT', Port, Err} -> {error, Err} after 0 -> {ok, normall} % XXX is 0 too small? - + end. debug(Port, Flags) when port(Port), integer(Flags) -> @@ -91,7 +91,7 @@ null(Port end. open(Port, - Filename, + Filename, Flags ) when port(Port) -> % TODO: Add additional constraints here {FilenameBinOrList, FilenameLen} = serialize_contiguously(Filename, 1), @@ -119,11 +119,11 @@ getfd(Port, end. sendfd(Port, - Unixdom_Fd, + Unixdom_Fd, Fd_To_Be_Sent ) when port(Port) -> % TODO: Add additional constraints here IOList_____ = <>, case catch erlang:port_command(Port, IOList_____) of @@ -155,13 +155,13 @@ close(Port, end. write(Port, - Fd, + Fd, Ptr ) when port(Port) -> % TODO: Add additional constraints here {valmap_fd, FdIndex} = Fd, {PtrBinOrList, PtrLen} = serialize_contiguously(Ptr, 0), IOList_____ = [ <>, % I/O list length PtrBinOrList, << @@ -172,12 +172,12 @@ write(Port, end. read(Port, - Fd, + Fd, Size ) when port(Port) -> % TODO: Add additional constraints here {valmap_fd, FdIndex} = Fd, IOList_____ = <>, case catch erlang:port_command(Port, IOList_____) of @@ -185,7 +185,7 @@ read(Port, Err -> throw(Err) % XXX Is this too drastic? end. - + %%% %%% Internal functions. %%% @@ -225,7 +225,7 @@ get_port_reply(Port) when port(Port) -> {Port, Reason} -> throw({port_error, Reason}) % XXX too drastic? end. -%% This function exists to provide consistency of replies +%% This function exists to provide consistency of replies %% given by linked-in and pipe drivers. The "receive" statement %% in get_port_reply/1 is specific because we want it to be %% very selective about what it will grab out of the mailbox. @@ -254,9 +254,9 @@ io_list_len([H|T], N) -> binary(H) -> io_list_len(T, size(H) + N); true -> throw({error, partial_len, N}) end; -io_list_len(H, N) when binary(H) -> +io_list_len(H, N) when binary(H) -> size(H) + N; -io_list_len([], N) -> +io_list_len([], N) -> N. %%% We need to make the binary thing we're passing in contiguous diff --git a/support/create_release.sh b/support/create_release.sh index b51566e..d3f858f 100644 --- a/support/create_release.sh +++ b/support/create_release.sh @@ -15,7 +15,7 @@ mkdir -p ${DIR}/ebin for i in `ls -d * | sed -e 's/release//g'` do [ -d ${i} ] && cp -Rp ${i} ${DIR} && rm -rf ${DIR}/${i}/CVS - [ -f ${i} ] && cp -p ${i} ${DIR} + [ -f ${i} ] && cp -p ${i} ${DIR} done rm -rf ${DIR}/CVS rm -rf ${DIR}/ebin/*.beam diff --git a/support/include.mk.in b/support/include.mk.in index c3c0533..ab1627a 100644 --- a/support/include.mk.in +++ b/support/include.mk.in @@ -43,8 +43,8 @@ ERL_DOCUMENTS := $(ERL_SOURCES:%.erl=$(DOC_DIR)/%.html) APPSCRIPT = '$$vsn=shift; $$mods=""; while(@ARGV){ $$_=shift; s/^([A-Z].*)$$/\'\''$$1\'\''/; $$mods.=", " if $$mods; $$mods .= $$_; } while(<>) { s/%VSN%/$$vsn/; s/%MODULES%/$$mods/; print; }' -../ebin/%.app: %.app.src ../vsn.mk Makefile - perl -e $(APPSCRIPT) "$(VSN)" $(MODULES) < $< > $@ +../ebin/%.app: %.app.src ../vsn.mk Makefile + perl -e $(APPSCRIPT) "$(VSN)" $(MODULES) < $< > $@ ../ebin/%.appup: %.appup cp $< $@