Age | Commit message (Collapse) | Author |
|
Created erlang fallback for sendfile in gen_tcp and
moved sendfile from file to gen_tcp. Also created testcases
for testing all different options to sendfile.
For info about how sendfile should work see the BSD man pages
as they contain a more complete API than other *nixes.
|
|
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."
|
|
Calling file:change_time/2,3 with an invalid date tuple
(e.g file:change_time("file.txt", {undefined, undefined}))
will cause file_server_2 to crash.
error_logger will shutdown and the whole VM will stop.
Change behavior to validate given dates on system boundaries.
(i.e before issuing a server call).
|
|
In the location information tables in the run-time system, source
filenames that are the same as the module name plus ".erl" extension
are not stored explicitly, thus saving memory.
To take advantage of that optimization, avoid complicating the names of
files in the current working directory; specifically, make sure that
"./" is not prepended to the name.
|
|
An incorrect spec, rpc:yield/1, has been fixed.
|
|
|
|
|
|
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.
|
|
|
|
|