diff options
author | Erlang/OTP <[email protected]> | 2010-05-24 13:15:03 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-05-24 13:15:03 +0000 |
commit | be2ebfd0f2b8e15363288d1dab4c177c237e234a (patch) | |
tree | b0f8e2844240211f02f89c6fc09a1945af337d1b /erts/emulator/drivers/unix/unix_efile.c | |
parent | 458dcb10f98bffd241a837cbac7c108eb485f706 (diff) | |
parent | 329aff8ed81e94033c836e58bd294a68a8f7be8c (diff) | |
download | otp-be2ebfd0f2b8e15363288d1dab4c177c237e234a.tar.gz otp-be2ebfd0f2b8e15363288d1dab4c177c237e234a.tar.bz2 otp-be2ebfd0f2b8e15363288d1dab4c177c237e234a.zip |
Merge branch 'fm/file-operations' into dev
* 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.)
Diffstat (limited to 'erts/emulator/drivers/unix/unix_efile.c')
-rw-r--r-- | erts/emulator/drivers/unix/unix_efile.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c index 1d094ee613..ea016526ef 100644 --- a/erts/emulator/drivers/unix/unix_efile.c +++ b/erts/emulator/drivers/unix/unix_efile.c @@ -774,6 +774,17 @@ efile_closefile(int fd) } int +efile_fdatasync(Efile_error *errInfo, /* Where to return error codes. */ + int fd) /* File descriptor for file to sync data. */ +{ +#ifdef HAVE_FDATASYNC + return check_error(fdatasync(fd), errInfo); +#else + return efile_fsync(errInfo, fd); +#endif +} + +int efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ int fd) /* File descriptor for file to sync. */ { @@ -1437,3 +1448,14 @@ efile_symlink(Efile_error* errInfo, char* old, char* new) return check_error(symlink(old, new), errInfo); #endif } + +int +efile_fadvise(Efile_error* errInfo, int fd, Sint64 offset, + Sint64 length, int advise) +{ +#ifdef HAVE_POSIX_FADVISE + return check_error(posix_fadvise(fd, offset, length, advise), errInfo); +#else + return check_error(0, errInfo); +#endif +} |