aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
AgeCommit message (Collapse)Author
2015-12-20efile_drv: logic error in compressed file writeMikael Pettersson
Compiling OTP 18.2.1 with gcc-5.3 shows the following warning: drivers/common/efile_drv.c:1538:23: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] The code in question is: if (! (status = erts_gzwrite((ErtsGzFile)d->fd, iov[i].iov_base, iov[i].iov_len)) == iov[i].iov_len) { d->errInfo.posix_errno = d->errInfo.os_errno = errno; /* XXX Correct? */ break; } If we hoist the assignment out of the if for clarity, it becomes: status = erts_gzwrite(..., iov[i].iov_len); if (! status == iov[i].iov_len) { ...; break; } iov_len is > 0 here, and status will equal iov_len if erts_gzwrite succeeded, but will be less than iov_len if an error occurred. "! status" is 0 or 1, which can only equal iov_len if iov_len is 1 and erts_gzwrite detected an error and returned 0. The effect of this mistake is that any error when iov_len >= 2 will skip the conditional code and break statement. In particular, partial writes (0 < status && status < iov_len) will not be flagged as errors. All releases since OTP R8B-0 are affected. The variable "status" is really a boolean, which is to be set to zero on error. The fix is to set status to 1 if erts_gzwrite() returned iov_len and 0 otherwise, and to change the condition to "if (! status) ...". I'm also hoisting the assignment out of the condition since it obscures the code while providing not benefit (the condition in a while or for loop would be a different matter).
2015-12-18Merge branch 'lv/fix-compilation-with-vm-probes/OTP-13209'Björn-Egil Dahlberg
* lv/fix-compilation-with-vm-probes/OTP-13209: Fix compilation with `--enable-vm-probes`
2015-12-18Merge branch 'maint'Henrik Nord
Conflicts: OTP_VERSION erts/vsn.mk
2015-12-18Merge branch 'rickard/ohmq-fixup/OTP-13047'Rickard Green
* rickard/ohmq-fixup/OTP-13047: Fix offset_mqueue
2015-12-17hipe_x86_signal.c: add FreeBSD sigaction codeKenji Rikitake
* erts/emulator/hipe/hipe_x86_signal.c: add FreeBSD sigaction code, based on the Darwin (OS X) code
2015-12-16Fix offset_mqueueRickard Green
2015-12-15erts: Fix bug in check_process_code for literalsSverker Eriksson
2015-12-15Merge branch 'rickard/ohmq-fixup/OTP-13047'Rickard Green
* rickard/ohmq-fixup/OTP-13047: Fix check_process_code()
2015-12-15erts: Add 'fill_heap' to erts_debug:state_internal_stateSverker Eriksson
to make it easy to provoke GC inside/after a BIF or instruction.
2015-12-15erts: Rename proc dict size to arraySizeSverker Eriksson
for naming style consistency.
2015-12-15erts: Refactor proc dict with 'usedSlots'Sverker Eriksson
which is same as old homeSize + splitPosition.
2015-12-15Merge branch 'lukas/erts/forker'Lukas Larsson
* lukas/erts/forker: (28 commits) erts: Never abort in the forked child erts: Mend ASSERT makro for erl_child_setup erts: Allow enomem failures in port_SUITE erts: iter_port sleep longer on freebsd erts: Allow one dangling fd if there is a gethost port erts: Only use forker StackAck on freebsd erts: It is not possible to exit the forker driver erts: Add forker StartAck for port start flowcontrol erts: Fix large open_port arg segfault for win32 erts: Fix memory leak at async open port kernel: Remove cmd server for unix os:cmd erts: Add testcase for huge port environment erts: Move os_pid to port hash to child setup erts: Handle all EINTR and EAGAIN cases in child setup erts: Make child_setup work with large environments erts: Fix forker driver ifdefs for win32 erts: Fix uds socket handling for os x erts: Fix dereferencing of unaligned integer for sparc erts: Flatten too long io vectors in uds write erts: Add fd count test for spawn_driver ... Conflicts: erts/emulator/beam/erl_node_tables.c erts/preloaded/src/erts_internal.erl
2015-12-15erts: Never abort in the forked childLukas Larsson
We always want the error to propagate up to the application when a child cannot be created.
2015-12-15erts: Mend ASSERT makro for erl_child_setupSverker Eriksson
when called by hash.c for example. We use ASSERT from sys.h but erl_child_setup implements its own erl_assert_error() as it doesn't link with sys.o.
2015-12-15erts: Allow enomem failures in port_SUITELukas Larsson
With the new forker implementation also enomem can be returned as an indicator that it is not possible to create more ports.
2015-12-15erts: iter_port sleep longer on freebsdLukas Larsson
2015-12-15erts: Allow one dangling fd if there is a gethost portLukas Larsson
2015-12-15erts: Only use forker StackAck on freebsdLukas Larsson
2015-12-15erts: It is not possible to exit the forker driverLukas Larsson
2015-12-15erts: Add forker StartAck for port start flowcontrolLukas Larsson
An acknowledgement of the Start command has to be managed as we have to make sure that packages are not dropped and also that the close calls do not happen too early.
2015-12-15erts: Fix large open_port arg segfault for win32Lukas Larsson
os_SUITE:large_output_command send a 10k large argument to open_port({spawn,""}) which was too small for the 2K buffer allocated for win32. The buffer is now dynamic and any size can be used.
2015-12-15erts: Fix memory leak at async open portLukas Larsson
When an async open port fails early, it would sometimes leak memory.
2015-12-15erts: Add testcase for huge port environmentLukas Larsson
2015-12-15erts: Move os_pid to port hash to child setupLukas Larsson
Had to move the hashing because of a race that can otherwise happen where a new os_pid value was inserted into the hash before the previous value had been removed. Also replaced the protocol inbetween erts and child setup to be a binary protocol. This was done in order to deal with the varying size of Eterm.
2015-12-15erts: Handle all EINTR and EAGAIN cases in child setupLukas Larsson
2015-12-15erts: Make child_setup work with large environmentsLukas Larsson
2015-12-15erts: Fix forker driver ifdefs for win32Lukas Larsson
2015-12-15erts: Fix uds socket handling for os xLukas Larsson
OS X is very strict in what it requires of you and also gives strange error codes for some errors. In this commit we remap EMSGSIZE to EMFILE and also precisely tune the amount of data we send on the socket so that we can recv only that data. If we try to recv more, recvmsg fails with EPIPE if the remote end has been closed.
2015-12-15erts: Fix dereferencing of unaligned integer for sparcLukas Larsson
2015-12-15erts: Flatten too long io vectors in uds writeLukas Larsson
2015-12-15erts: Add fd count test for spawn_driverLukas Larsson
2015-12-15erts: Create forker process for spawn driverLukas Larsson
Instead of forking from the beam process, we create a separate process in which all forks are done. This has several advantages: 1) performance: * don't have to close all fd's in the world * fork only has to copy stuff from a small process * work is done in a completely seperate process * a 3x performance increase has been measured, can be made even greater (10x) if we cache the environment in child setup 2) stability * the exec is done in another process than beam, which means that if the file that we exec to is on an nfs that is not available right now we will not block a scheduler until the nfs returns. 3) simplicity * don't have to deal with SIGCHLD in the erts Unfortunately, this solution also implies some badness. 1) There will always be a seperate process running together with beam on unix. This could be confusing and undesirable. 2) We have to transfer the entire environment to child_setup for each command. OTP-13088
2015-12-15erts: Move sys drivers to another fileLukas Larsson
2015-12-15erts: Change name of child_setup to erl_child_setupLukas Larsson
2015-12-15erts: Rename sys driver structsLukas Larsson
2015-12-15erts: Refactor out erts functions from hashLukas Larsson
2015-12-15erts: Bump driver minor versionLukas Larsson
2015-12-15erts: Add erl_drv_set_pidLukas Larsson
OTP-13087
2015-12-15erts: Add support for asynchronous open_portLukas Larsson
OTP-13086
2015-12-14Merge branch 'bjorn/deprecate-random/OTP-12502'Björn Gustavsson
* bjorn/deprecate-random/OTP-12502: Deprecate the 'random' module Eliminate mentions of 'random' in documentation mnesia tests: Replace 'random' with 'rand' percept tests: Replace 'random' with 'rand' system tests: Replace 'random' with 'rand' common_test tests: Replace 'random' with 'rand' gs: Remove the contribs directory wx: Replace 'random' with 'rand' stdlib tests: Replace 'random' with 'rand' kernel test: Replace 'random' with 'rand' debugger tests: Replace 'random' with 'rand' compiler tests: Replace 'random' with 'rand' Emulator test suite: Replace use of 'random' with 'rand' Use 'rand' instead of the obsolete 'random' module compile: Eliminate use of the obsolete 'random' module
2015-12-14Merge branch 'maint'Ingela Anderton Andin
2015-12-11Merge branch 'sverk/setnode-rename-bug/OTP-13076' into maintSverker Eriksson
* sverk/setnode-rename-bug/OTP-13076: erts: Fix correct node name for DTRACE
2015-12-11erts: Fix correct node name for DTRACESverker Eriksson
broken by 949de78331b9c4ecb9.
2015-12-11Merge branch 'maint'Sverker Eriksson
2015-12-11Merge branch 'sverk/dist-ctrl-msg-overflow' into maintSverker Eriksson
* sverk/dist-ctrl-msg-overflow: erts: Fix faulty cleanup when receiving broken dist msg
2015-12-11Emulator test suite: Replace use of 'random' with 'rand'Björn Gustavsson
2015-12-11erts: Fix faulty cleanup when receiving broken dist msgSverker Eriksson
Bug introduced in ce8279d6a48d41f9. Thank you valgrind.
2015-12-10Merge branch 'sverk/hash-thresholds'Sverker Eriksson
* sverk/hash-thresholds: erts: Remove unused include files from hash.c erts: Redesign grow/shrink thresholds of hash.c erts: Remove dead code erts_hash_merge
2015-12-10erts: Add sizeMask for faster proc dict indexingSverker Eriksson
2015-12-09erts: Remove ProcDict.usedSverker Eriksson
(homeSize + splitPosition) will do just fine