aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/prim_file_SUITE.erl
AgeCommit message (Collapse)Author
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-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-06Merge branch 'bg/file-del_dir' into devErlang/OTP
* bg/file-del_dir: Adjust test of file:del_dir("..") to accept {error,einval}
2010-05-05Adjust test of file:del_dir("..") to accept {error,einval}Björn Gustavsson
On FreeBSD, file:del_dir("..") will return {error,einval} rather than the expected {error,eexist}, and so will file:del_dir("../.."), and so on. It could be argued that we should change the implementation of file:del_dir/1 to remap the error code (as some other error codes are remapped to reduce the differences between different platforms), but the consistency gained does not seem to be worth the effort. Therefore, until we'll find a real-world use case where it is essential to have consistent error codes for file:del_dir("..") on all platforms, change the test case to accept both errors.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP