aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32/sys.c
AgeCommit message (Collapse)Author
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: 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-06-18Change license text to APLv2Bruce Yinhe
2015-03-21Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: Unbreak lcnt
2015-03-21Unbreak lcntRickard Green
2015-03-20Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: (22 commits) Update primary bootstrap inets: Suppress deprecated warning on erlang:now/0 inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules inets: Update comments Suppress deprecated warning on erlang:now/0 Use new time API and be back-compatible in inets Remove unused functions and removed redundant test asn1 test SUITE: Eliminate use of now/0 Disable deprecated warning on erlang:now/0 in diameter_lib Use new time API and be back-compatible in ssh Replace all calls to now/0 in CT with new time API functions test_server: Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API otp_SUITE: Warn for calls to erlang:now/0 Replace usage of erlang:now() with usage of new API Multiple timer wheels Erlang based BIF timer implementation for scalability Implement ethread events with timeout ... Conflicts: bootstrap/bin/start.boot bootstrap/bin/start_clean.boot bootstrap/lib/compiler/ebin/beam_asm.beam bootstrap/lib/compiler/ebin/compile.beam bootstrap/lib/kernel/ebin/auth.beam bootstrap/lib/kernel/ebin/dist_util.beam bootstrap/lib/kernel/ebin/global.beam bootstrap/lib/kernel/ebin/hipe_unified_loader.beam bootstrap/lib/kernel/ebin/inet_db.beam bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/kernel/ebin/inet_res.beam bootstrap/lib/kernel/ebin/os.beam bootstrap/lib/kernel/ebin/pg2.beam bootstrap/lib/stdlib/ebin/dets.beam bootstrap/lib/stdlib/ebin/dets_utils.beam bootstrap/lib/stdlib/ebin/erl_tar.beam bootstrap/lib/stdlib/ebin/escript.beam bootstrap/lib/stdlib/ebin/file_sorter.beam bootstrap/lib/stdlib/ebin/otp_internal.beam bootstrap/lib/stdlib/ebin/qlc.beam bootstrap/lib/stdlib/ebin/random.beam bootstrap/lib/stdlib/ebin/supervisor.beam bootstrap/lib/stdlib/ebin/timer.beam erts/aclocal.m4 erts/emulator/beam/bif.c erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_db_hash.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_thr_progress.c erts/emulator/beam/utils.c erts/emulator/sys/unix/sys.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam erts/preloaded/src/erts_internal.erl lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl lib/diameter/src/base/diameter_lib.erl lib/kernel/src/os.erl lib/ssh/test/ssh_basic_SUITE.erl system/doc/efficiency_guide/advanced.xml
2015-03-20Introduce a new time APIRickard Green
The old time API is based on erlang:now/0. The major issue with erlang:now/0 is that it was intended to be used for so many unrelated things. This tied these unrelated operations together and unnecessarily caused performance, scalability as well as accuracy, and precision issues for operations that do not need to have such issues. The new API spreads different functionality over multiple functions in order to improve on this. The new API consists of a number of new BIFs: - erlang:convert_time_unit/3 - erlang:monotonic_time/0 - erlang:monotonic_time/1 - erlang:system_time/0 - erlang:system_time/1 - erlang:time_offset/0 - erlang:time_offset/1 - erlang:timestamp/0 - erlang:unique_integer/0 - erlang:unique_integer/1 - os:system_time/0 - os:system_time/1 and a number of extensions of existing BIFs: - erlang:monitor(time_offset, clock_service) - erlang:system_flag(time_offset, finalize) - erlang:system_info(os_monotonic_time_source) - erlang:system_info(time_offset) - erlang:system_info(time_warp_mode) - erlang:system_info(time_correction) - erlang:system_info(start_time) See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
2014-12-19erts: Improve crash dumpsLukas Larsson
This commit improves crash dumps in several ways: * Suspends schedulers to get a current snapshot * Dumps information about scheduler * Dumps stack trace of current running process (including Garbing processes)
2014-11-05Merge branch 'maint'Lukas Larsson
* maint: erts: Fix hanging in fd_stop on windows
2014-10-30erts: Fix hanging in fd_stop on windowsLukas Larsson
When reaping ports the flushReplyEvent is not signalled and therefore an errornous loop check caused the emulator to hang forever during shutdown.
2014-06-11Merge branch 'maint'Henrik Nord
2014-05-25Fix permissions of some files in the repositoryAnthony Ramine
These files aren't supposed to be executable. For reference, the command used to find them was: git ls-files -z | xargs -0 -J % find % -type f -perm ++x
2014-04-10win32: Fix quoting of pathsLukas Larsson
2014-02-24Merge branch 'lukas/ose/master/OTP-11334'Lukas Larsson
* lukas/ose/master/OTP-11334: (71 commits) erts: Fix unix efile assert ose: Use -O2 when building ose: Expand OSE docs ose: Add dummy ttsl driver ose: Cleanup cleanup of mutex selection defines ose: Polish mmap configure checks ose: Add ose specific x-compile flags ose: Updating fd_driver and spawn_driver for OSE ose: Updating event and signal API for OSE ose: Cleanup of mutex selection defines win32: Compile erl_log.exe ose: Remove uneccesary define ose: Fix ssl configure test for osx erts: Fix sys_msg_dispatcher assert ose: Fix broken doc links ose: Thread priorities configurable from lmconf ose: Yielding the cpu is done "the OSE" way ose: Start using ppdata for tse key ose: Do not use spinlocks on OSE ose: Fix support for crypto ... Conflicts: lib/crypto/c_src/crypto.c
2014-02-24ose,erts: Specify name for tsd keysLukas Larsson
This simplified debugging on OSE and also limits the number of ppdata keys that are created when beam is restarted.
2014-02-19erts: Fix faulty asserts in erts_sys_aligned_alloc/freeSverker Eriksson
2013-10-15Merge branch 'maint'Sverker Eriksson
Conflicts: erts/preloaded/ebin/erlang.beam
2013-09-30erts: Add __func__ to ERTS_ASSERT macroSverker Eriksson
2013-09-30Merge branch 'maint'Fredrik Gustafsson
2013-09-25Merge branch 'rickard/aligned-sys_alloc-carriers/OTP-11318' into ↵Rickard Green
rickard/aligned-sys_alloc-carriers_maint/OTP-11318 Conflicts: erts/emulator/beam/erl_alloc.c erts/emulator/beam/erl_alloc_util.c erts/emulator/beam/erl_alloc_util.h
2013-09-25Implement platform specific aligned sys_alloc and use when supportedRickard Green
erts_sys_aligned_alloc() is currently implemented using posix_memalign if it exist, or using _aligned_malloc on Windows. If erts_sys_aligned_alloc() exist allocators will create sys_alloc carriers similar to how this was done pre-R16.
2013-06-03erts: Change erlang:open_port spawn to handle unicodeDan Gudmundsson
Previously only 'spawn_executable' handled unicode input. Also change 'cd' option to always handle unicode. Update open_port documentation and tests
2013-03-27Repeat flush loop at timeout intervalsLukas Larsson
2013-02-23Merge branch 'rickard/win-drv-bugfix/OTP-10803'Rickard Green
* rickard/win-drv-bugfix/OTP-10803: Fix close_active_handle() properly
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-22Fix close_active_handle() properlyRickard Green
2013-02-14Merge branch 'rickard/win-drv-bugfix/OTP-10807'Rickard Green
* rickard/win-drv-bugfix/OTP-10807: Fix flush of fd-driver on Windows
2013-02-14Merge branch 'rickard/win-drv-bugfix/OTP-10803'Rickard Green
* rickard/win-drv-bugfix/OTP-10803: Fix unsafe accesses to driver data from win32 fd/vanilla/spawn drivers
2013-02-14Merge branch 'rickard/win-drv-bugfix/OTP-10802'Rickard Green
* rickard/win-drv-bugfix/OTP-10802: Fix unsafe driver_select() from win32 vanilla/spawn drivers
2013-02-13Fix driver port accessesRickard Green
2013-02-05Fix flush of fd-driver on WindowsRickard Green
2013-02-04Fix unsafe accesses to driver data from win32 fd/vanilla/spawn driversRickard Green
2013-02-01Fix unsafe driver_select() from win32 vanilla/spawn driversRickard Green
2012-12-07Merge branch 'rickard/port-optimizations/OTP-10336' into ↵Rickard Green
rickard/r16/port-optimizations/OTP-10336 * rickard/port-optimizations/OTP-10336: Change annotate level for emacs-22 in cerl Update etp-commands Add documentation on communication in Erlang Add support for busy port message queue Add driver callback epilogue Implement true asynchronous signaling between processes and ports Add erl_drv_[send|output]_term Move busy port flag Use rwlock for driver list Optimize management of port tasks Improve configuration of process and port tables Remove R9 compatibility features Use ptab functionality also for ports Prepare for use of ptab functionality also for ports Atomic port state Generalize process table implementation Implement functionality for delaying thread progress from unmanaged threads Conflicts: erts/doc/src/erl_driver.xml erts/doc/src/erlang.xml erts/emulator/beam/beam_bif_load.c erts/emulator/beam/beam_bp.c erts/emulator/beam/beam_emu.c erts/emulator/beam/bif.c erts/emulator/beam/copy.c erts/emulator/beam/erl_alloc.c erts/emulator/beam/erl_alloc.types erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_bif_port.c erts/emulator/beam/erl_bif_trace.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_message.c erts/emulator/beam/erl_port_task.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_process_lock.c erts/emulator/beam/erl_trace.c erts/emulator/beam/export.h erts/emulator/beam/global.h erts/emulator/beam/io.c erts/emulator/sys/unix/sys.c erts/emulator/sys/vxworks/sys.c erts/emulator/test/port_SUITE.erl erts/etc/unix/cerl.src erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/prim_inet.beam erts/preloaded/src/prim_inet.erl lib/hipe/cerl/erl_bif_types.erl lib/kernel/doc/src/inet.xml lib/kernel/src/inet.erl
2012-12-06Merge branch 'maint'Ingela Anderton Andin
Conflicts: erts/emulator/sys/vxworks/sys.c erts/vsn.mk lib/ssl/src/ssl_connection.erl lib/ssl/test/ssl_basic_SUITE.erl
2012-12-03Use ptab functionality also for portsRickard Green
2012-11-30erts: Change default of erl_crash.dumpBjörn-Egil Dahlberg
* Create an erl_crash.dump if no heart exists and no ERL_CRASH_DUMP_SECONDS is set (behaviour changed) * Don't create an erl_crash.dump if heart do exists and no ERL_CRASH_DUMP_SECONDS is set (behaviour not changed) This changes the behaviour back to the R15B02 default considering if a beam was running with no heart. The motivation is that we want a fast heart to fast restart erlang if it crashes but to be able to get non-truncated erl_crash.dumps via setting ERL_CRASH_DUMP_SECONDS if we so desire.
2012-10-24Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: erts/etc/common/heart.c
2012-10-24Merge branch 'egil/ensure-erl_crash.dump/OTP-10422' into maintBjörn-Egil Dahlberg
* egil/ensure-erl_crash.dump/OTP-10422: test: Relax timeouts for heart_SUITE erts: Fix crash dump write to port hack erts: Fix lock check assertion doc: Document ERL_CRASH_DUMP_SECONDS behaviour test: Add test for heart restart on crash test: Add test for heart restart on crash erts: Change ERL_CRASH_DUMP_SECONDS behaviour test: Refactor away ?line macros in heart_SUITE erts: Search for heart in ports that are alive heart: Refactor heart debugging erts, heart: Ensure erl_crash.dump is written
2012-10-16erts: Change ERL_CRASH_DUMP_SECONDS behaviourBjörn-Egil Dahlberg
Not setting ERL_CRASH_DUMP_SECONDS will now terminate beam immediately on a crash without writing a crash dump file. Setting ERL_CRASH_DUMP_SECONDS to 0 will also terminate beam immediately on a crash without writing a crash dump file, i.e. same as not setting ERL_CRASH_DUMP_SECONDS environment variable. Setting ERL_CRASH_DUMP_SECONDS to a negative value will let the beam wait indefinitely on the crash dump file being written. Setting ERL_CRASH_DUMP_SECONDS to a positive value will let the beam wait that many seconds on the crash dump file being written. A positive value will set both an alarm in beam AND a heart timeout for restart if heart is running. This is due to the change of 'heart' behavior when 'heart' is listening for a crash.
2012-10-15erts, heart: Ensure erl_crash.dump is writtenBjörn-Egil Dahlberg
When a crash dump is about to be written and we have heartbeat enabled on a system. We need time to write it before heart explicitly kills the beam.
2012-09-25Merge branch 'egil/r16/strengthen-buffer-copies'Björn-Egil Dahlberg
* egil/r16/strengthen-buffer-copies: Replace sprintf with erts_snprintf in beam Replace sprintf with erts_snprintf in epmd Replace sprintf with erts_snprintf in inet_gethost
2012-09-07Replace sprintf with erts_snprintf in beamBjörn-Egil Dahlberg
2012-09-05Make sure io is flushed when driver is closedLukas Larsson
Sometime when executing an tty io operation just before the emulator terminated, the io message would get lost. This commit makes sure that there is no io in the fd driver before shutting down.
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-08-14Make get/putenv and erlexec understand UnicodePatrik Nyblom
Putenv and getenv needs to convert to the proper environment strings in Unicode depending on platform and user settings for filename encoding. Also erlexec needs to pass environment strings in an appropriate way for kernel to pick up. All environment strings on the command line, as well as home directory, is now passed in UTF8 on windows and in whatever encoding you have on Unix, kernel tries to convert all parameters and environments from UTF8 before making strings.
2012-04-17Make port_info(Port,os_pid) work on WindowsBjörn-Egil Dahlberg
2011-12-09erl_driver.h: Enlarge types on driver callbacks output, control and callRaimo Niskanen
2011-12-02Fix time typesRickard Green
2011-12-02Remove ancient WaitForInputIdle workaroundPatrik Nyblom