aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/file.erl
AgeCommit message (Collapse)Author
2012-05-30Fix chunk usage checkLukas Larsson
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-03-22Rename dyntrace BIFs to more suiting namesPatrik Nyblom
2012-03-22Correct some errors in the user tag spreadingPatrik Nyblom
2012-03-22Add user tag spreading functionality to VM and use in filePatrik Nyblom
User tags in a dynamic trace enabled VM are spread throughout the system in the same way as seq_trace tokens. This is used by the file module and various other modules to get hold of the tag from the user process without changing the protocol.
2012-03-22Update dtrace for changes in R15Björn-Egil Dahlberg
2012-03-22Add DTrace support for OS X, Solaris, and Linux (via SystemTap), 4/4Scott Lystig Fritchie
Add probes to (mostly) the efile_drv.c driver and other file I/O-related source files.
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-08Merge branch 'egil/file-info-opt-utc/OTP-7687'Björn-Egil Dahlberg
* egil/file-info-opt-utc/OTP-7687: (39 commits) Remove time_t specific test in prim_file_SUITE Update prim_file.beam and prim_zip.beam Add types for posixtime_to_universaltime and the reverse Set BASEYEAR to 1902 Set lower limit of years handled to 1601 Emulate localtime, gmtime and mktime to enable negative time_t Document file:*_file_info/2 Fix compiler warning in unix_efile.c Change name of bif universaltime_to_seconds/1 Change options to prim_file:*_file_info/* Remove dead code Catch errors from prim_file:*_file_info Testcase for utc <-> seconds conversion Fix negative time in seconds_to_universaltime/1 Remove OS taint from datetime conversion Add utc <-> seconds conversions bifs Let prim_file validate ctime in file_info Teach #file_info spec unix epochs for file times Add file_info_opt tests in prim_file_SUITE unix_efile: Zero is a valid number in utime ... Conflicts: erts/emulator/beam/erl_time_sup.c erts/emulator/sys/win32/erl_win_sys.h erts/emulator/sys/win32/sys_time.c
2011-12-08Document file:*_file_info/2Björn-Egil Dahlberg
* file:read_file_info/2 * file:write_file_info/3 Document options and time behavior.
2011-12-08Remove dead codeBjörn-Egil Dahlberg
2011-12-07Return {error,closed} from sendfile if closedLukas Larsson
If the socket is closed by the remote end, sendfile now returns {error,closed}.
2011-12-06Merge branch 'ta/docs'Henrik Nord
* ta/docs: Fix misspelling of chosen Fix typos in erl(1) Fix misspelling of 'turn off' Fix typo in reltool(3) Fix typo in gen_sctp(3) Fix typo in mod_responsecontrol.erl Fix typo in erts_alloc(3) Fix typos in ssl_cipher.erl Fix typos in expressions.xml file: correct make_link/2 and make_symlink/2 docs Fix typo in test_server(3) Fix typos in io_protocol.xml Fix typo in erlang(3) Fix typos in tar_SUITE Fix typos in erts/preloaded/src OTP-9787
2011-12-06Merge branch 'ao/fix-change-time-inval-dates'Henrik Nord
* ao/fix-change-time-inval-dates: Fix a crash when file:change_time/2,3 are called with invalid dates OTP-9785
2011-12-05file: correct make_link/2 and make_symlink/2 docsTuncer Ayaz
2011-12-02Add spec for file:read_link_info/2Björn-Egil Dahlberg
2011-12-02Move datetime into prim_fileBjörn-Egil Dahlberg
2011-12-02stdlib: Fix return file_info on epochBjörn-Egil Dahlberg
2011-12-02Fix undefined datetimesBjörn-Egil Dahlberg
2011-12-02Teach file.erl datetime conversionsBjörn-Egil Dahlberg
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-02Expand sendfile documentationLukas Larsson
2011-12-02Move sendfile api to file moduleLukas Larsson
Since sendfile could in theory be used to send to any type of file descriptor in *nix, it is a better fit to have it in file.
2011-12-01Create erlang fallback for sendfileLukas Larsson
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.
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."
2011-11-01Fix a crash when file:change_time/2,3 are called with invalid datesAhmed Omar
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).
2011-08-16compiler: Don't create filenames starting with "./"Björn Gustavsson
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.
2011-06-20Add more specs and typesHans Bolinder
An incorrect spec, rpc:yield/1, has been fixed.
2011-05-09Types and specifications have been modified and addedHans Bolinder
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2011-02-14Fix -spec for file:write_file/3Magnus Henoch
Change type for second parameter from binary() to iodata(), since the function explicitly takes steps to accept lists as well as binaries.
2010-12-03Merge branch 'ks/erl_bif_types-cleanup/OTP-8961' into devPatrik Nyblom
* ks/erl_bif_types-cleanup/OTP-8961: Fix type information of 'file' and 'code' modules Conflicts: lib/hipe/cerl/erl_bif_types.erl
2010-11-30Teach file to accept codepoints beyond 255.Patrik Nyblom
2010-11-30Handle binary file names and conversion of unicode stringsPatrik Nyblom
2010-11-29Teach filename to accept raw data and add filename enc option to emuPatrik Nyblom
2010-11-29Fix type information of 'file' and 'code' modulesKostis Sagonas
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.
2010-10-14Add the {encoding, _} options to file:open/2's modesKostis Sagonas
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.
2010-06-08Change typespecs for file.erl to match realityPatrik Nyblom
2010-06-07Merge branch 'ms/file-exclusive-mode' into devErlang/OTP
* 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.
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-03kernel: Add declaration for exported typesKostis Sagonas
2010-06-01Teach file:write/read/read_line about named io_serversPatrik Nyblom
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-03-07file.hrl: Move out type declarationsKostis Sagonas
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.
2010-02-14file.erl: Add a type to be used from other modulesKostis Sagonas
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP