aboutsummaryrefslogtreecommitdiffstats
path: root/erts
AgeCommit message (Collapse)Author
2013-01-22Merge branch 'lh/forget-mnemosyne/OTP-10729'Fredrik Gustafsson
* lh/forget-mnemosyne/OTP-10729: Remove what remains of the Mnemosyne code Remove support for the query keyword and query expressions
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-21[erl_docgen] Add xmllint target for the documentation and fix some DTD errorsLars Thorsen
2013-01-19UTF-8 atom documentationRickard Green
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 'egil/fix-LM_TRY_ENABLE_CFLAG'Björn-Egil Dahlberg
* egil/fix-LM_TRY_ENABLE_CFLAG: Fix LM_TRY_ENABLE_CFLAG to use correct environment
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-17Merge branch 'maint-r15'Fredrik Gustafsson
Conflicts: erts/vsn.mk
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-17Merge branch 'mh/escript_emulator_flags_vs_shebang/OTP-10691'Fredrik Gustafsson
* mh/escript_emulator_flags_vs_shebang/OTP-10691: escript to accept emulator arguments when script file has no shebang
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-16Remove support for the query keyword and query expressionsLoïc Hoguin
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-15Fix LM_TRY_ENABLE_CFLAG to use correct environmentBjörn-Egil Dahlberg
LM_TRY_ENABLE_CFLAG takes which environment variable should be updated but only CFLAGS was updated. Though CFLAGS is the normally the intended variable, others may be used. For instance CXXFLAGS.
2013-01-15Merge branch 'dgud/wx/fix-wx-2.9-compat/OTP-10407'Dan Gudmundsson
* dgud/wx/fix-wx-2.9-compat/OTP-10407: (26 commits) wx: Fix comments wx: Workaround wx-2.9 bugs wx: Mac fixes wx: Fix demo and tests wx: Allow 64 bits compilation on mac, requires wxWidgets-2.9 appmon: Move runtime part to runtime_tools app reltool: fix wxWidgets-2.9 compability debugger: Fix 2.9 compat observer: Fix check for graphics contexts Observer: Fix distribution dialog observer: Fix font sizes wx: Fix the demo wx: Fix loading icons and cursors in Windows wx: Remove unnecessary casts wx: Fix changed getfunctions wx: Depricate wxCursor new functions wx: Fix int to enum wx: Include correct m4 file in 2.9 wx: Update examples so they work with both wxWidgets 2.8 and 2.9 wx: Modify tests so they work on wxWidgets-2.9 ...
2013-01-11If GCC is used, treat -Wreturn-type as errorTuncer Ayaz
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-10Update preloaded prim_file.beamBjörn-Egil Dahlberg
2013-01-10erts: Fix xcomp configure for fallocateBjörn-Egil Dahlberg
* Default to 'no' for finding a working fallocate
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-09wx: Allow 64 bits compilation on mac, requires wxWidgets-2.9Dan Gudmundsson
Testing using wxWidgets-2.9 on mac
2013-01-08Add +stbt erl command line switchRickard Green
2013-01-08escript to accept emulator arguments when script file has no shebangMagnus Henoch
According to the documentation, if the second or third line in a script starts with %%!, then escript will use the rest of the line as emulator options. However, previously this was only the case if the first line started with #!. This change removes that check, and unconditionally uses the %%! line if present.
2013-01-08Merge branch 'sverk/hipe-smp-independence'Sverker Eriksson
* sverk/hipe-smp-independence: erts,hipe: Make hipe compiler ask running emulator about process struct offsets
2013-01-08erts: Change internal representation of atoms to utf8Sverker Eriksson
2013-01-08erts: Refactor rename DFLAG(S)_INTERNAL_TAGS for conformitySverker Eriksson
2013-01-07Prepare releaseErlang/OTP
2013-01-02Change proposed scheduler wakeup strategy to be the defaultRickard Green
2012-12-20Update preloaded erlang.beamPatrik Nyblom
2012-12-20Correct doc re process_info(Pid,links)Patrik Nyblom
2012-12-20Teach VM not to dump core on faulty seq_trace in msPatrik Nyblom
2012-12-20Fix emulator +fna optionPatrik Nyblom
2012-12-20Add small patch for debugging of dist messagesPatrik Nyblom
Thanks to Ádám Gólya <[email protected]>
2012-12-20Clean up and make the fix work on windows.Patrik Nyblom
Thanks to Tony Rogvall.
2012-12-20erts,hipe: Make hipe compiler ask running emulator about process struct offsetsSverker Eriksson
Changes in "struct process" has made native code more depenedent on if the executing emulator is smp enabled or not. This commit will make a default built hipe compiler (without -xcomp) to ask the running emulator about process struct offsets. This will make native code work (again) as long as the same emulator is used for compilation as well as execution of the native code.
2012-12-20Add workaround for CentOS/RedHat writev bug to inet_drvPatrik Nyblom