Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions c_src/erl_driver_tk.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ edtk_debug(char *f, ...)
return res;
}

void
void
edtk_debug_errcall(const char *errpfx, char *msg)
{
if (edtk_debug_flag)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion c_src/my-unixdom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions c_src/unixdom_drv.c
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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 {
/*
Expand Down Expand Up @@ -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;
}

/* </hack --place="post-deserialize" type="verbatim"--> */
break;
default:
edtk_debug("%s: invalid command %d", __FUNCTION__, cmd);
goto error;
break;
break;
}
if (c != NULL) {
if (do_async_call) {
Expand All @@ -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()
*/
}
Expand Down Expand Up @@ -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);
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions config/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/types.h>
#include <sys/socket.h>],
#include <sys/socket.h>],
[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
Expand Down
16 changes: 8 additions & 8 deletions config/install-sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""

if [ -d $dst ]; then
instcmd=:
else
Expand All @@ -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 ]
Expand All @@ -134,7 +134,7 @@ else
echo "install: $src does not exist"
exit 1
fi

if [ x"$dst" = x ]
then
echo "install: no destination specified"
Expand Down Expand Up @@ -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}}"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 &&

Expand Down
2 changes: 1 addition & 1 deletion doc/short-desc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
A reimplementation of UNIX domain socket support.
A reimplementation of UNIX domain socket support.
38 changes: 19 additions & 19 deletions src/unixdom_drv.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
]).

Expand Down Expand Up @@ -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) ->
Expand All @@ -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),
Expand Down Expand Up @@ -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_____ = <<?S1_SENDFD,
Unixdom_Fd:32/integer,
Unixdom_Fd:32/integer,
Fd_To_Be_Sent:32/integer
>>,
case catch erlang:port_command(Port, IOList_____) of
Expand Down Expand Up @@ -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_____ = [ <<?S1_WRITE,
FdIndex:32/integer,
FdIndex:32/integer,
PtrLen:32/integer>>, % I/O list length
PtrBinOrList,
<<
Expand All @@ -172,20 +172,20 @@ write(Port,
end.

read(Port,
Fd,
Fd,
Size
) when port(Port) -> % TODO: Add additional constraints here
{valmap_fd, FdIndex} = Fd,
IOList_____ = <<?S1_READ,
FdIndex:32/integer,
FdIndex:32/integer,
Size:32/integer
>>,
case catch erlang:port_command(Port, IOList_____) of
true -> get_port_reply(Port);
Err -> throw(Err) % XXX Is this too drastic?
end.


%%%
%%% Internal functions.
%%%
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion support/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions support/include.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@
Expand Down