aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers
AgeCommit message (Collapse)Author
2014-01-27Merge branch 'lukas/erts/sendfile_passive_mode_fix/OTP-11614'Lukas Larsson
* lukas/erts/sendfile_passive_mode_fix/OTP-11614: erts: fix bug when using passive mode and sendfile
2014-01-27erts: fix bug when using passive mode and sendfileLukas Larsson
The bug incorrectly issued driver_select when un-ignoring an fd for a socket in passive mode, which caused an incorrect error tuple to be returned when the remote end closed the connection.
2014-01-14Don't make gzio.c dependent on the zutil.h header fileBjörn Gustavsson
gzio.c is our own replacement for zlib's gzopen() etc (based on a version of gzio.c that was included in an old version of zlib). Unfortunately, gzio.c still depends on the *internal* zlib header file zutil.h which is not supposed to be used outside of the zlib source code. The dependencies are the use of the gzFile typedef and the F_OPEN() macro. Instead of gzFile, define and use our own ErtsGzFile. To get rid of the F_OPEN() macro, call open() of _wfopen() directly.
2013-12-13erts: Fix compiler warningSverker Eriksson
2013-12-02Merge branch 'maint'Henrik Nord
2013-12-02erts: Remove unused file winsock_func.hSverker Eriksson
2013-11-29Merge branch 'sv/file-osync/OTP-11498'Lukas Larsson
* sv/file-osync/OTP-11498: Add sync option to file:open/2 Conflicts: erts/preloaded/ebin/prim_file.beam
2013-11-26Merge branch 'maint'Raimo Niskanen
Conflicts: erts/preloaded/ebin/prim_inet.beam lib/kernel/test/gen_sctp_SUITE.erl
2013-11-26Merge branch 'maint-r16' into maintRaimo Niskanen
2013-11-20Suppress false valgrind warnings caused by sctp_getpaddrsSverker Eriksson
2013-11-15Add sync option to file:open/2Joseph Blomstedt
The sync option adds the POSIX O_SYNC flag to the open system call on platforms that support the flag or its equivalent, e.g., FILE_FLAG_WRITE_THROUGH on Windows. For platforms that don't support it, file:open/2 returns {error, enotsup} if the sync option is passed in. The semantics of O_SYNC are platform-specific. For example, not all platforms guarantee that all file metadata are written to the disk along with the file data when the flag is in effect. This issue is noted in the documentation this commit adds for the sync option. Add a test for the sync option. Note however that the underlying OS semantics for O_SYNC can't be tested automatically in any practical way, so the test assumes the OS does the right thing with the flag when present. For manual verification, dtruss on OS X and strace on Linux were both run against beam processes to watch calls to open(), and file:open/2 was called in Erlang shells to open files for writing, both with and without the sync option. Both the dtruss output and the strace output showed that the O_SYNC flag was present in the open() calls when sync was specified and was clear when sync was not specified.
2013-11-11Clean up address family handling towards ErlangRaimo Niskanen
2013-11-07Implement prim_inet:socknames/1,2 and prim_inet:peernames/1,2Raimo Niskanen
2013-10-15Merge branch 'maint'Sverker Eriksson
Conflicts: erts/preloaded/ebin/erlang.beam
2013-10-15Merge branch 'rickard-sverker/supercarrier/OTP-11149' into maintSverker Eriksson
* rickard-sverker/supercarrier/OTP-11149: (29 commits) erts: Add test case for erts_mmap erts: Add mutex to init_atoms in erts_mmap.c erts: Fix lock violation for init_atoms in erl_mmap.c erts: Fix misc minor bugs in supercarrier initialization erts: Add erts_mmap stats erts: Add erts_bld_tupleX macros erts: Rename erts_bld_atom_uint_2tup_list to *_uword_* erts: Fix bug in lookup_free_seg erts: Fix race bug in erts_munmap erts: Add HARD_DBG_MSEG erts: Refactor rbt_insert in erl_mmap erts: erts_mmap improved free seg desc management erts: Add documentation for +MMsc* system flags erts: Allow page aligned erts_munmap() erts: Sort tree in super aligned sizes (SA_SZ_ADDR_ORDER) erts: Fix ASSERT bug and void* arithmetics erts: Add mmap argument to erts_debug:get_internal_state erts: Improve erts_mmap out of free descriptor management erts: Cleanup erl_mmap erts: Add __func__ to ERTS_ASSERT macro ...
2013-10-14Merge branch 'maint'Fredrik Gustafsson
2013-09-30erts: Refactor the ASSERT macroSverker Eriksson
Introduce unconditional ERTS_ASSERT and use that for both ASSERT and ASSERT_EXPR.
2013-09-23add {active,N} socket option for TCP, UDP, and SCTPSteve Vinoski
Add the {active,N} socket option, where N is an integer in the range -32768..32767, to allow a caller to specify the number of data messages to be delivered to the controlling process. Once the socket's delivered message count either reaches 0 or is explicitly set to 0 with inet:setopts/2 or by including {active,0} as an option when the socket is created, the socket transitions to passive ({active, false}) mode and the socket's controlling process receives a message to inform it of the transition. TCP sockets receive {tcp_passive,Socket}, UDP sockets receive {udp_passive,Socket} and SCTP sockets receive {sctp_passive,Socket}. The socket's delivered message counter defaults to 0, but it can be set using {active,N} via any gen_tcp, gen_udp, or gen_sctp function that takes socket options as arguments, or via inet:setopts/2. New N values are added to the socket's current counter value, and negative numbers can be used to reduce the counter value. Specifying a number that would cause the socket's counter value to go above 32767 causes an einval error. If a negative number is specified such that the counter value would become negative, the socket's counter value is set to 0 and the socket transitions to passive mode. If the counter value is already 0 and inet:setopts(Socket, [{active,0}]) is specified, the counter value remains at 0 but the appropriate passive mode transition message is generated for the socket. This commit contains a modified preloaded prim_inet.beam due to changes in prim_inet.erl. Add tests for {active,N} mode for TCP, UDP, and SCTP sockets. Add documentation for {active,N} mode for inet, gen_tcp, gen_udp, and gen_sctp.
2013-09-12Remove ^L characters hidden randomly in the code. Not those used in text ↵Pierre Fenoll
files as delimiters. While working on a tool that processes Erlang code and testing it against this repo, I found out about those little sneaky 0xff. I thought it may be of help to other people build such tools to remove non-conforming-to-standard characters.
2013-09-05Merge branch 'raimo/fix-signedness-flaws-in-efile_drv' into maintRaimo Niskanen
* raimo/fix-signedness-flaws-in-efile_drv: Fix EV_* macros and functions signedness flaws
2013-09-04Merge branch 'raimo/linux-network-namespace-sockopt/OTP-11157' into maintRaimo Niskanen
* raimo/linux-network-namespace-sockopt/OTP-11157: Document socket option 'netns' Rudimentary test Make netns option value a string Implement netns for SCTP + bugfixes Implement netns option for TCP and UDP Implement emulator netns support for TCP and UDP
2013-09-02Fix EV_* macros and functions signedness flawsRaimo Niskanen
2013-08-23Create better distribution of files over async threadsPatrik Nyblom
The actual port id is used to create a key from the pointer value which is the ErlDrvPort. To do this a new driver api function driver_async_port_key is added and the driver API minor version is updated. The documentation is updated and the faulty description of how to spread ports over async threads is updated to use the new API. Testcase also added.
2013-08-23Initialize errno properly in win32 efile_may_openfilePatrik Nyblom
2013-08-23Add debug functionality to retrieve async keyPatrik Nyblom
2013-08-20erts: Fix bug in translating ev macros to functionsLukas Larsson
2013-08-13erts: Refactor non-pure macros to functionsLukas Larsson
This is needed as some gcc versions seems to optimize this undefined behaviour in a way which breaks this code.
2013-07-17Implement netns for SCTP + bugfixesRaimo Niskanen
2013-07-17Implement emulator netns support for TCP and UDPRaimo Niskanen
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-05-31kernel: Fix bug in file:pwrite for large data setsSverker Eriksson
Bug introduced in a73414d2e8ad03538 and never released.
2013-05-20Merge branch 'nox/fix-wcwidth/OTP-11106' into maintFredrik Gustafsson
* nox/fix-wcwidth/OTP-11106: Properly guard WIDE_TAG use with HAVE_WCWIDTH in ttsl_drv
2013-05-16Merge branch 'rickard/inet_opts/OTP-11075' into maintRickard Green
* rickard/inet_opts/OTP-11075: Make high_msgq_watermark and low_msgq_watermark generic inet options Conflicts: erts/preloaded/ebin/prim_inet.beam
2013-05-14Properly guard WIDE_TAG use with HAVE_WCWIDTH in ttsl_drvAnthony Ramine
2013-05-08Merge branch 'nox/wide-chars/OTP-11088' into maintFredrik Gustafsson
* nox/wide-chars/OTP-11088: Support wide characters in the shell through wcwidth() Fix bogus DEBUGLOG() incantations in ttsl_drv
2013-05-06Make high_msgq_watermark and low_msgq_watermark generic inet optionsRickard Green
2013-04-27Support wide characters in the shell through wcwidth()Anthony Ramine
There is one remaining bug where ttsl_drv's state ends up inconsistent with the terminal own state; when a wide character is entered on the last column of the terminal. Reported-by: Loïc Hoguin
2013-04-27Fix bogus DEBUGLOG() incantations in ttsl_drvAnthony Ramine
2013-04-22Fix src/dest overlap in ttsl driverLukas Larsson
2013-04-21fix valgrind error in erts/emulator/drivers/unix/ttsl_drv.cSteve Vinoski
Running some valgrind memory checking showed the error below: ==18040== Thread 6: ==18040== Source and destination overlap in memcpy(0xf3f3f04, 0xf3f3f08, 52) ==18040== at 0x4C2CFA0: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==18040== by 0x5CF527: del_chars (ttsl_drv.c:845) ==18040== by 0x5CED5E: ttysl_from_erlang (ttsl_drv.c:658) ==18040== by 0x4982E3: erts_write_to_port (io.c:1235) ==18040== by 0x49A2BD: erts_port_command (io.c:2223) ==18040== by 0x48C054: do_send (bif.c:1962) ==18040== by 0x48CB6E: erl_send (bif.c:2162) ==18040== by 0x566599: process_main (beam_emu.c:1665) ==18040== by 0x4B1A95: sched_thread_func (erl_process.c:4834) ==18040== by 0x6075E2: thr_wrapper (ethread.c:106) ==18040== by 0x5560E99: start_thread (pthread_create.c:308) This occurred on Linux using R15B01 while the shell was emitting a prompt, but the same problem is still present in R16B. Change the memcpy on line 845 of ttsl_drv.c to memmove as valgrind suggests. After the change, verify with valgrind that the error no longer occurs.
2013-03-27Merge branch 'lukas/erts/efile_delayed_write_fix/OTP-10984' into maintLukas Larsson
* lukas/erts/efile_delayed_write_fix/OTP-10984: Do driver_deq in worker threads instead of async_ready
2013-03-13Do driver_deq in worker threads instead of async_readyLukas Larsson
Doing it in async_ready was needed before the pdl was introduced, but now with the pdl the deq no longer needs the port lock to protect it. This was not an issue when async_ready was called in the worker thread, but now (R15B) that it is signalled back to the scheduler, some very nasty race conditions could occur when using driver_timer and async jobs.
2013-03-04erts: Fix void * arithmeticBjörn-Egil Dahlberg
2013-03-04erts: gcc ansi does not allow 'inline'Björn-Egil Dahlberg
2013-03-04erts: Use block comments - ansi styleBjörn-Egil Dahlberg
2013-02-22Merge branch 'egil/win-efile-bugfix/OTP-10890'Björn-Egil Dahlberg
* egil/win-efile-bugfix/OTP-10890: erts: Use correct type for ReadFile bytes read
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-22erts: Use correct type for ReadFile bytes readBjörn-Egil Dahlberg
Using a 64bit type for bytes read will not always clear the higher bits.
2013-02-21Merge branch 'sverk/tcp-exit_on_close-false'Sverker Eriksson
* sverk/tcp-exit_on_close-false: inet_drv: Fix condition to reject INET_REQ_IGNOREFD for UDP and SCTP A stab at fixing bug with {exit_on_close,false} not working
2013-02-15invoke_read_line now remembers read_ahead settingsLukas Larsson