aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs
AgeCommit message (Collapse)Author
2019-07-24[esock] Renaming structures and callback functionsMicael Karlberg
Rename some of the structures and callback functions (socket -> esock). OTP-15955
2019-07-24[esock] Renamed constantsMicael Karlberg
Renamed constants (defines): SOCKET_ -> ESOCK_ OTP-15955
2019-07-24[esock] Renaming internal functions to avoid name clashesMicael Karlberg
The naming "convention" for "top" functions of the esock nif module was: The API functions where called nif_<foo> This function did basic checks and arg extraction and then called the a function called n<foo>, which was the one doing the actual work. Unfortunately, och some platforms (AIX) these second names, n<foo>, clashed with system functions. So, in order to avoid this, the naming of second function has been changed to esock_<foo>. OTP-15955
2019-07-18[esock] Fixed a copy-and-paste error for bindtodeviceMicael Karlberg
Fixed a copy-and-paste error for socket option bindtodevice. Incorrectly used SO_BROADCAST option instead. OTP-15904
2019-07-17[esock] Handle wildcard address 'broadcast' when bindingMicael Karlberg
Its now possible to bind a socket to the (limited) broadcast address by specifying 'broadcast' as address: socket:bind(Socket, broadcast) This is *only* valid for family 'inet'. Add testing of sending (broadcasting) to both "limited" broadcast address and "subnet-directed" broadcast address. OTP-15904
2019-07-17[esock] Add test case for socket option bindtodeviceMicael Karlberg
Add test case for the socket option bindtodevice. Also make correction in the nif code. Used the wrong option (broadcast). Also added more info to doc. Note sure if this test case actually works. Set and get "works", but the value returned by get is always "". So either we should extend the test to made sure the bind actually has the expected effect or... Something for a rainy day maybe... OTP-15904
2019-07-08Merge branch 'bmk/erts/esock/20190626/finalize_counters/OTP-15818' into maintMicael Karlberg
2019-07-08Merge branch 'bmk/erts/esock/20190624/socket_command/OTP-15817' into maintMicael Karlberg
2019-07-08Merge branch 'bmk/erts/esock/20190614/split_modules/OTP-15765' into maintMicael Karlberg
2019-07-04[esock] Format buffer lengthMicael Karlberg
Corrected calculation of buffer length for format(ed) string. OTP-15817
2019-07-04[esock] Fixed debug "file"Micael Karlberg
Debug printouts is done to "dbgout", but the dbg macro flushed "stdout" (which was the default). So, in order to make the macro work properly in all cases, we rename dbgout to esock_dbgout and make it extern (was static), and then used that in the macro. OTP-15817
2019-06-27[esock] Win32 ifdef tests missingMicael Karlberg
OTP-15818
2019-06-27Merge branch ↵Micael Karlberg
'bmk/erts/esock/incorrect_map_size_check_update_membership/OTP-15908' into maint
2019-06-26[esock] Corrected some counter actionsMicael Karlberg
Corrected both read pkg, byte and fail counter increment for recvmsg (was actually missing). OTP-15818
2019-06-26[esock] Corrected some counter actionsMicael Karlberg
Corrected both read pkg and byte counter increment for recvfrom (was actually missing). OTP-1581
2019-06-26[esock] Corrected some counter actionsMicael Karlberg
When to count read failure and read package count used number of bytes read instead of just increment (by 1). OTP-1581
2019-06-26[esock] Counters for individual socketsMicael Karlberg
We already had the counters. But we did not entirely handle counter wrap, especially in related to 'iow' (Inform On Wrap). There was also no way to get to the counter values, so a socket specific info function was implemented (piggy back on the existing "global" info function). And since, we have it, we also add other info in the returned map (number of readers, writers and acceptors). OTP-15818
2019-06-26[esock] Moved new command inside ifdefMicael Karlberg
Build failed on windows because of misplaced ifdef's (of new command functions). OTP-15817
2019-06-24[esock] Add command (nif) functionMicael Karlberg
Add a command function to the socket API. Currently only used for changing global debug. OTP-15817
2019-06-18[esock] socket:setopt add_membership fails with badargMicael Karlberg
An invalid value test caused the socket:setopt(Socket, ip, add_membership, ip_mreq()) to fail with badarg. OTP-15908 (ERL-980)
2019-06-14[esock,kernel] net -> prim_net and add (new) netMicael Karlberg
Renamed the current preloaded net module to prim_net and removed the deprecated functions (call, cast, ...). Introduce a "new" net module (in kernel) as an interface module to the (preloaded) prim_net. This one also contains the deprecated functions (call, cast, ...). OTP-15765
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.