Age | Commit message (Collapse) | Author |
|
Change type for second parameter from binary() to iodata(), since the
function explicitly takes steps to accept lists as well as binaries.
|
|
* ks/erl_bif_types-cleanup/OTP-8961:
Fix type information of 'file' and 'code' modules
Conflicts:
lib/hipe/cerl/erl_bif_types.erl
|
|
|
|
|
|
|
|
Dialyzer for a long time now has had hard-coded type information about
key functions of the 'file' and 'code' modules in 'erl_bif_types'.
Some of this information was not up-to-date according to the published
Erlang/OTP documentation, while some other part contained small errors.
Now that specs are available, this information should be moved to the
corresponding files, not be hard-coded in erl_bif_types.
This change takes out all information for the 'file' module and fixes
some small errors in type information for the 'code' module.
|
|
Although the {encoding, encoding()} set of options is documented in
the manual page of the 'file' module, they do not appear in the Mode
description on that page nor in the mode() type declaration.
The patch adds this information in both the code of the module and
the documentation of the module.
To avoid duplication, the declaration of the encoding() type is added
to the 'unicode' module where it most probably belongs.
While at it, added a proper declaration for posix(), took out the
now superfluous information about the types of file:open/2 from the
erl_bif_types module, and corrected the return type of file:open/2
so that it corresponds to the published documentation.
|
|
|
|
* ms/file-exclusive-mode:
Update preloaded modules
Support opening files in exclusive mode
OTP-8670 ms/file-exclusive-mode
There is a new option 'exclusive' to file:open/2 that uses the OS O_EXCL
flag where supported to open the file in exclusive mode.
|
|
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]).
|
|
|
|
|
|
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.
|
|
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.
|
|
Having various type declarations in the file.hrl file was once upon a time
necessary since the system could not really handle remote types. Now it can
and these declarations should not be there but appear in file.erl instead.
This means that files that need to use these types can refer to them using
a remote type reference, and not having to include file.hrl - at least not
for this reason.
|
|
|
|
|