aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-08-28add enif_schedule_nif() to NIF APISteve Vinoski
In the #erlang IRC channel Anthony Ramine once mentioned the idea of allowing a NIF to use an emulator trap, similar to a BIF trap, to schedule another NIF for execution. This is exactly how dirty NIFs were implemented for Erlang/OTP 17.0, so this commit refactors and generalizes that dirty NIF code to support a new enif_schedule_nif() API function. The enif_schedule_nif() function allows a long-running NIF to be broken into separate NIF invocations. The NIF first executes part of the long-running task, then calls enif_schedule_nif() to schedule a NIF for later execution to continue the task. Any number of NIFs can be scheduled in this manner, one after another. Since the emulator regains control between invocations, this helps avoid problems caused by native code tying up scheduler threads for too long. The enif_schedule_nif() function also replaces the original experimental dirty NIF API. The function takes a flags parameter that a caller can use to indicate the NIF should be scheduled onto either a dirty CPU scheduler thread, a dirty I/O scheduler thread, or scheduled as a regular NIF on a regular scheduler thread. With this change, the original experimental enif_schedule_dirty_nif(), enif_schedule_dirty_nif_finalizer() and enif_dirty_nif_finalizer() API functions are no longer needed and have been removed. Explicit scheduling of a dirty NIF finalization function is no longer necessary; if an application wants similar functionality, it can have a dirty NIF just invoke enif_schedule_nif() to schedule a non-dirty NIF to complete its task. Lift the restriction that dirty NIFs can't call enif_make_badarg() to raise an exception. This was a problem with the original dirty NIF API because it forced developers to get and check all incoming arguments in a regular NIF, and then schedule the dirty NIF which then had to get all the arguments again. Now, the argument checking can be done in the dirty NIF and it can call enif_make_badarg() itself to flag incorrect arguments. Extend the ErlNifFunc struct with a new flags field that allows NIFs to be declared as dirty. The default value for this field is 0, indicating a regular NIF, so it's backwards compatible with all existing statically initialized ErlNifFunc struct instances, and so such instances require no code changes. Defining the flags field with a value of ERL_NIF_DIRTY_JOB_CPU_BOUND indicates that the NIF should execute on a dirty CPU scheduler thread, or defining it with a value of ERL_NIF_DIRTY_JOB_IO_BOUND indicates that the NIF should execute on a dirty I/O scheduler thread. Any other flags field value causes a NIF library loading error. Extend the ErlNifEntry struct with a new options field that indicates whether a NIF library was built with support for optional features such as dirty NIFs. When a NIF library is loaded, the runtime checks the options field to ensure compatibility. If a NIF library built with dirty NIF support is loaded into a runtime that does not support dirty NIFs, and the library defines one or more ErlNifFunc entries with non-zero flags fields indicating dirty NIFs, a NIF library loading error results. There is no error if a NIF library built with dirty NIF support is loaded into a runtime that does not support dirty NIFs but the library does not have any dirty NIFs. It is also not an error if a library without dirty NIF support is loaded into a runtime built with dirty NIF support. Add documentation and tests for enif_schedule_nif().
2014-08-22DevelopmentMarcus Arendt
2014-08-22Merge branch 'marcus/OTP-17.2.1/mergefix' into maintMarcus Arendt
* marcus/OTP-17.2.1/mergefix: Updated OTP version Update release notes
2014-08-22Updated OTP versionErlang/OTP
2014-08-22Update release notesErlang/OTP
2014-08-21Merge branch 'egil/proc_lib-optimizations/OTP-12060' into maintBjörn-Egil Dahlberg
* egil/proc_lib-optimizations/OTP-12060: stdlib: Update dependencies to erts-6.2 erts: Update preloaded erlang.beam stdlib: Use erlang:fun_info_mfa/1 in proc_lib:init_p/3 erts: Test erlang:fun_info_mfa/1 erts: Introduce erlang:fun_info_mfa/1
2014-08-21Merge branch 'nox/reedr-logging/OTP-12115' into maintLukas Larsson
* nox/reedr-logging/OTP-12115: Add number of entries to mnesia copy debug message Add thread index to allocator enomem dump slogan Add run queue index to process dump info Add missing error string to syslog logging in epmd Demote rare debug slogan of message discarding to debug build
2014-08-21Merge branch 'maint-17' into maintMarcus Arendt
2014-08-21Merge branch 'ia/ssl/dialyzer-certificate_requests' into maintIngela Anderton Andin
* ia/ssl/dialyzer-certificate_requests: ssl: Fix boolean expression ssl: Fix broken contract
2014-08-21Merge branch 'lucafavatella/accept-ip-in-net_adm-names' into maintMarcus Arendt
* lucafavatella/accept-ip-in-net_adm-names: Refactor erl_epmd:names/1 Accept inet:ip_address() in net_adm:names/1
2014-08-21Merge branch 'hb/dialyzer/bugfixes/OTP-12018' into maintHans Bolinder
* hb/dialyzer/bugfixes/OTP-12018: dialyzer, hipe: Fix a bug concerning is_record/2,3
2014-08-21dialyzer, hipe: Fix a bug concerning is_record/2,3Hans Bolinder
Also fixed some cases where Dialyzer could crash due to reaching system limits.
2014-08-21Merge branch 'hb/dialyzer/bugfix/OTP-12111' into maintHans Bolinder
* hb/dialyzer/bugfix/OTP-12111: dialyzer: fix a -Wunderspecs bug
2014-08-20dialyzer: fix a -Wunderspecs bugHans Bolinder
Sometimes bogus warnings were generated for parametrized types. Thanks to Krzesimir Sarnecki for pointing the bug out. Also corrected warnings where the structure of opaque types were exposed (thanks to Kostis for pointing the bug out).
2014-08-20Updated OTP versionOTP-17.2.1Erlang/OTP
2014-08-20Update release notesErlang/OTP
2014-08-20Merge branch 'hans/ssh/patch-17.0.2' into maint-17Erlang/OTP
* hans/ssh/patch-17.0.2: ssh: Updated vsn.mk ssh: negotiation_timeout bug fixed ssh: Negotiation_timeout testcase
2014-08-20ssh: Updated vsn.mkHans Nilsson
2014-08-20ssh: negotiation_timeout bug fixedHans Nilsson
2014-08-20ssh: Negotiation_timeout testcaseHans Nilsson
2014-08-19ssl: Fix boolean expressionIngela Anderton Andin
2014-08-18stdlib: Update dependencies to erts-6.2Björn-Egil Dahlberg
2014-08-18ssl: Fix broken contractIngela Anderton Andin
2014-08-14Merge branch 'rickard/+swct/OTP-12102' into maintRickard Green
* rickard/+swct/OTP-12102: Fix +swct doc
2014-08-14Fix +swct docRickard Green
2014-08-14Add number of entries to mnesia copy debug messageRick Reed
2014-08-14Refactor erl_epmd:names/1Luca Favatella
Simplify erl_epmd:names/1, keeping the same functionalities, relying on inet:gethostbyname/1 being able to handle both atoms and strings.
2014-08-14Accept inet:ip_address() in net_adm:names/1Luca Favatella
This change also simplifies the code avoiding a double (conditional) call to inet:gethostbyname/1 (in net_adm:names/1 and then erl_epmd:names/1).
2014-08-14Merge branch 'hans/ssh/new_test_case' into maintHans Nilsson
* hans/ssh/new_test_case: ssh: Add testcases for max_sessions option
2014-08-14ssh: Add testcases for max_sessions optionHans Nilsson
Now checks that if we have max_session sessions we could close one session and open a new one. That is checked both for parallel and non-parallel logins.
2014-08-14Merge branch 'ia/ssl/certificate_types/certificate_requests/OTP-12026' into ↵Ingela Anderton Andin
maint * ia/ssl/certificate_types/certificate_requests/OTP-12026: public_key: Updated User Guide with ECC records ssl: Make sure the correct ROOT-cert is used ssl: Test ECDSA and improve test suite maintainability public_key: Correct ASN1-type EcpkParameters in PEM handling public_key: Correct ASN-1 spec ssl: Correct handling of certificate_types in Certificate Requests
2014-08-14public_key: Updated User Guide with ECC recordsIngela Anderton Andin
2014-08-14Merge branch 'lukas/erts/fix_neg_of_int64_min/OTP-12097' into maintLukas Larsson
* lukas/erts/fix_neg_of_int64_min/OTP-12097: erts: Fix neg int overflow when sint is min size
2014-08-14Merge branch 'nox/clang-ubsan/OTP-12097' into maintLukas Larsson
* nox/clang-ubsan/OTP-12097: Properly handle SINT_MIN in small_to_big() Use offsetof() in io.c
2014-08-13Merge branch 'pascalchap/observer_issue' into maintMarcus Arendt
* pascalchap/observer_issue: correction of huge status bar
2014-08-11Merge branch 'hans/ssh/prepare-release' into maintHans Nilsson
* hans/ssh/prepare-release: ssh: Updated vsn.mk
2014-08-11ssh: Updated vsn.mkHans Nilsson
2014-08-11Merge branch 'hans/ssh/negotiation_timeout_bug/OTP-12057' into maintHans Nilsson
* hans/ssh/negotiation_timeout_bug/OTP-12057: ssh: negotiation_timeout bug fixed ssh: Negotiation_timeout testcase
2014-08-11ssh: negotiation_timeout bug fixedHans Nilsson
2014-08-11ssh: Negotiation_timeout testcaseHans Nilsson
2014-08-11ssl: Make sure the correct ROOT-cert is usedIngela Anderton Andin
When dealing with older certificates that does not indicate its signer with a certificate extension, we must search the database for the issure. Finding the issuer is not enough, we need to verify the signature with the key in the found issuer cert.
2014-08-11ssl: Test ECDSA and improve test suite maintainabilityIngela Anderton Andin
Use generated certs instead of hard coded
2014-08-11Merge branch 'rickard/nosuspend-bug/OTP-12082' into maintRickard Green
* rickard/nosuspend-bug/OTP-12082: Fix build of test port program Update Makefile.src Add async_ports test Fix abort of nosuspend-tasks in erts_port_task_schedule()
2014-08-08erts: Fix neg int overflow when sint is min sizeLukas Larsson
When INT64_MIN is the value of a Sint64 we have to first cast it to an Uint64 before negating it. Otherwise we get an integer overflow which is undefined behaviour and in gcc 4.9 this results in -0 instead of -9223372036854775808 in gcc 4.8.
2014-08-08Merge branch 'tuncer/sanitizers' into maintBruce Yinhe
OTP-12081 * tuncer/sanitizers: Implement --enable-sanitizers[=sanitizers]
2014-08-08Merge branch 'maint-17' into maintMarcus Arendt
2014-08-08public_key: Correct ASN1-type EcpkParameters in PEM handlingIngela Anderton Andin
2014-08-08public_key: Correct ASN-1 specIngela Anderton Andin
2014-08-08ssl: Correct handling of certificate_types in Certificate RequestsIngela Anderton Andin
FROM TLS 1.2 RFC: The interaction of the certificate_types and supported_signature_algorithms fields is somewhat complicated. certificate_types has been present in TLS since SSLv3, but was somewhat underspecified. Much of its functionality is superseded by supported_signature_algorithms. The following rules apply: - Any certificates provided by the client MUST be signed using a hash/signature algorithm pair found in supported_signature_algorithms. - The end-entity certificate provided by the client MUST contain a key that is compatible with certificate_types. If the key is a signature key, it MUST be usable with some hash/signature algorithm pair in supported_signature_algorithms. - For historical reasons, the names of some client certificate types include the algorithm used to sign the certificate. For example, in earlier versions of TLS, rsa_fixed_dh meant a certificate signed with RSA and containing a static DH key. In TLS 1.2, this functionality has been obsoleted by the supported_signature_algorithms, and the certificate type no longer restricts the algorithm used to sign the certificate. For example, if the server sends dss_fixed_dh certificate type and {{sha1, dsa}, {sha1, rsa}} signature types, the client MAY reply with a certificate containing a static DH key, signed with RSA- SHA1.
2014-08-08Merge branch 'lukas/erts/malloc_failure_errors/OTP-12085' into maintLukas Larsson
* lukas/erts/malloc_failure_errors/OTP-12085: erts: Print error reason when malloc fails