use O_SYNC when available

This commit is contained in:
Arvid Norberg 2015-01-07 23:21:54 +00:00
parent 774c3b536a
commit c9903bdaf2
2 changed files with 4 additions and 5 deletions

View File

@ -941,11 +941,7 @@ namespace libtorrent
// disabled, enabling this may reduce performance.
//
// One reason to disable caching is that it may help the operating
// system from growing its file cache indefinitely. Since some OSes
// only allow aligned files to be opened in unbuffered mode, It is
// recommended to make the largest file in a torrent the first file
// (with offset 0) or use pad files to align all files to piece
// boundries.
// system from growing its file cache indefinitely.
disk_io_write_mode,
disk_io_read_mode,

View File

@ -1308,6 +1308,9 @@ namespace libtorrent
#endif
#ifdef O_DIRECT
| ((mode & direct_io) ? O_DIRECT : 0)
#endif
#ifdef O_SYNC
| ((mode & no_cache) ? O_SYNC: 0)
#endif
, permissions);