aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
AgeCommit message (Collapse)Author
2013-01-25Merge branch 'pan/fix-compiler-warnings-clang-and-new-gcc'Patrik Nyblom
* pan/fix-compiler-warnings-clang-and-new-gcc: Fix compiler warnings from GCC 4.7.1 on ARCH Linux Fix clang compiler warnings on FreeBSD in erts
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-24Merge branch 'rickard/r16/port-optimizations/OTP-10336'Rickard Green
* rickard/r16/port-optimizations/OTP-10336: Bump fewer vreds per task callback
2013-01-24Bump fewer vreds per task callbackRickard Green
2013-01-23Merge branch 'sverk/opt-timer-wheel2'Sverker Eriksson
* sverk/opt-timer-wheel2: erts: Fixate timer wheel resultion at compile time if possible
2013-01-23Merge branch 'sverk/r16/utf8-atoms'Sverker Eriksson
* sverk/r16/utf8-atoms: erl_interface: Fix bug when transcoding atoms from and to UTF8 erl_interface: Changed erlang_char_encoding interface erts: Testcase doing unicode atom printout with ~w erl_interface: even more utf8 atom stuff erts: Fix bug in analyze_utf8 causing faulty latin1 detection Add UTF-8 node name support for epmd workaround... Fix merge conflict with hasse UTF-8 atom documentation test case erl_interface: utf8 atoms continued Add utf8 atom distribution test cases atom fixes for NIFs and atom_to_binary UTF-8 support for distribution Implement UTF-8 atom support for jinterface erl_interface: Enable decode of unicode atoms stdlib: Fix printing of unicode atoms erts: Change internal representation of atoms to utf8 erts: Refactor rename DFLAG(S)_INTERNAL_TAGS for conformity Conflicts: erts/emulator/beam/io.c OTP-10753
2013-01-23Fix compiler warnings from GCC 4.7.1 on ARCH LinuxPatrik Nyblom
2013-01-23Merge branch 'sal/float_to_list_2/OTP-10752'Björn-Egil Dahlberg
* sal/float_to_list_2/OTP-10752: Text representation of a float formatted using given options.
2013-01-23Fix clang compiler warnings on FreeBSD in ertsPatrik Nyblom
The following are deliberately left, as I have only a list of compiler warnings and no system to test on: hipe/hipe_x86_signal.c:264:5: warning: no previous prototype for function '_sigaction' [-Wmissing-prototypes] int __SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldact) ^ hipe/hipe_x86_signal.c:222:21: note: expanded from macro '__SIGACTION' ^ 1 warning generated. sys/unix/sys_float.c:835:16: warning: declaration of 'struct exception' will not be visible outside of this function [-Wvisibility] matherr(struct exception *exc) ^ sys/unix/sys_float.c:835:1: warning: no previous prototype for function 'matherr' [-Wmissing-prototypes] matherr(struct exception *exc) ^ 2 warnings generated. drivers/unix/unix_efile.c:1504:11: warning: implicit declaration of function 'sendfile' [-Wimplicit-function-declaration] retval = sendfile(in_fd, out_fd, *offset, SENDFILE_CHUNK_SIZE, ^ 1 warning generated.
2013-01-23Merge branch 'egil/fix-win-float-exponent/OTP-10751'Björn-Egil Dahlberg
* egil/fix-win-float-exponent/OTP-10751: erts: Force windows to use two-digit exponent
2013-01-23Make _oct counters in inet_drv exactly 64 bitsPatrik Nyblom
Also, on 64 bit architectures, use 64 bit int's for the counters and be specific about the counter variables sizes utilizing datatypes from sys.h.
2013-01-23Fix inet_drv _oct counters 32bit/64bit bugPatrik Nyblom
2013-01-23Merge branch 'pan/R16/redhat_workaround'Patrik Nyblom
* pan/R16/redhat_workaround: Clean up and make the fix work on windows. Add workaround for CentOS/RedHat writev bug to inet_drv OTP-10747
2013-01-23Alternative solution to the efile_drv crash on exitPatrik Nyblom
2013-01-23Merge branch 'lukas/erts/busy-port-tests/OTP-10336'Rickard Green
* lukas/erts/busy-port-tests/OTP-10336: Add testcases for strange port scheduling scenarios
2013-01-23Merge branch 'rickard/rg-default/OTP-10737'Rickard Green
* rickard/rg-default/OTP-10737: Raise default reader group limit to 64
2013-01-23Add testcases for strange port scheduling scenariosLukas Larsson
2013-01-23Merge branch 'rickard/r16/port-optimizations/OTP-10336'Rickard Green
* rickard/r16/port-optimizations/OTP-10336: Bump reductions also for immediate driver calls Add 'port_count' and 'port_limit' to system_info/1 spec Fix documentation Replace use of deprecated functions in test cases Replace use of driver_send_term() with erl_drv_send_term() Conflicts: erts/preloaded/ebin/erlang.beam
2013-01-23Bump reductions also for immediate driver callsRickard Green
2013-01-23Merge branch 'fdm/windows_file_share_delete/OTP-10727'Fredrik Gustafsson
* fdm/windows_file_share_delete/OTP-10727: Use share flags for all file operations on Windows
2013-01-23Revert "Merge branch 'nox/rm-reverse-eta-conversion/OTP-10682'"Fredrik Gustafsson
This reverts commit 750ecdea08fa5fa7e32b7f3019eed96c1699427e, reversing changes made to 2cfa0466c3b3c7bd5e3621aff0f3e2ca30addb68.
2013-01-23erts: Testcase doing unicode atom printout with ~wSverker Eriksson
2013-01-23Merge branch 'rickard/async-default/OTP-10736'Rickard Green
* rickard/async-default/OTP-10736: Use async threads by default
2013-01-23Merge branch 'rickard/sched-wakeup-other/OTP-10661'Rickard Green
* rickard/sched-wakeup-other/OTP-10661: Change proposed scheduler wakeup strategy to be the default
2013-01-23Merge branch 'rickard/+stbt/OTP-10668'Rickard Green
* rickard/+stbt/OTP-10668: Add +stbt erl command line switch
2013-01-22erts: Fix bug in analyze_utf8 causing faulty latin1 detectionSverker Eriksson
2013-01-22erts: Force windows to use two-digit exponentBjörn-Egil Dahlberg
sprintf on windows uses a three-digit exponent default
2013-01-21Raise default reader group limit to 64Rickard Green
2013-01-21Use async threads by defaultRickard Green
2013-01-21Fix compiler error for hipe in debug emulatorSverker Eriksson
Use am_undefined as it seems to be more releable to exist.
2013-01-21workaround...Rickard Green
2013-01-21Text representation of a float formatted using given options.Serge Aleynikov
This BIF solves a problem of float_to_list/1 that doesn't allow specifying the number of digits after the decimal point when formatting floats. float_to_list(Float, Options) -> string() Float = float() Options = [Option] Option = {decimals, Decimals::0..249} | {scientific, Decimals::0..249} | compact Returns a string which corresponds to the text representation of a `Float` formatted using given options. When decimals option is specified the returned value will contain at most `Decimals` number of digits past the decimal point. When `compact` option is provided the trailing zeros at the end of the list are truncated (this option is only meaningful together with the `decimals` option). When `scientific` option is provided, the float will be formatted using scientific notation with `Decimals` digits of precision. If `Options` is `[]` the function behaves like `float_to_list/1`. When using `decimals` option and the number doesn't fit in the static internal buffer of 256 bytes the function throws `badarg`.
2013-01-18test caseRickard Green
2013-01-18Merge branch 'nox/enable-silent-rules/OTP-10726'Björn-Egil Dahlberg
* nox/enable-silent-rules/OTP-10726: Implement ./otp_build configure --enable-silent-rules
2013-01-18Merge branch 'nox/rm-reverse-eta-conversion/OTP-10682'Fredrik Gustafsson
* nox/rm-reverse-eta-conversion/OTP-10682: Don't use fun references in cprof_SUITE Make trace_local_SUITE work without the reverse eta conversion Remove the reverse eta-conversion from v3_kernel
2013-01-17Use share flags for all file operations on WindowsFilipe David Borba Manana
Some file operations provided by the Erlang file module didn't open the target file with all the file share flags. This made some concurrent file operations against the same file fail on Windows, while on other platforms such as GNU/Linux or Mac OS X they succeed. The operations will fail only if they're performed concurrently by different threads (async IO threads or scheduler threads). For example, one Erlang process does a file:delete/1 call while another Erlang process is doing a filelib:file_size/1 call. This made the former process get an eacces error from the file:delete/1 call. On GNU/Linux or Mac OS X the call would succeed. Another example is if one Erlang process attempts to open a file for reading while another one is in the middle of a file:read_file_info/1 call (after it opened the file and before it closed the file). It's easy to verify that if a file is not open with all the share flags, it's impossible for other threads (even if they belong to the same OS process) to open the file while the file is not closed by the first thread. The following test program shows this: #include <windows.h> #include <iostream> // Must be an existing file //#define SHARE_FLAGS (FILE_SHARE_READ) static DWORD WINAPI MyThreadFunction(LPVOID lpParam); static char *lastError(); int main(int argc, char *argv[]) { DWORD threadId; HANDLE threadHandle, hFile; hFile = CreateFile(FILENAME, GENERIC_READ, SHARE_FLAGS, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { std::cerr << "File open error from main: " << lastError() << std::endl; return 1; } std::cout << "Main thread opened file successfully" << std::endl; threadHandle = CreateThread(NULL, 0, MyThreadFunction, NULL, 0, &threadId); if (threadHandle == INVALID_HANDLE_VALUE) { std::cerr << "Thread create error from main: " << lastError() << std::endl; return 1; } WaitForSingleObject(threadHandle, INFINITE); CloseHandle(threadHandle); CloseHandle(hFile); return 0; } static DWORD WINAPI MyThreadFunction( LPVOID lpParam ) { HANDLE hFile; hFile = CreateFile(FILENAME, GENERIC_READ, SHARE_FLAGS, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { std::cerr << "File open error from second thread: " << lastError() << std::endl; return 1; } std::cout << "Second thread opened file successfully" << std::endl; CloseHandle(hFile); return 0; } static char *lastError() { static char *buf = NULL; DWORD dw = GetLastError(); if (buf != NULL) { LocalFree((LPTSTR) &buf); } FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL); return buf; } Rnning this program with SHARE_FLAGS set to 0 (as efile_fileinfo() does for e.g.), shows that the second thread is unable to open the file: C:\cygwin\home\fdmanana\tmp>touch foo.bar C:\cygwin\home\fdmanana\tmp>threads_fopen_test.exe Main thread opened file successfully File open error from second thread: The process cannot access the file because it is being used by another process. Changing the program's SHARE_FLAGS to FILE_SHARE_READ, shows that both threads are able to open the file: C:\cygwin\home\fdmanana\tmp>touch foo.bar C:\cygwin\home\fdmanana\tmp>threads_test.exe Main thread opened file successfully Second thread opened file successfully Same logic applies to opening files for writing or deleting and renaming files while they're open by some other thread that didn't specify the flags FILE_SHARE_WRITE and FILE_SHARE_DELETE.
2013-01-16Add utf8 atom distribution test casesRickard Green
2013-01-16atom fixes for NIFs and atom_to_binarySverker Eriksson
2013-01-16UTF-8 support for distributionRickard Green
2013-01-16Merge branch 'yamt/erl_driver-ssize_t/OTP-10699'Björn-Egil Dahlberg
* yamt/erl_driver-ssize_t/OTP-10699: Use correct way to pull the definition of ssize_t
2013-01-16Use correct way to pull the definition of ssize_tYAMAMOTO Takashi
Necessary for NetBSD with _POSIX_SOURCE at least.
2013-01-15Implement ./otp_build configure --enable-silent-rulesAnthony Ramine
With silent rules, the output of make is less verbose and compilation warnings are easier to spot. Silent rules are disabled by default and can be disabled or enabled at will by make V=0 and make V=1.
2013-01-11Merge branch 'fdm/file-allocate/OTP-10680'Björn-Egil Dahlberg
* fdm/file-allocate/OTP-10680: Update preloaded prim_file.beam erts: Fix xcomp configure for fallocate Add file:allocate/3 operation
2013-01-10Merge branch 'pn/ansi-console/OTP-10678'Björn-Egil Dahlberg
* pn/ansi-console/OTP-10678: Support ANSI in the console
2013-01-10Merge branch 'fdm/fix_fd_leak_async_thread_pool/OTP-10677'Björn-Egil Dahlberg
* fdm/fix_fd_leak_async_thread_pool/OTP-10677: Fix fd leak when using async thread pool
2013-01-10Make trace_local_SUITE work without the reverse eta conversionAnthony Ramine
The exceptions tracing tests look for {trace_local_SUITE,exc,2} in stacktraces to strip them and compare them to the excepted result, the removal of the reverse eta conversion renames '-exception_test/3-fun-0-' to exc and thus confuses the stripping code. This commit fix this by not using `fun exc/2` but `fun (F, As) -> exc(F, As) end` instead, which was what the reverse eta conversion was doing.
2013-01-09Add file:allocate/3 operationFilipe David Manana
This operation allows pre-allocation of space for files. It succeeds only on systems that support such operation. The POSIX standard defines the optional system call posix_fallocate() to implement this feature. However, some systems implement more specific functions to accomplish the same operation. On Linux, if the more specific function fallocate() is implemented, it is used instead of posix_fallocate(), falling back to posix_fallocate() if the fallocate() call failed (it's only supported for the ext4, ocfs2, xfs and btrfs file systems at the moment). On Mac OS X it uses the specific fcntl() operation F_PREALLOCATE, falling back to posix_fallocate() if it's available (at the moment Mac OS X doesn't provide posix_fallocate()). On any other UNIX system, it uses posix_fallocate() if it's available. Any other system not providing this system call or any function to pre-allocate space for files, this operation always fails with the ENOTSUP POSIX error.
2013-01-09Fix fd leak when using async thread poolFilipe David Borba Manana
When using the async thread pool, if an erlang process asks to open a file and it gets shutdown/killed while the file:open/2 call hasn't returned, it's possible to leak a file descriptor against the target file. This happens because when the file driver is stopped (file_stop() function is called), an async thread is executing, about to execute, or executed already the invoke_open() function. After file_stop() is called, the file_async_ready() function will not run, and this function is responsible for setting desc->fd with the file descriptor that invoke_open() got. The file_stop() call closes desc->fd if it refers to a valid file descriptor, which is not the case here, because this function was called before file_async_ready() could run. This leak is easily reproducile in a GNU/Linux system using the following test code: -module(t). -export([t/1]). t(N) -> Pid = spawn_link(fun() -> process_flag(trap_exit, true), loop(N) end), Ref = erlang:monitor(process, Pid), receive {'DOWN', Ref, _, _, _} -> ok end. loop(0) -> ok; loop(N) -> Name = integer_to_list(N), Server = self(), Pid = spawn(fun() -> Server ! continue, {ok, FdW} = file:open(Name, [raw, write]), {ok, FdR} = file:open(Name, [raw, read]), % Optional close calls, with or without them % it makes no difference. %ok = file:close(FdW), %ok = file:close(FdR), ok end), receive continue -> ok end, exit(Pid, shutdown), loop(N - 1). Running this code with a few iterations is enough to very often notice, with the lsof command, that the beam.smp process is holding forever file descriptors open. This issue doesn't happen if the async thread pool is not used. Example: $ erl +A 4 Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:4:4] [async-threads:4] [hipe] [kernel-poll:false] Eshell V5.9.3 (abort with ^G) 1> c(t). {ok,t} 2> os:getpid(). "31975" 3> t:t(20). ok In a separate shell: $ lsof -p 31975 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME beam.smp 31975 fdmanana cwd DIR 8,18 22736896 32563204 /home/fdmanana/git/hub/otp/tmp beam.smp 31975 fdmanana rtd DIR 8,1 4096 2 / beam.smp 31975 fdmanana txt REG 8,1 7600263 1835126 /opt/r15b03/lib/erlang/erts-5.9.3/bin/beam.smp beam.smp 31975 fdmanana mem REG 8,1 7220736 2497283 /usr/lib/locale/locale-archive beam.smp 31975 fdmanana mem REG 8,1 10280 2505021 /usr/lib/libsctp.so.1.0.11 beam.smp 31975 fdmanana mem REG 8,1 1811128 917795 /lib/x86_64-linux-gnu/libc-2.15.so beam.smp 31975 fdmanana mem REG 8,1 31752 917803 /lib/x86_64-linux-gnu/librt-2.15.so beam.smp 31975 fdmanana mem REG 8,1 135366 917799 /lib/x86_64-linux-gnu/libpthread-2.15.so beam.smp 31975 fdmanana mem REG 8,1 159200 921249 /lib/x86_64-linux-gnu/libtinfo.so.5.9 beam.smp 31975 fdmanana mem REG 8,1 1030512 917962 /lib/x86_64-linux-gnu/libm-2.15.so beam.smp 31975 fdmanana mem REG 8,1 14768 917702 /lib/x86_64-linux-gnu/libdl-2.15.so beam.smp 31975 fdmanana mem REG 8,1 149280 917974 /lib/x86_64-linux-gnu/ld-2.15.so beam.smp 31975 fdmanana 0u CHR 136,1 4 /dev/pts/1 beam.smp 31975 fdmanana 1u CHR 136,1 4 /dev/pts/1 beam.smp 31975 fdmanana 2u CHR 136,1 4 /dev/pts/1 beam.smp 31975 fdmanana 3r FIFO 0,8 1298297 pipe beam.smp 31975 fdmanana 4w FIFO 0,8 1298297 pipe beam.smp 31975 fdmanana 5r FIFO 0,8 1298298 pipe beam.smp 31975 fdmanana 6w FIFO 0,8 1298298 pipe beam.smp 31975 fdmanana 7w REG 8,18 0 32564173 /home/fdmanana/git/hub/otp/tmp/20 beam.smp 31975 fdmanana 8w REG 8,18 0 32564176 /home/fdmanana/git/hub/otp/tmp/16 beam.smp 31975 fdmanana 9w REG 8,18 0 32564177 /home/fdmanana/git/hub/otp/tmp/15 beam.smp 31975 fdmanana 10w REG 8,18 0 32564179 /home/fdmanana/git/hub/otp/tmp/12 beam.smp 31975 fdmanana 11w REG 8,18 0 32564180 /home/fdmanana/git/hub/otp/tmp/11 beam.smp 31975 fdmanana 12w REG 8,18 0 32564205 /home/fdmanana/git/hub/otp/tmp/10 beam.smp 31975 fdmanana 13w REG 8,18 0 32564182 /home/fdmanana/git/hub/otp/tmp/8 beam.smp 31975 fdmanana 14w REG 8,18 0 32564183 /home/fdmanana/git/hub/otp/tmp/7 beam.smp 31975 fdmanana 15w REG 8,18 0 32564186 /home/fdmanana/git/hub/otp/tmp/3
2013-01-09erts: Remove the packages aliases for BIFsBjörn Gustavsson
2013-01-08Add +stbt erl command line switchRickard Green