aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers
AgeCommit message (Collapse)Author
2010-07-07Fix inet_drv to detect passive mode UDP errors for SCTP buildsRaimo Niskanen
Debug and patch by Per Hedeland for R13B04 on erlang-patches: Connected UDP (and handling of any other errors in UDP recv()) is broken in passive mode for all SCTP-enabled builds.
2010-06-04Support opening files in exclusive modeMichael Santos
Add an option that atomically tests for the existence of a file and creates it if the file does not exist, by passing the O_EXCL flag to open() on Unix and CREATE_NEW flag on Windows. Support for O_EXCL varies across platforms and filesystems. {ok, Fd} = file:open("/tmp/foo", [write,exclusive]), {error, eexist} = file:open("/tmp/foo", [write,exclusive]).
2010-06-02Windows: Open files with FILE_SHARE_DELETE to get closer to UNIX semanticsJan Lehnardt
See dwShareMode on http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
2010-05-27inet_drv.c: Remove red herringBjörn Gustavsson
Remove redundant "!defined(__WIN32__)". It is used inside the #else branch of a "#ifdef __WIN32__", so it serves no useful purpose except to fool unsuspecting readers.
2010-05-27use macro to portably test for socket system call errorsSteve Vinoski
On some combinations of Montavista Linux running on Cavium Octeon chips, some socket-related system calls erroneously return negative numbers other than -1 to indicate errors, but inet_drv.c specifically compares against -1 to test for errors. The result is that beam dumps core due to the code treating these negative numbers as success indicators, as counts/offsets of bytes written, etc. thereby corrupting its own internal data structures. To fix this, introduce a portability macro to test the result of socket system calls. The test remains unchanged on Windows but for other platforms the macro considers all return values that are less than zero to be errors. Though POSIX specifies that errors from these system calls are indicated by a return value of -1, treating all negative return values as errors is also safe, as described in detail below. In networking programming, treating all negative return values from system calls as errors is very common practice -- see the examples in W. Richard Stevens's popular and highly lauded network programming books, for example. For system calls that return 0 to indicate success, treating all negative numbers as errors is safe because only 0 is specified to indicate success. These include: getsockname getpeername getsockopt gethostname bind listen connect close shutdown Likewise, for system calls that return non-negative numbers to indicate success, treating all negative numbers as errors is also safe. These functions typically return signed integers of type ssize_t, and they treat any parameters of type size_t that cannot fit within the ssize_t return value, such as numbers of bytes to read or write, as errors (specifically EINVAL). For example, in the "ERRORS" section of the man page for writev from several varieties of Linux, it states that EINVAL is returned when the total length of the I/O is more than can be expressed by the ssize_t return value. These calls include: recv recvfrom recvmsg writev send sendto sendmsg Finaly, the socket() system call is also similar to these in that it returns a signed type (int) with all non-negative return values indicating success, so treating all negative return values as errors is safe.
2010-05-24Merge branch 'fm/file-operations' into devErlang/OTP
* fm/file-operations: Update preloaded modules Add file:advise/4 - a wrapper to the POSIX syscall posix_fadvise Add file:datasync/1 for syncing file contents only sys.h: Correct the get_int64() macro OTP-8637 fm/file-operations The functions file:advise/4 and file:datasync/1 have been added. (Thanks to Filipe David Manana.)
2010-05-20Add file:advise/4 - a wrapper to the POSIX syscall posix_fadviseFilipe David Manana
Useful for informing the Operating System about the access pattern for a file's data, so that it can adapt the caching strategy to maximize disk IO performance.
2010-05-20Add file:datasync/1 for syncing file contents onlyFilipe David Manana
file:datasync/1 invokes the POSIX system call "int fdatasync(int fd)". This system call is similar to "fsync" but, unlike fsync, it does not update the metadata associated with the file (like the access time for example). It's used by many DBMSs (MySQL and SQLite of example) to increase disk IO performance, as it avoids disk seeks and disk write operations compared to fsync. More details on it at: http://linux.die.net/man/2/fdatasync An example, from the MySQL source: http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1-telco-6.1/annotate/head%3A/mysys/my_sync.c#L61 This new function just calls fsync on systems not implementing fdatasync.
2010-05-05OTP-8581 Revert prototype of driver_asyncPatrik Nyblom
2010-05-02Merge branch 'bg/remove-stray-ose-support' into devErlang/OTP
* bg/remove-stray-ose-support: configure: Remove stray OSE/Delta support Makefiles: Remove stray OSE/Delta support kernel tests: Remove stray OSE/Delta support system tests: Remove stray OSE/Delta support erl_interface tests: Remove stray OSE/Delta support epmd: Remove stray OSE/Delta support epmd: #ifdef out start_epmd() for other platforms than VxWorks emulator tests: Remove stray OSE/Delta support emulator: Remove stray OSE/Delta support emulator: Eliminate #ifdef for sys_tty_reset() test_server: Remove stray support for OSE/Delta OTP-8585 bg/remove-stray-ose-support
2010-04-30emulator tests: Remove stray OSE/Delta supportBjörn Gustavsson
2010-04-30emulator: Remove stray OSE/Delta supportBjörn Gustavsson
2010-03-22Merge branch 'pan/otp_8332_halfword' into devErlang/OTP
* pan/otp_8332_halfword: Teach testcase in driver_suite the new prototype for driver_async wx: Correct usage of driver callbacks from wx thread Adopt the new (R13B04) Nif functionality to the halfword codebase Support monitoring and demonitoring from driver threads Fix further test-suite problems Correct the VM to work for more test suites Teach {wordsize,internal|external} to system_info/1 Make tracing and distribution work Turn on instruction packing in the loader and virtual machine Add the BeamInstr data type for loaded BEAM code Fix the BEAM dissambler for the half-word emulator Store pointers to heap data in 32-bit words Add a custom mmap wrapper to force heaps into the lower address range Fit all heap data into the 32-bit address range
2010-03-10Store pointers to heap data in 32-bit wordsPatrik Nyblom
Store Erlang terms in 32-bit entities on the heap, expanding the pointers to 64-bit when needed. This works because all terms are stored on addresses in the 32-bit address range (the 32 most significant bits of pointers to term data are always 0). Introduce a new datatype called UWord (along with its companion SWord), which is an integer having the exact same size as the machine word (a void *), but might be larger than Eterm/Uint. Store code as machine words, as the instructions are pointers to executable code which might reside outside the 32-bit address range. Continuation pointers are stored on the 32-bit stack and hence must point to addresses in the low range, which means that loaded beam code much be placed in the low 32-bit address range (but, as said earlier, the instructions themselves are full words). No Erlang term data can be stored on C stacks (enforced by an earlier commit). This version gives a prompt, but test cases still fail (and dump core). The loader (and emulator loop) has instruction packing disabled. The main issues has been in rewriting loader and actual virtual machine. Subsystems (like distribution) does not work yet.
2010-02-18OTP-8451 Harmless buffer overflow by one byte in asn1 and ram_file_drv.Sverker Eriksson
2010-02-08OTP-8412 Fixed numerous compiler warnings generated by gcc 4.4.1 andRickard Green
tile-cc 2.0.1.78377 when compiling the runtime system.
2009-12-17Send up AssocID as unsignedBjörn Gustavsson
It must be unsigned so that prim_inet will not reject when it is sent down again. (Suggested fix by Raimo for a bug reported by Simon Cornish.)
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP