aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
AgeCommit message (Collapse)Author
2017-06-27Merge branch 'maint-19' into maintJohn Högberg
* maint-19: Updated OTP version Update release notes Update version numbers Fix statistics(wall_clock) and statistics(runtime) implementation fixup! erts: Cleanup dropped port tasks correctly erts: Add tests to detect port close race Add a testcase for OTP-13939/ERL-193 erts: Cleanup dropped port tasks correctly Mark socket disconnected on tcp_send_or_shutdown_error
2017-06-14erts: Cleanup dropped port tasks correctlyLukas Larsson
Before this fix, the extra data attached to a port task had to be cleaned up by the calling function. This caused problems because the outputv call, co-allocates the extra data with the port task. So in rare circumstances the port task would be free'd before the extra data was free'd which led to segfault when looking at the port task. This has been fixed by the generic PORT_TASK_ABORT behaviour being used even for tasks dropped in the erts_schedule_proc2port_signal API.
2017-05-16Merge pull request #1435 from SalikhovDinislam/static_funcLukas Larsson
erts: Make erts_schedule_proc2port_signal static
2017-05-05erts: Unbreak --enable-lock-checking --enable-lock-counterSverker Eriksson
both together. Broken in OTP-20.0-rc1 by 7d161f5b475575bd79bd90977b3a79334a8ec658.
2017-05-04Update copyright yearRaimo Niskanen
2017-04-30Make a function staticSalikhov Dinislam
2017-04-12erts: Introduce struct binary_internalsSverker Eriksson
to replace macro ERTS_INTERNAL_BINARY_FIELDS as header in Binary and friends.
2017-04-11erts: Introduce erts_bin_releaseSverker Eriksson
2017-04-11erts: Init refc=1 in erts_bin_drv_alloc*Sverker Eriksson
2017-04-11erts: Init refc=1 in erts_bin_nrml_allocSverker Eriksson
Only term_to_binary needed some extra attention as it used to initialize refc as 0 instead of 1.
2017-03-10Update copyright yearRickard Green
2017-03-01Merge branch 'maint'Lukas Larsson
2017-02-27erts: Fix emasculation of binaries in port_controlLukas Larsson
This fixes a bug introduced in 3671dd2d
2017-02-23Merge branch 'sverker/enif_select/OTP-13684'Sverker Eriksson
* sverker/enif_select: (31 commits) Remove debug printout and comment Fix nif_SUITE:select for old linux Add docs for enif_compare_monitors and ErlNifMonitor Fix ErlNifMonitor handling Remove faulty debug ASSERT erts: Skip nif_SUITE:select on windows Fix enif_select for windows Fix whitebox monitor tests Fix erl_nif doc Expand nif_SUITE:monitor_frenzy to verify dtor calls Expand nif_SUITE:monitor_frenzy with binary_to_term erts: Avoid revival of dying resource by dec_term erts: Add enif_compare_monitors erts: Try fix enif_select for windows erts: Change return value for enif_select erts: Add pid argument to enif_select erts: Beautify enif_select erts: Fix bad_fd_in_pollset error case for enif_select erts: Add enif_monitor_process and enif_demonitor_process erts: Rename ErlNifResource as ErtsResource ...
2017-02-22Merge branch 'maint'Lukas Larsson
2017-02-21erts: Emasculate binaries that are scheduled in port_controlLukas Larsson
2017-02-20Fix ErlNifMonitor handlingSverker Eriksson
2017-02-20Merge branch 'master' into sverker/enif_selectSverker Eriksson
Conflicts: erts/emulator/beam/erl_binary.h erts/emulator/beam/erl_monitors.c erts/emulator/beam/erl_nif.c erts/emulator/beam/global.h erts/emulator/test/nif_SUITE_data/nif_SUITE.c
2017-02-20Fix driver monitor implementationRickard Green
2017-02-14Fixed typos in ertsAndrew Dryga
2017-02-09erts: Add enif_monitor_process and enif_demonitor_processSverker Eriksson
2017-02-06Implement magic referencesRickard Green
Magic references are *intentionally* indistinguishable from ordinary references for the Erlang software. Magic references do not change the language, and are intended as a pure runtime internal optimization. An ordinary reference is typically used as a key in some table. A magic reference has a direct pointer to a reference counted magic binary. This makes it possible to implement various things without having to do lookups in a table, but instead access the data directly. Besides very fast lookups this can also improve scalability by removing a potentially contended table. A couple of examples of planned future usage of magic references are ETS table identifiers, and BIF timer identifiers. Besides future optimizations using magic references it should also be possible to replace the exposed magic binary cludge with magic references. That is, magic binaries that are exposed as empty binaries to the Erlang software.
2017-02-06Merge branch 'maint'Rickard Green
* maint: Atomic reference count of binaries also in non-SMP Conflicts: erts/emulator/beam/erl_fun.c
2017-02-06Atomic reference count of binaries also in non-SMPRickard Green
NIF resources was not handled in a thread-safe manner in the runtime system without SMP support. As a consequence of this fix, the following driver functions are now thread-safe also in the runtime system without SMP support: - driver_free_binary() - driver_realloc_binary() - driver_binary_get_refc() - driver_binary_inc_refc() - driver_binary_dec_refc()
2016-12-02erts: Remove unnecessary 'enable_lcnt' option in locksBjörn-Egil Dahlberg
2016-11-17erts: Refactor crash dumping with cbprintfSverker Eriksson
Instead of passing around a file descriptor use a function pointer to facilitate more advanced backend write logic such as size limitation or compression.
2016-09-06Merge branch 'rickard/drv-send-term-thr-bug/OTP-13866' into maintRickard Green
* rickard/drv-send-term-thr-bug/OTP-13866: Fix thread calls to erl_drv_send_term()/erl_drv_output_term() Conflicts: erts/emulator/beam/io.c
2016-09-05Fix thread calls to erl_drv_send_term()/erl_drv_output_term()Rickard Green
2016-06-10erts: Add port monitorsDmytro Lytovchenko
* erlang:monitor/2 with port argument is added, erlang:demonitor, using port task API and avoiding locking; * port_info and process_info support for monitored ports (with named port monitors support); * Exit signals contain type 'process' or 'port'; * Propagation of port exit signals; * Self-cleaning when origin process dies with monitor on; * 8 test cases + testcase for port driver crashing; * Documentation for all of the above (monitor, demonitor, port_info and process_info) updated
2016-05-27erts: Split large binaries into multiple iovecLukas Larsson
On windows the max size of an iov element is long, i.e. 4GB so in order to write larger binaries to file we split the binary into smaller 2GB chunks so that the write is possible.
2016-05-11erts: Only allow remove from trace_status callbackLukas Larsson
Make it so that it is only possible to remove a tracer via returning remove from an erl_tracer. This limition is put in place in order to avoid a lot of lock checking and taking in various places, especially in regards to trace events happening on dirty schedulers.
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.
2016-05-10Remove conditional dirty schedulers APIRickard Green
2016-05-09Merge branch 'sverker/trace-send-receive-matchspec/OTP-13507'Sverker Eriksson
2016-05-04erts: Add Sender in 'receive' trace matchspecSverker Eriksson
All 'EXIT' and monitor messages are sent from 'system' Timeouts are "sent" from 'clock_service'
2016-05-02erts: Change argument order for LTTng driver_stopBjörn-Egil Dahlberg
* Be consistent.
2016-04-15erts: Don't trace on link events when port is deadLukas Larsson
2016-04-15erts: Extend process and port tracingLukas Larsson
This commit completes the tracing for processes so that all messages sent by a process (via nifs or otherwise) will be traced. The commit also adds tracing of all types of events from ports. When enabling tracing using erlang:trace, the 'all' flag now also enables tracing on all ports. OTP-13496
2016-04-15erts: Implement tracer modulesLukas Larsson
Add the possibility to use modules as trace data receivers. The functions in the module have to be nifs as otherwise complex trace probes will be very hard to handle (complex means trace probes for ports for example). This commit changes the way that the ptab->tracer field works from always being an immediate, to now be NIL if no tracer is present or else be the tuple {TracerModule, TracerState} where TracerModule is an atom that is later used to lookup the appropriate tracer callbacks to call and TracerState is just passed to the tracer callback. The default process and port tracers have been rewritten to use the new API. This commit also changes the order which trace messages are delivered to the potential tracer process. Any enif_send done in a tracer module may be delayed indefinitely because of lock order issues. If a message is delayed any other trace message send from that process is also delayed so that order is preserved for each traced entity. This means that for some trace events (i.e. send/receive) the events may come in an unintuitive order (receive before send) to the trace receiver. Timestamps are taken when the trace message is generated so trace messages from differented processes may arrive with the timestamp out of order. Both the erlang:trace and seq_trace:set_system_tracer accept the new tracer module tracers and also the backwards compatible arguments. OTP-10267
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-04-06Merge branch 'egil/erts/tracing-beam-lttng/OTP-10282'Björn-Egil Dahlberg
* egil/erts/tracing-beam-lttng/OTP-10282: erts: Don't use ratio in carrier lttng tracepoints Add lttng testcases erts: Extend erlang:system_info/1 with lttng Refactor and fix dtrace define in erl_message erts: Add lttng tracepoints for async pool queue erts: Add lttng tracepoints for drivers erts: Add lttng tracepoints for scheduler events erts: Add lttng tracepoints for memory carriers erts: Update lttng-wrapper with mfa conversion erts: Teach lttng to configure and build system
2016-04-06erts: Add lttng tracepoints for driversBjörn-Egil Dahlberg
* driver_event * driver_flush * driver_finish * driver_init * driver_output * driver_outputv * driver_process_exit * driver_ready_async * driver_ready_input * driver_ready_output * driver_start * driver_stop * driver_stop_select * driver_timeout
2016-03-29Merge branch 'lukas/erts/enif_trace_functions/OTP-13442'Lukas Larsson
* lukas/erts/enif_trace_functions/OTP-13442: erts: Fix bug in enif_send erts: Fix windows nif port tests erts: Fix bug in enif_term_to_binary erts: Remove printout when dec_term fails in DEBUG erts: Polish erl_nif docs erts: Improve enif_binary_to_term erts: Add enif_port_command erts: Add enif_term_to_binary and enif_binary_to_term erts: Add enif_is_process/port_alive erts: Add enif_cpu/now_time and enif_make_unique_integer
2016-03-29erts: Improve enif_binary_to_termSverker Eriksson
* Accept a raw data buffer instead of ErlNifBinary * Accept option ERL_NIF_BIN2TERM_SAFE * Return number of read bytes
2016-03-29erts: Add enif_port_commandLukas Larsson
2016-03-29Merge branch 'rickard/improve-psd/OTP-13428'Rickard Green
* rickard/improve-psd/OTP-13428: Improve process/port specific data management
2016-03-29Merge branch 'rickard/port-sig-dropped-fix/OTP-13424'Rickard Green
* rickard/port-sig-dropped-fix/OTP-13424: Fix implementation of dropped signal to port
2016-03-24Improve process/port specific data managementRickard Green
2016-03-18Fix implementation of dropped signal to portRickard Green
2016-03-15update copyright-yearHenrik Nord