aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
AgeCommit message (Collapse)Author
2014-03-19Merge branch 'josevalim/set_cwd-typespec'Henrik Nord
* josevalim/set_cwd-typespec: Correct file:set_cwd/1 typespec OTP-11787
2014-03-14erts: Add distribution capability flag for maps DFLAG_MAP_TAGSverker Eriksson
This is just a preparation to allow detection of older nodes that do not understand maps (R16 and older).
2014-03-10Correct file:set_cwd/1 typespecJosé Valim
file:set_cwd/1 accepts binaries as arguments, however the binaries must be properly encoded as per file:native_name_encoding/0. Also update the note under no_translation error to refer that passing a ISO-latin-1 encoded binary under any unicode file name encoding.
2014-02-28Delay patching of closures to eliminate a race conditionBjörn Gustavsson
The loader of native code tries to avoid race condition by bringing down the system to a single scheduler. Unfortunately, that will not completely avoid race conditions beacuse other processes may still run while the code is being loaded. Therefore, we must still make sure that native code has been fully fixed up before it can be executed. Under unlucky circumstances, it was possible for the global name register process to call a fun in native code before the native code for the fun had been fully fixed up. The run-time system would crash when running the not-fully-fixed-up code. Here is a way to make the bug 100% reproducible. First add this function to the 'global' module: silly_looper(List) -> lists:foreach(fun(E) -> put(any_atom, E) end, List), silly_looper(List). Then insert the following code at the beginning of the init/1 function in the 'global' module: spawn_link(fun() -> silly_looper(lists:seq(1, 100)) end), The run-time system will crash during start up when the native code for the 'global' module is being loaded. What will happen is that lists:foreach/2 (which runs in native code) will call the native code for the fun in silly_looper/1 before the reference to 'any_atom' has been changed from a 0 to the proper tagged atom value. The put/2 BIF will exit when attempting to calculate the hash value for the illegal value 0 (it is not properly tagged). To eliminate this race condition, we must delay patching the native code addresses for a fun into the fun entry until the native code has been fully fixed up. We will use the new BIFs introduced in the previous commit. While we are at it, we will also make sure that we erase any temporary variables in the process dictionary used by the hipe_unified_loader module.
2014-02-28hipe: Break apart hipe_bif:make_fe/3 into two BIFsBjörn Gustavsson
This commit is a preparation for eliminating a race condition loading the native code for modules whose BEAM code has already been loaded. Here we introduce two new BIFs so that looking up a fun entry is separate from setting the native address in the fun entry.
2014-02-23Deprecate pre-defined built-in typesHans Bolinder
The types array(), dict(), digraph(), gb_set(), gb_tree(), queue(), set(), and tid() have been deprecated. They will be removed in OTP 18.0. Instead the types array:array(), dict:dict(), digraph:graph(), gb_set:set(), gb_tree:tree(), queue:queue(), sets:set(), and ets:tid() can be used. (Note: it has always been necessary to use ets:tid().) It is allowed in OTP 17.0 to locally re-define the types array(), dict(), and so on. New types array:array/1, dict:dict/2, gb_sets:set/1, gb_trees:tree/2, queue:queue/1, and sets:set/1 have been added.
2014-02-21Merge branch 'hb/kernel/spec_bug_fix/OTP-11730'Hans Bolinder
* hb/kernel/spec_bug_fix/OTP-11730: Correct the contract of inet:ntoa/1
2014-02-20Merge branch 'siri/appup_tests_17/OTP-11534'Siri Hansen
* siri/appup_tests_17/OTP-11534: Update sasl/test/test_lib.hrl with recent versions of kernel and stdlib Update appups and appup tests for kernel, stdlib and sasl
2014-02-20Correct the contract of inet:ntoa/1Hans Bolinder
Thanks to Max Treskin.
2014-02-19kernel: Fix an application terminate deadlock possibilityDan Gudmundsson
Could happen if get_child was called during terminate. io (since it is a group_leader) also causes problems after get_child was called. Split up and do it async.
2014-02-14Merge branch 'josevalim/jv-persistent-set-env'Henrik Nord
* josevalim/jv-persistent-set-env: Allow persistent option on set_env/4 and unset_env/3 OTP-11708
2014-02-12Fix a few of Dialyzer's unmatched_return warningsHans Bolinder
2014-02-12Update appups and appup tests for kernel, stdlib and saslSiri Hansen
Appups now only support one major release back, and the tests are updated accordingly. Support is also added in tests for giving previous releases in a ct config file, e.g. {otp_releases,[{r15,"/path/to/r15/bin/erl"}, {r16,"/path/to/r16/bin/erl"}, {'17',"/path/to/17/bin/erl"}]}.
2014-02-11Allow persistent option on set_env/4 and unset_env/3José Valim
An environment key set with the persistent option will not be overridden by the ones configured in the application resource file on load. This means persistent values will stick after the application is loaded and also on application reload.
2014-01-27erts/kernel: sendfile no longer uses async threadsLukas Larsson
This has been done because a slow client attack is possible if the async thread pool is used. The scenario is: Client does a request for a file and then slowly receives the file one byte at a time. This will eventually fill the async thread pool with blocking sendfile operations and thus starving the vm of all file operations. If you still want to use the async threads pool for sendfile an option to enable it has been introduced.
2013-12-10Update versions of OTP, erts, kernel, and stdlibRickard Green
Update versions of OTP, erts, kernel, and stdlib to comply with the new version scheme decided by the OTP technical board.
2013-12-07Merge branch 'rickard/garbage_collect/OTP-11388'Rickard Green
* rickard/garbage_collect/OTP-11388: Parallel check_process_code when code_server purge a module Functionality for disabling garbage collection Use asynchronous check_process_code in code_parallel_SUITE Execution of system tasks in context of another process Conflicts: bootstrap/lib/kernel/ebin/hipe_unified_loader.beam erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam
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-18Parallel check_process_code when code_server purge a moduleRickard Green
When the code_server is about to purge a module it will now issue asynchronous check_process_code requests to all processes at once instead of one at a time. These check_process_code operation can execute in parallel.
2013-11-18Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/kernel/ebin/os.beam
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-09Add os:unsetenv/1Martin Hässler
New BIF os:unsetenv/1 which deletes an environment variable and returns 'true'. Does not change any old functionality. Calls the libc function unsetenv(3) on UNIX and SetEnvironmentVariableW(key, NULL) on Windows. The unicode support is the same as for os:getenv and os:putenv.
2013-11-07Implement inet:socknames/1,2 and inet:peernames/1,2Raimo Niskanen
2013-11-07Implement prim_inet:socknames/1,2 and prim_inet:peernames/1,2Raimo Niskanen
2013-10-23Merge branch 'maint'Fredrik Gustafsson
2013-10-23Merge branch 'ates/sctp_errors_fix/OTP-11379' into maintFredrik Gustafsson
* ates/sctp_errors_fix/OTP-11379: Update primary bootstrap Add more SCTP errors as described in RFC 4960
2013-10-11Merge branch 'maint'Fredrik Gustafsson
2013-10-10Add more SCTP errors as described in RFC 4960Artem Teslenko
2013-10-10Fix the typespec for the inet:ifget/2 and inet:ifget/3 return valueAli Sabil
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-09Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
2013-09-09Merge branch 'ks/hipe_unified_loader-cleanup/OTP-11301' into maintFredrik Gustafsson
* ks/hipe_unified_loader-cleanup/OTP-11301: Updated primary bootstrap Cleanup of the file
2013-09-04Merge branch 'maint'Raimo Niskanen
Conflicts: erts/preloaded/ebin/prim_inet.beam
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-04Cleanup of the fileKostis Sagonas
Consisting of three items: - Eliminate uses of is_subtype/2 in specs - Change module-local void functions to return 'ok' instead of [] - Make sure there are no dialyzer warnings with --Wunmatched_returns
2013-08-21Merge branch 'maint'Fredrik Gustafsson
2013-08-21Merge branch 'fh/start-all/OTP-11250' into maintFredrik Gustafsson
* fh/start-all/OTP-11250: kernel: fix documentation regarding ensure_all_started endtag Updated primary bootstrap Add application:ensure_all_started/1-2
2013-08-05Merge branch 'maint'Fredrik Gustafsson
2013-08-05Merge branch 'fredrik/inet/clarify_doc_address/OTP-10676' into maintFredrik Gustafsson
* fredrik/inet/clarify_doc_address/OTP-10676: kernel: fixed specs to inet:ntoa/1 kernel: changed tests where inet_parse:ntoa/1 was used to inet:parse/1 kernel: added ntoa documentation and exported it in inet.erl kernel: clarified inet:parse_address/1 referrering to old code
2013-08-05Merge branch 'maint'Fredrik Gustafsson
2013-08-01Fix typo in abcast() function commentJohannes Weißl
2013-07-30kernel: fixed specs to inet:ntoa/1Fredrik Gustafsson
2013-07-30kernel: added ntoa documentation and exported it in inet.erlFredrik Gustafsson
2013-07-24Merge branch 'maint'Björn-Egil Dahlberg
2013-07-21Fix indentation of User switch command help in Erlang shellsyl20bnr
2013-07-17Make netns option value a stringRaimo Niskanen
2013-07-17Implement netns for SCTP + bugfixesRaimo Niskanen
2013-07-17Implement netns option for TCP and UDPRaimo Niskanen