aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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-09Merge branch 'ml/crypto/add-ripemd160-digest/OTP-10667'Fredrik Gustafsson
* ml/crypto/add-ripemd160-digest/OTP-10667: fix crypto ripemd160 tests to use hash_init family fix ripemd160 to use hash_init family and add documentation fix missing defines for RIPEMD160_CTX_LEN and RIPEMD160_LEN add ripemd160 support to crypto
2013-01-09kernel: Remove the packages moduleBjörn Gustavsson
2013-01-09kernel: Eliminate use of packages in code and code_serverBjörn Gustavsson
2013-01-09edoc: Remove support for packagesBjörn Gustavsson
2013-01-09syntax_tools: Remove support for packagesBjörn Gustavsson
2013-01-09reltool: Remove support for packagesBjörn Gustavsson
2013-01-09test_server: Remove support for packagesBjörn Gustavsson
2013-01-09sasl: Remove support for packagesBjörn Gustavsson
2013-01-09debugger: Remove support for packagesBjörn Gustavsson
2013-01-09c: Remove support for packagesBjörn Gustavsson
2013-01-09filename: Remove support for packagesBjörn Gustavsson
2013-01-09erl_pp_SUITE: Remove test of packagesBjörn Gustavsson
2013-01-09shell: Remove support for packagesBjörn Gustavsson
2013-01-09erl_parse: Remove support for packagesBjörn Gustavsson
2013-01-09qlc: Remove support for packagesBjörn Gustavsson
2013-01-09erl_eval: Remove support for packagesBjörn Gustavsson
2013-01-09erl_expand_records: Remove support for packagesBjörn Gustavsson
2013-01-09erl_lint: Remove support for packagesBjörn Gustavsson
2013-01-09compiler: Remove support for packagesBjörn Gustavsson
2013-01-09erts: Remove the packages aliases for BIFsBjörn Gustavsson
2013-01-09erl_expand_records_SUITE: Eliminate use of packagesBjörn Gustavsson
2013-01-09erl_lint_SUITE: Eliminate use of packagesBjörn Gustavsson
2013-01-09eunit: Eliminate use of the package syntaxBjörn Gustavsson
2013-01-09wx: Fix commentsDan Gudmundsson
Fix utf-8 code generation for opengl docs
2013-01-09wx: Workaround wx-2.9 bugsDan Gudmundsson
Menuhandling in 2.9 is (currently) buggy on mac, this avoids a crash in menu handling but causes a lot unusable menus.
2013-01-09wx: Mac fixesDan Gudmundsson
2013-01-09wx: Fix demo and testsDan Gudmundsson
Added debugging and workarounds for wx-2.9 on Mac
2013-01-09wx: Allow 64 bits compilation on mac, requires wxWidgets-2.9Dan Gudmundsson
Testing using wxWidgets-2.9 on mac
2013-01-09appmon: Move runtime part to runtime_tools appDan Gudmundsson
2013-01-09reltool: fix wxWidgets-2.9 compabilityDan Gudmundsson
2013-01-09debugger: Fix 2.9 compatDan Gudmundsson
wxTextCtrl:setFocus selects all input. wxListBox:insertItems() Asserts for a zero list, sigh..
2013-01-09observer: Fix check for graphics contextsDan Gudmundsson
wxWidgets-2.9 seg faults if you try to create a graphics context before the window is shown. With bad timing this can happen. So change the haveGC test to check if the functionality is available without creating the GraphicsContext.
2013-01-09Observer: Fix distribution dialogDan Gudmundsson
2013-01-09observer: Fix font sizesDan Gudmundsson
On wxWidgets 2.9 they seem to have fixed font sizes in GC's
2013-01-09wx: Fix the demoDan Gudmundsson
Changing demo, didn't close the previous choosen demo, which looked really bad on Windows.
2013-01-09wx: Fix loading icons and cursors in WindowsDan Gudmundsson
wxWidgets looked in the wrong executable after icons and cursors, stole wxLua's solution. Also finds wx-2.9 on windows
2013-01-09wx: Remove unnecessary castsDan Gudmundsson
2013-01-09wx: Fix changed getfunctionsDan Gudmundsson
wx-2.9 have changed some functions from returning references to objects to returning objects instead
2013-01-09wx: Depricate wxCursor new functionsDan Gudmundsson
Not available on mac and windows for on 2.9
2013-01-09wx: Fix int to enumDan Gudmundsson
In 2.9 several functions takes enum's instead of int as arguments, remove dirty -fpermissive fix and fix it correctly instead.
2013-01-09wx: Include correct m4 file in 2.9Dan Gudmundsson
The older m4 file will not work with a 2.9 release, so include the correct one in 2.9
2013-01-09wx: Update examples so they work with both wxWidgets 2.8 and 2.9Dan Gudmundsson
2013-01-09wx: Modify tests so they work on wxWidgets-2.9Dan Gudmundsson
Things have changed in 2.9 modify tests so they are still valid for both 2.8 and 2.9 branches, so far only tested on linux.
2013-01-09wx: Deprecate functions not available in wxWidgets-2.9Dan Gudmundsson
Prepare to remove functionality which is not available in coming wxWidgets versions.
2013-01-09wx: Fixes more changed/removed functionality in 2.9Dan Gudmundsson
2013-01-09wx: Ifdef changed/removed functionality in wxWidgets-2.9.xDan Gudmundsson
2013-01-09wx: Re-generated codeDan Gudmundsson
Generated code with previous commit.
2013-01-09wx: Fix code generation bugsDan Gudmundsson
Removed defines that is void, i.e. -defined(FOO, ?NEVER_DEFINED_VALUE). Also removed wxSTC:sendMsg/[2|3] which was wrong before and breaks code generation with new doxygen.