summaryrefslogtreecommitdiff
path: root/erts/emulator/test/nif_SUITE.erl
Commit message (Collapse)AuthorAgeFilesLines
* Merge 'sverker/master/enif_whereis_pid-dirty-dtor/OTP-15694'Sverker Eriksson2019-03-211-11/+33
|\ | | | | | | | | | | | | * sverker/master/enif_whereis_pid-dirty-dtor: erts: Add test of enif_whereis* from resource destructor erts: Simplify nif_SUITE:nif_whereis* tests erts: Schedule resource destructors always
| * Merge branch 'sverker/enif_whereis_pid-dirty-dtor'Sverker Eriksson2019-03-191-11/+33
| |\ | | | | | | | | | into sverker/master/enif_whereis_pid-dirty-dtor
| | * erts: Add test of enif_whereis* from resource destructorSverker Eriksson2019-03-191-9/+18
| | |
| | * erts: Schedule resource destructors alwaysSverker Eriksson2019-03-191-2/+15
| | | | | | | | | | | | | | | | | | | | | to run user NIF code in a more known execution context. Fixes problems like user calling enif_whereis_pid() in destructor which may need to release process main lock in order to lock reg_tab.
* | | erts: Fix some racy testsSverker Eriksson2019-03-151-16/+21
|/ / | | | | | | | | Wait for resource-holding processes to garbage collect before exiting to know destructors have been called.
* | erts: Add enif_term_typeJohn Högberg2019-03-071-2/+41
| | | | | | | | | | | | This helps avoid long sequences of enif_is_xxx in code that serializes terms (such as JSON encoders) by letting the user switch on the type.
* | erts: Add enif_compare_pidsSverker Eriksson2019-02-201-1/+9
| | | | | | | | as a macro wrappper around enif_compare
* | erts: Add enif_set_pid_undefined & enif_is_pid_undefinedSverker Eriksson2019-02-201-2/+26
| |
* | Merge branch 'maint'Sverker Eriksson2019-02-111-0/+16
|\ \ | |/
| * erts: Add test for bug in enif_make_maps_from_arraysSverker Eriksson2019-02-061-0/+16
| |
* | erts: Add enif_make_monitor_termSverker Eriksson2019-02-011-0/+8
| |
* | erts: Add enif_select_read|write with 'msg_env' argumentSverker Eriksson2019-01-071-32/+35
| |
* | erts: Add ERL_NIF_SELECT_CUSTOM_MSGSverker Eriksson2018-12-201-30/+40
| |
* | Merge branch 'sverker/enif-cancel-select/OTP-15095'Sverker Eriksson2018-09-111-1/+21
|\ \ | |/ |/| | | | | * sverker/enif-cancel-select/OTP-15095: erts: Add ERL_NIF_SELECT_CANCEL flag for enif_select
| * erts: Add ERL_NIF_SELECT_CANCEL flag for enif_selectSverker Eriksson2018-07-201-1/+21
| | | | | | | | to deselect read and/or writes without stop callback.
* | erts: Fix seq_trace to not clear token for system messagesLukas Larsson2018-08-031-2/+56
|/ | | | | | | | | | A lot of erts internal messages used behind APIs to create non-blocking calls, e.g. port_command, would cause the seq_trace token to be cleared from the caller when it should not. This commit fixes that and adds asserts that makes sure that all messages sent have to correct token set. Fixes: ERL-602
* Update copyright yearHenrik Nord2018-06-181-1/+1
|
* Merge PR-1819 from sverker/enif_binary_to_term-bug/OTP-15080Sverker Eriksson2018-05-171-5/+12
|\ | | | | Fix bug in enif_binary_to_term for immediates
| * erts: Fix bug in enif_binary_to_term for immediatesSverker Eriksson2018-05-161-5/+12
| | | | | | | | | | | | | | Symptom: Heap corruption Expanded test case to provoke this bug and test some more term types.
* | Merge branch 'lukas/erts/poll-thread/OTP-14346'Lukas Larsson2018-04-251-1/+1
|\ \ | | | | | | | | | | | | * lukas/erts/poll-thread/OTP-14346: erts: nif resource stop from poll-thread is a indirect call
| * | erts: nif resource stop from poll-thread is a indirect callLukas Larsson2018-04-241-1/+1
| | |
* | | Add enif_make_map_from_arraysJohn Högberg2018-03-231-0/+6
| | |
* | | Merge branch 'maint'John Högberg2018-02-191-2/+28
|\ \ \
| * | | Handle unaligned binaries in enif_inspect_iovecJohn Högberg2018-02-151-2/+28
| | | |
* | | | Merge pull request #1634 from bjorng/bjorn/get_stacktrace-syntax/OTP-14692Björn Gustavsson2017-12-081-5/+4
|\ \ \ \ | | | | | | | | | | Add syntax in try/catch to retrieve the stacktrace directly
| * | | | Use the new syntax in more test suitesBjörn Gustavsson2017-11-301-5/+4
| | |/ / | |/| |
* | | | Add enif_ioq_peek_headJohn Högberg2017-11-301-0/+23
|/ / / | | | | | | | | | | | | | | | | | | This introduces a way to retrieve erlang terms from NIF IO queues without having to resort to copying. OTP-14797
* | | erts: enif_select steal testDmytro Lytovchenko2017-10-021-6/+77
| | |
* | | Merge branch 'maint' into john/erts/merge-zlib-and-vector-qJohn Högberg2017-09-061-2/+182
|\ \ \ | |/ /
| * | erts: Add nif ioqLukas Larsson2017-09-051-2/+182
| | |
* | | Merge branch 'maint'Sverker Eriksson2017-07-251-3/+7
|\ \ \ | |/ /
| * | erts: Fix bug in enif_whereis_pid/portSverker Eriksson2017-07-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | that could cause heap corruption if whereis lookup conflicts with other register updater AND other thread sends on-heap message while main lock is released. Also improved enif_whereis from dirty nifs by passing c_p as NULL.
* | | Fix testcases after removal of non-smp emulatorLukas Larsson2017-07-171-8/+3
|/ /
* | Merge pull request #1400 from tburghart/trb/erts/enif_whereisRickard Green2017-06-091-2/+171
|\ \ | | | | | | | | | | | | Add enif_whereis_pid() and enif_whereis_port() functions OTP-14453
| * | Add enif_whereis_...() functionsTed Burghart2017-05-221-2/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #### Why do we need this new feature? There are cases when a NIF needs to send a message, using `enif_send()`, to a long-lived process with a registered name. A common use-case is logging, where asynchronous fire-and-forget messages are the norm. There can also be cases where a yielding or dirty NIF or background thread may request a callback from a service with additional information it needs to complete its operation, yielding or waiting (with suitable timeouts, etc) until its state has been updated through the NIF module's API. NIFs can only send messages to pids, and the lack of name resolution leaves a complicated dance between separate monitoring processes and the NIF as the only way to keep a NIF informed of the whereabouts of such long-lived processes. Providing a reliable, built-in facility for NIFs to resolve process (or port) names simplifies these use cases considerably. #### Risks or uncertain artifacts? Testing has not exposed any significant risk. The implementation behaves as expected on regular and dirty scheduler threads as well as non-scheduler threads. By constraining the `enif_whereis_...()` functions to their minimal scopes and using patterns consistent with related functions, the implementation, testing, and maintenance burden is low. The API and behavior of existing functions is unchanged. #### How did you solve it? While extending `enif_send()` to operate on a pid or an atom (as `erlang:send/2` does) was attractive, it would have entailed changing the type of its `to_pid` parameter and thereby breaking backward compatibility. The same consideration applies to `enif_port_command()`. That leaves a choice between 1, 2, or 3 new functions: 1. `enif_whereis()` 2. `enif_whereis_pid()` and `enif_whereis_port()` 3. All of the above. While option (1), directly mimicking the behavior of `erlang:whereis/1`, is appealing, it poses potential problems if `pid()` or `port()` are subsequently implemented as non-integral types that must be bound to an owning `ErlNifEnv` instance. Therefore, option (2) has been chosen to use `ErlNifPid`/`ErlNifPort` structures in the API to maintain proper term ownership semantics.
* | | erts: Reduce runtime for nif_SUITE hash testsSverker Eriksson2017-05-231-17/+25
| | | | | | | | | | | | | | | and base allowed hash deviation on nr of standard deviations to make it easier to fiddle with the work load.
* | | erts: Improve message flush in nif_SUITESverker Eriksson2017-05-231-12/+18
| | | | | | | | | | | | | | | | | | Pass number of expected messages in order to wait longer for messages (for slow machines) while not wasting test time waiting for nothing.
* | | erts: Test monitor resource destructor from threadSverker Eriksson2017-05-231-1/+14
|/ / | | | | | | which is scheduled on non-smp VM.
* | Update copyright yearRaimo Niskanen2017-05-041-1/+1
| |
* | erts: Discontinue salted use of enif_hash/phash2Guilherme Andrade2017-04-241-9/+4
| |
* | erts: Add test cases for salted enif_hash callsGuilherme Andrade2017-04-221-41/+107
| |
* | erts: Support custom salt in enif_hashGuilherme Andrade2017-04-221-3/+3
| |
* | erts: Refactor enif_phash2 into enif_hashGuilherme Andrade2017-04-201-3/+44
| | | | | | | | | | A more generic hashing function which can also hash terms based on `make_internal_hash'.
* | erts: Fix random floats in enif_phash2 testsGuilherme Andrade2017-04-201-3/+1
| |
* | erts: Remove enif_phash2_rangedGuilherme Andrade2017-04-201-28/+2
| |
* | erts: Add enif_phash2 and enif_phash2_rangedGuilherme Andrade2017-04-191-2/+83
| | | | | | | | These allow one to hash VM terms from NIF code.
* | Fix nif_SUITE:select for old linuxSverker Eriksson2017-02-221-6/+1
| | | | | | | | | | with pipe capacity equal to PIPE_BUF meaning pipe must be empty to be writable.
* | erts: Skip nif_SUITE:select on windowsSverker Eriksson2017-02-201-0/+7
| | | | | | | | for now...
* | Expand nif_SUITE:monitor_frenzy to verify dtor callsSverker Eriksson2017-02-201-1/+6
| |
* | Expand nif_SUITE:monitor_frenzy with binary_to_termSverker Eriksson2017-02-201-9/+23
| | | | | | | | to provoke resource revival race.