Age | Commit message (Collapse) | Author |
|
* john/erts/unc-path-size-fix/OTP-15693:
erts: Fix incorrect UNC path length calculation
|
|
This didn't cause any issues for the most part since the path was
still properly formed, but it broke down when appending the
wildcards in file:list_dir/1. The ASSERT_PATH_FORMAT macro would
have caught this in no time, but it went unnoticed because we don't
run debug builds on Windows.
|
|
|
|
|
|
During socket stop the close environment somehow has
been NULLed. Check this before using when sending the
close message.
|
|
We use clock_gettime(CLOCK_REALTIME, ...) to create a simple
timestamp. This is used both for debugging and when writing
error/warning messages (from the nif-code).
The workaround for the absence of this function (on some platforms,
old versions of darwin for example) is to simply skip the timestamp.
|
|
|
|
|
|
Fixed an issue (I think) that during socket close
could cause a core.
|
|
Fixed a memory leak in the function for address infos encoding.
|
|
A debug printout in the socket_stop fucntion used the wrong
requestor record for the pid, which may leasd to a confusing
debug printout.
|
|
The activate-next (reader|writer|acceptor) always
*incorrectly* used the read select function.
This has now been changed so that the functions
are created via a macro with an argument specifying
which select function to use.
|
|
|
|
Replace the won function for pid compare with the
(new) enif_compare_pids function.
OTP-15565
|
|
Add some more comments in order to increase readability.
OTP-15565
|
|
Implemented the activate_next function and added its
"users" acceptor, writer and reader (macro abuse).
After a request (accept, write or send) has been either
successfully completed or failed, another request should
be activated. Previously only one attempt was made, which
might leave the other (waiting) requestors hanging.
Now, instead we use a 'activate-next' function that pop's
the request (accept, wrote or read) queue until success
or its empty, thereby making sure that no waiting processes
is left hanging.
OTP-15565
|
|
Remove own function to make monitor printable (was a hack)
and make use of the new enif_make_monitor_term instead.
|
|
bmk/20190301/cleanup_through_macro_abuse/OTP-15565
|
|
Fixed some type size warnings (SCTP related). E.g:
On Solaris 11 (OpenIndiana Hipster) long and int is size 4,
but the way Sint32 def works it first "tests" for long size and
if that is correct, that is chosen (which it is on Solaris 11).
On linux long is size 8, so Sint32 will be defined as int.
...
On Solaris 11 the flags TCP_CONGESTION and SO_BINDTODEVICE
does not exist, so the function(s) n[set|get]opt_str_opt is never
used. So, in order to keep the compiler quiet, we add some if-def
to exclude these functions in this case.
|
|
|
|
The requestor (acceptor, writer and reader) functions are
virtually identical, so to ensure quality and not having
to write the exact same functions three times, we make
use of some macro magic for their declaration.
OTP-15565
|
|
Some more macro abuse for nif API callback functions.
OTP-15565
|
|
Some more macro abuse for nif API callback functions and
the operator (acceptor, writer and reader) queue wrapper functions
(search4pid, push, pop and unqueue).
OTP-15565
|
|
|
|
Make use of macro concat magic to simplify declarations.
OTP-15565
|
|
The getnameinfo function has been fixed:
1) Faulty sockaddr decode success check
2) Incorrect (name info) return value
OTP-15636
|
|
Some cleanup (of open, bind, connect) and rewrote the
accept code (moved the code into smaller functions).
OTP-14831
|
|
Better handling of socket close. The 'closeRef' needed
its own environment to make if work in both cases (both
called and scheduled).
Also Introduced the enif select wrapper functions (read,
write, stop and cancel). Also add error handling at every
time one of these functions are called.
OTP-14831
|
|
Fixed a raise condition bug in the socket_stop (callback)
function that could result in the socket actually *not*
beeing closed.
OTP-14831
|
|
Assert failed in enif_demonitor when called with "NULL-monitor".
Replaced null monitor with separate 'is_active' boolean
and added my_make_monitor_term for printing (to be replaced
with enif_make_monitor_term).
|
|
Asserts failed in debug vm as msg term was built
from mixed ErlNifEnv's.
|
|
and collapsed some duplicate code
|
|
|
|
as called in crypto.erl and erlang.erl.
|
|
bmk/20190204/socket_as_nif/OTP-14831
|
|
The nif callback functions (nif_open) now instead cause an
'nosup' exception if called (instead of badarg).
The basic type uint16_t, uint32_t and int32_t (C99) replaced
"own" (that is, defined by "us") types Uint16, Uint32 and
Sint32.
The point of this is that our Windows build system seems to
be a bit lacking when it comes to types...
Removed "some stuff" that was if-defed. Different solution
when win32 support for sockets has been improved.
Make sure the socket_*.c util modules are not included
in the building for windows.
OTP-15526
|
|
Added preliminary, and temporary, windows adaptions.
Basically they amount to letting all nif-callback functions
returning badarg for all calls if on windows (this has
been accomplished by if-defing the nif-code; if win32 then
badarg else do-something).
OTP-15526
|
|
Its now possible to set a rcvbuf (otp) option value
of {N :: pos_integer(), BufSz :: pos_integer()}.
This value is used for type stream and protocol tcp,
when calling the function recv with length = 0 (zero).
The second value, BufSz, is the actual size of the receive
buffer used when calling the socket recv function, and
the first value, N, is the max number of possible reads
that will be performed (at most), even if there is more
data to read. This is limit the effect of DoS attacks.
OTP-15497
|
|
The read and write functions now *only* use the isReadable and
isWritable fields, respectively, to decide if the "socket" can be read
from and written to (previously the state field was used outside of
the mutex lock).
Also made it possible to enable / disable test suite groups individually,
via environment variables (ESOCK_TEST_...). Specifically, the ttest
group has been excluded by default (takes to long a time).
OTP-15549
|
|
Add a way to *get* the file descriptor (fd) of a socket.
Useful mostly for debugging.
OTP-15528
|
|
* maint:
Remove an unused variable
Spawn prim_file helper as a system process
|
|
|
|
The macro (define) IPTOS_MINCOST does not exist
on OpenBSD 6.3.
OTP-14831
|
|
|
|
Previously the "message interface" between the functions in
socket.erl and the nif-code (socket_nif.c) was "ad hoc".
This has now been changed so that we have a unified message
{'$socket', SockRef | undefined, Tag, Info}
This also has the added advantage of preparing the code for
when we start using the new select-fucntions (with which
its possible to specify your own message). This will be used
in order to get around our eterm "leak" (we will use a simple
counter, maintained in the nif, instead of the [Recv|Send|Acc]Ref
we generate in the erlang code today.
OTP-14831
|
|
for set_permission and set_owner.
|
|
"Dry fixed" the "same" problems as was found for nif_recv (missing
binary free(s)).
OTP-14831
|
|
Running valgrind, found a couple of cases when allocated
binaries where not released. Mostly when the recv failed
for some reason.
Also clear and free the environment associated with the
socket (resource) (in the _dtor callback function).
OTP-14831
|
|
bmk/20180918/nififying_inet/OTP-14831
|
|
* Socket close callback
Only demonitor the closer if its local (close) and its not
a direct call. There was a spurious warning message.
* Down callback
Only process this event if the socket is not closed or closing.
OTP-14831
|