aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/erl_efile.h
AgeCommit message (Collapse)Author
2014-02-24ose: efile driver updates.Jonas Karlsson
2013-11-15Add sync option to file:open/2Joseph Blomstedt
The sync option adds the POSIX O_SYNC flag to the open system call on platforms that support the flag or its equivalent, e.g., FILE_FLAG_WRITE_THROUGH on Windows. For platforms that don't support it, file:open/2 returns {error, enotsup} if the sync option is passed in. The semantics of O_SYNC are platform-specific. For example, not all platforms guarantee that all file metadata are written to the disk along with the file data when the flag is in effect. This issue is noted in the documentation this commit adds for the sync option. Add a test for the sync option. Note however that the underlying OS semantics for O_SYNC can't be tested automatically in any practical way, so the test assumes the OS does the right thing with the flag when present. For manual verification, dtruss on OS X and strace on Linux were both run against beam processes to watch calls to open(), and file:open/2 was called in Erlang shells to open files for writing, both with and without the sync option. Both the dtruss output and the strace output showed that the O_SYNC flag was present in the open() calls when sync was specified and was clear when sync was not specified.
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-03-04erts: Use block comments - ansi styleBjörn-Egil Dahlberg
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.
2011-12-20erts: rewrite efile_writev to handle partial writes correctlyRaimo Niskanen
2011-12-09Update copyright yearsBjörn-Egil Dahlberg
2011-12-08Merge branch 'ta/sendfile/OTP-9240'Lukas Larsson
* ta/sendfile/OTP-9240: Do not use async threads on DARWIN Fix cleanup when sendfile process crashes Return {error,closed} from sendfile if closed Do not use SFV_NOWAIT as it does not exist on all solaris Clarify some code comments Make solaris use sendfilev
2011-12-05Clarify some code commentsLukas Larsson
Thanks Tuncer Ayaz
2011-12-05Make solaris use sendfilevLukas Larsson
sendfilev is a richer API which allows us to do non blocking TCP on solaris. The normal sendfile API seems to have some issue with non blocking sockets and the return value of sendfile.
2011-12-02Use epoch seconds instead of datetime()Björn-Egil Dahlberg
First stage in utc-time for prim_file.
2011-12-02Remove header/trailer supportLukas Larsson
Since the API for headers/trailers seem to be very awkward to work with when using non-blocking io the feature is dropped for now. See unix_efile.c for more details.
2011-12-01Preliminary work on header/trailerLukas Larsson
Have to figure out how to represent progress in header writing when using non-blocking, not sure how to do this.
2011-12-01Add ifdef's for HAVE_SENDFILELukas Larsson
2011-12-01Change nbytes to 64 bitLukas Larsson
2011-12-01Implement sendfile when there are no async threadsLukas Larsson
When there are no async threads sendfile will use the ready_output select on the socket fd to know when to send data. The file_desc will also be put in the sending sendfile_state which buffers all other commands to that file until the sendfile is done.
2011-12-01Implement sendfile using blocking io in asynch threadsLukas Larsson
Move the command handling to outputv in preparation for header and trailer inclusion in the sendfile api. Use the standard efile communication functions for sendfile.
2011-11-29Implement file:sendfileTuncer Ayaz
Allow Erlang code to use sendfile() where available by wrapping it as file:sendfile/4 and file:sendfile/2. sendfile(2) - Linux man page: "sendfile() copies data between one file descriptor and another. Because this copying is done within the kernel, sendfile() is more efficient than the combination of read(2) and write(2), which would require transferring data to and from user space."
2010-11-30Make Unicode filenames work on WindowsPatrik Nyblom
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-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.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP