Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Return number of bytes for partial writes
The write functions (sendto/4, sendmsg/5, write/2, writev/2) have had a
long standing bug where failure to write the complete buffer was
silently ignored.

Return a tuple containing the number of bytes written if the complete
buffer could not be sent. Writes can be continued using something like:

    write_exact(FD, Buf) ->
        case procket:write(FD, Buf) of
            ok ->
            {ok, N} - >
                {_:N/bytes, Rest/binary} = Buf,
                write_exact(FD, Rest);
            Error ->

Successful writes of the entire buffer still return 'ok'.


Fix compilation on Solaris
So errno is not thread local on Solaris and is set to 0 by default on
error. Really Solaris?

On Solaris, compile using POSIX mode which requires c99 mode which fixes
errno, uses void* instead of c_addr_t* for iovec and various other errors.

Add solaris constants for dgram, stream and raw which differ from other
unix platforms. Make the send/recvmsg example work on Solaris.

Platform dependent constants need to be fixed in the future. This could
be done either by adding a lookup table to the NIF or writing a small
program in C to generate an erlang module at compile time.

Bump version to 0.6.1.


Bump version to 0.6.0 and copyright heartbeat


Use local file operations for slave nodes
Opening a socket on a slave node using the procket setuid helper would
fail, due to file operations being performed on the master:

    1> slave:start('bar', 'n', "-env ERL_LIBS /path/to/erlang").

    (n@foo)3> rpc:call('n@bar', procket, open, [58, [{protocol,tcp},{family,inet},{type,stream}]]).

The failure happens because procket creates a temporary directory to
store the unix socket used to pass the fd from the helper into the NIF.
Because slave nodes defer file operations to the master, the temp
directory would be created on the master but would be attempted to be
used on the slave.

The work around was to manually specify the location of the unix socket
using the 'pipe' option:

    rpc:call('n@bar', procket, open, [58, [{pipe, "/tmp/procket.s"}, {protocol,tcp},{family,inet},{type,stream}]]).

Fix by bypassing the file server using the prim_file module directly.
Slave nodes now should work without any other setup:

    (n@foo)3> rpc:call('n@bar', procket, open, [58,
    (n@foo)4> rpc:call('n@bar', gen_tcp, listen, [0,

Checking the remote mode, the socket is listening:

    bar$ sudo netstat -ptnl | grep 58
    tcp        0      0    * LISTEN      23902/beam.smp

Thanks to xingang shi for reporting and debugging this problem!
Something went wrong with that request. Please try again.