aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs
AgeCommit message (Collapse)Author
2019-06-04[esock] Add pattern to socket descriptorMicael Karlberg
Add a pattern field to the (beginning of the) socket descriptor. To make it more easy to spot memory over-writes. One pattern for create and one for dtor. Also reset various fields of the descriptor at dtor.
2019-06-04[esock] Post rebase cleanupMicael Karlberg
Rebase (on maint as of 20190529) resulted in a number of issues. Mostly in the (esock) test suite. OTP-15731
2019-05-29[esock] Found and fixed some weirdness on darwinMicael Karlberg
Tests on Darwin Kernel Version 18.2.0 reveled some problems handling connect (on that platform). It seems that calling connect the second time is not needed (it results in eisconn), so we needed to handle that case, which we now do.
2019-05-29[esock] Types and cleanupMicael Karlberg
Changed tag type tpo opaque. Also added connect (monitor and process) cleanup. OTP-15731
2019-05-29[esock] Connect can now also take a nowait TimeoutMicael Karlberg
Had forgot about the connect function. But it can now also handle the Timeout = nowait, maybe resulting in a select. Required some nif work also... OTP-15731
2019-05-29[esock] Make sure AF_LOCAL exist before usingMicael Karlberg
Add if-def for AF_LOCAL before using the flag. OTP-15822
2019-05-29[esock|test] On some platforms recvmsg does *not* return addressMicael Karlberg
On some platforms, e.g. FreeBSD, recvmsg does *not* return address for a Unix Domain (stream) socket. Unlike, for instance, on Linux. OTP-15822
2019-05-29[esock] Fixed check domain local and specsMicael Karlberg
Fixed the spec's for function open/3,4. Also, corrected the test for retreiving resulting protocol when performing open with proto = 0 (default) and domain is not local. Local may not be defined on all platforms. OTP-15822
2019-05-29[esock] Fixed 'typing' of type timeval on darwinMicael Karlberg
2019-05-29[esock] Update the supports functions to also display localMicael Karlberg
The socket:supports/0,1 now also displays local (Unix Domain Socket). OTP-15822
2019-05-29[esock] SO_PROTOCOL does not exist on darwin (18.2.0)Micael Karlberg
The flag SO_PROTOCOL does not exist on darwin 18.2.0 (atleast). So, creating a socket with domain =/= local using the default protocol does not work in this case. OTP-15822
2019-05-29[esock|test] Add (stream) sendmsg and recvmsg test case for localMicael Karlberg
Add a sendmsg and recvmsg test case for a unix domain (stream) socket. Found and fixed a bug for the return value for the address field for family 'local' (encoded as 'inet'). OTP-15822
2019-05-29[esock] Finalize handling of Unix Domain SocketMicael Karlberg
Corrected various issues and added missing stuff. Default protocol is now indicated with the atom 'default' instead of the atom 'null'. Also let the underlying OS decide what protocol is actually the default protocol. OTP-15822
2019-05-24Merge branch 'bmk/erts/esock/timestamps/OTP-15566' into maintMicael Karlberg
2019-05-23Merge branch ↵Micael Karlberg
'bmk/erts/esock/20190517/nsupports_options_tcp_invalid_flags/OTP-15827' into maint
2019-05-22[esock] Removed (use of) clock_gettimeMicael Karlberg
We no longer use clock_gettime to get time. Instead we use enif_monotonic_time(ERL_NIF_USEC) and enif_time_offset(ERL_NIF_USEC). OTP-15566, OTP-15686
2019-05-22[esock] Explicitly (configure) check for time functionsMicael Karlberg
Explicitly autoconf check for functions localtime_r and strftime, which are used in prettyfying timestamps. Also make use of the results from these checks (HAVE_...) If not found, timestamps will just be an integer (which is better then nothing). OTP-15566
2019-05-22[esock] Replace usage of clock_gettime(CLOCK_REALTIME, ...)Micael Karlberg
The usage of the function clock_gettime(CLOCK_REALTIME, ...) has been replaced with enif_monotonic_time(ERL_NIF_USEC) and enif_time_offset(ERL_NIF_USEC). For now its if-def'ed so that we still *can* use clock_gettime, but for the momemnt its not used even if its available. OTP-15566, OTP-15686
2019-05-17[esock] Wrong flags used in if-defingMicael Karlberg
In the TCP options nsupports function, invalid flags where used in the if-def'ing. Used TCP_ instead of TCP_MAXSEG and TCP_NODELAY. OTP-15827
2019-05-14erts: Fix memory leaks in socket_nifSverker Eriksson
2019-05-14erts: Fix dealloction bug in socket_nifSverker Eriksson
2019-04-17[socket] CMsg header decode on darwinMicael Karlberg
The cmsg header (decode) problems on darwin was because the CMSG_FIRSTHDR macro is "faulty" on old versions (of darwin). I *think* it should return a NULL-pointer if there are no cmsg headers (but it does not). So, instead of punishing all platforms with an explicit test (msg_controllen >= sizeof(struct cmsghdr)) we only do this on darwin.
2019-04-17[socket] Building term with terms from different env (again)Micael Karlberg
When building the (activate next) select message, used terms from different environments, which is not allowed. This was during cancel of one request, we tries to activate next, and then building the select message (with terms from different environments). Arg! Details... OTP-15496
2019-04-17[socket] Type maniaMicael Karlberg
Why can't we all just get along? Casting to shut the compiler up.
2019-04-17[socket] Debug fixesMicael Karlberg
When setting (otp) debug to true, some debug printouts could become "laaarge". Removed the data from those printout to avoid problems.
2019-04-17[socket] Building term with terms from different env (again)Micael Karlberg
When building the (recv) select message, used terms from different environments, which is not allowed. OTP-15496
2019-04-17[socket] Building term with terms from different envMicael Karlberg
When building the (accept) select message, used terms from different environments, which is not allowed. OTP-15496
2019-04-17[socket] Fixed acceptor environment leakMicael Karlberg
Did the free and assign new acceptor in the wrong order, thereby causing an (acceptor) environment leak. OTP-15496
2019-04-17[socket] Fixed various windows issuesMicael Karlberg
Building on windows broken again: * The 'inline' keywork needs som work on windows. * Function was outside of if-def. * Missing prototypes resulted in default prototypes. In this case, the actual problem was missing if-defs for win32 (that made functions exist on windows when they should not). Not sure why it compiled just fine on win32 but not win64 though.
2019-04-17[socket] Make use of the new select (read|write) functionsMicael Karlberg
Make use of the new select functions; enif_select_[read|write], for read and write select. These functions allows us to construct the select message ourseves: {'$socket', Socket, select, Ref} This is in preparations for when we introduce the 'nowait' (or something similar) value for the timeout argument (in accept, read and write funcions). It also solves (we hope) the term leakage problems (it was difficult to free the environment when there was only one/socket). OTP-15496
2019-04-17[socket|net] Make set|get options safe and type prefixMicael Karlberg
Firstly, make sure socket (and own) options manipulations are safe by adding a mutex that we take in the setopt and getopt functions. Secondly, change type prefix of various types from 'Socket' to 'ESock' (for instance; SocketDescriptor -> ESockDescriptor). OTP-15496
2019-04-17[socket] Restructure the close function(s)Micael Karlberg
To increase readability the close function has been slightly restructured.
2019-04-17[socket] Restructure the recvmsg result checkMicael Karlberg
To increase readability the recvmsg result check has been slightly restructured. In this case we made use of the error case function (fail) of the recv result check.
2019-04-17[socket] Restructure the recvfrom result checkMicael Karlberg
To increase readability the recvfrom result check has been slightly restructured. In this case we made use pf the error case function (fail) of the recv result check.
2019-04-17[socket] Restructure the recv result checkMicael Karlberg
To increase readability the recv result check has been slightly restructured.
2019-04-17[socket] Restructure the send result checkMicael Karlberg
To increase readability the send result check has been slightly restructured.
2019-04-17[socket] Messages from the nif code now has a proper socketMicael Karlberg
The messages sent from the nif code to an erlang process has been changed to: {'$socket', Socket :: socket(), Tag :: atom(), Info :: term()} This is in preparation for (using) the new enif select API. OTP-15496
2019-04-17[esock] Fixed socket close raceMicael Karlberg
Used ref from wrong environment when building reply.
2019-03-22Merge branch 'john/erts/unc-path-size-fix/OTP-15693'John Högberg
* john/erts/unc-path-size-fix/OTP-15693: erts: Fix incorrect UNC path length calculation
2019-03-22erts: Fix incorrect UNC path length calculationJohn Högberg
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.
2019-03-21Merge branch 'bmk/20190318/temporary_fix_for_realtime_on_darwin'Micael Karlberg
2019-03-21Merge branch 'bmk/20190318/invalid_make_ref_at_sock_close'Micael Karlberg
2019-03-19[socket] Another try at fixing the NULL envMicael Karlberg
During socket stop the close environment somehow has been NULLed. Check this before using when sending the close message.
2019-03-18[socket|net] Temporary fix for absence of clock_gettime(CLOCK_REALTIMEMicael Karlberg
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.
2019-03-18Merge branch 'bmk/20190315/net_memleak'Micael Karlberg
2019-03-18Merge branch 'bmk/20190315/use_wrong_current_when_stopping'Micael Karlberg
2019-03-18[socket] Fixed socket close issueMicael Karlberg
Fixed an issue (I think) that during socket close could cause a core.
2019-03-15[net] Fixed memory leak in address info encodingMicael Karlberg
Fixed a memory leak in the function for address infos encoding.
2019-03-15[socket] Fixing debug printoutMicael Karlberg
A debug printout in the socket_stop fucntion used the wrong requestor record for the pid, which may leasd to a confusing debug printout.
2019-03-14[socket] The activate-next always used read selectMicael Karlberg
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.