summaryrefslogtreecommitdiff
path: root/src/AbstractDiskWriter.cc
Commit message (Collapse)AuthorAgeFilesLines
* Avoid non-nil argument errorsTatsuhiro Tsujikawa2023-09-181-2/+2
| | | | | Use std::copy_n and std::fill_n to avoid a non-nil argument error with memcpy/memset.
* clang-format-12Tatsuhiro Tsujikawa2021-10-301-1/+1
|
* flush OS write buffers before saving control fileAli MJ Al-Nasrawy2020-06-171-0/+12
| | | | | | | | | | This ensures that pieces are physically written to disk before marking them as finished in the control file. This should prevent data loss and corruption when resuming downloads after a system crash. Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
* Enable IndentPPDirectivesTatsuhiro Tsujikawa2018-06-091-20/+20
|
* clang-format-5.0Tatsuhiro Tsujikawa2017-11-231-22/+27
|
* MacOS: Allocate once (apfs compat)Nils Maier2017-11-011-16/+12
|
* Propagate disk full error on pre-allocation to last error codeTatsuhiro Tsujikawa2017-02-231-13/+24
|
* Clang-format and small amendsTatsuhiro Tsujikawa2016-05-311-3/+4
| | | | | mapaddr_ is always nullptr in this context, so no need to set to nullptr again.
* fixed mmap failure check with MAP_FAILED flagsuzker2016-05-271-3/+7
|
* Compare filesize directly to the numeric max of size_tsuzker2016-05-251-2/+1
|
* added filesize overflow check for mmap on 32bit ossuzker2016-05-241-0/+8
|
* Don't inherit file descriptor to child processTatsuhiro Tsujikawa2016-02-081-0/+1
| | | | | | For non-Mingw32 build, set FD_CLOEXEC to file descriptors which live beyond function scope. For Mingw32 build, just pass false to bInheritHandles parameter of CreateProcessW.
* mingw: Use SetFileValidData to make --file-allocation=falloc workTatsuhiro Tsujikawa2016-01-281-0/+9
|
* mingw: Add formatLastError as wrapper function for FormatMessageTatsuhiro Tsujikawa2016-01-281-7/+5
|
* make clang-format using clang-format-3.6Tatsuhiro Tsujikawa2015-12-271-194/+191
|
* Use cached filesize instead of calling size() againTatsuhiro Tsujikawa2015-11-141-1/+1
|
* Don't enable mmap if file allocation is disabledTatsuhiro Tsujikawa2015-11-121-5/+11
| | | | | | | Without file allocation, we cannot map file because file length could be zero. This could fix bug reported at GH-478
* Disard cache when checking checksumTatsuhiro Tsujikawa2014-07-021-0/+8
| | | | This will slow down checksum checking but does not thrash cache.
* OSX: Use F_NOCACHE instead of F_GLOBAL_NOCACHENils Maier2014-05-261-2/+2
| | | | | The latter persists for the lifetime of the file, while the former affects only the current descriptor.
* Fix (unknown length) downloads larger than 2GiBNils Maier2014-05-251-0/+1
| | | | Closes #215
* Fix F_PREALLOC based allocation on some OSX versionsNils Maier2014-05-081-4/+12
|
* Remove unused function getWin32HandleNils Maier2014-05-081-9/+0
|
* Implement falloc equivalent in OSXNils Maier2014-04-121-0/+18
|
* Clean up if defined styleTatsuhiro Tsujikawa2013-09-171-2/+2
|
* Convert most 0/NULL pointers to nullptrNils Maier2013-08-201-4/+4
| | | | Courtesy of llvm cpp11-migrate 3.3
* Support off64_t for Android buildTatsuhiro Tsujikawa2013-05-061-2/+2
| | | | | | | | Android NDK R8e does not provide ftruncate64, but bionic has the assembler code to access kernel function. We borrowed those ftruncate64.S files from android source code repository. It turns out that x86 asm.h in NDK R8e is also broken, so latest asm.h was also borrowed.
* mingw32: Make NTFS sparse file on --file-allocation=truncTatsuhiro Tsujikawa2013-01-111-1/+13
|
* mingw32: Use HANDLE only for MinGW32 buildTatsuhiro Tsujikawa2012-12-151-67/+95
|
* Removed warning when --file-allocation=falloc is used in MinGW32 buildTatsuhiro Tsujikawa2012-12-061-5/+0
| | | | | The warning was just a mistake. SetFilePointerEx + SetEndOfFile actually allocate disk space.
* mingw32: Removed FSCTL_SET_SPARSE setTatsuhiro Tsujikawa2012-12-031-8/+0
|
* mingw32: Open file using _wsopen and added --enable-mmap supportTatsuhiro Tsujikawa2012-12-011-137/+180
| | | | | | | | | | | | | | | | | I tried CreateFile but the subsequent ReadFile fails with Access Denied if sparse file is read on NTFS. I mostly reverted previous changes and use _wsopen with read/write share enabled instead of CreateFile. This change also includes --enable-mmap support for MinGW32 build. Memory mapped file may be useful for 64-bits OS and lots of RAM. Currently, FlushViewOfFile is not called during the download, so it is slightly vulnerable against sudden power loss. I found lots of read when resuming download due to page fault. So for now it is useful for the initial download. I recommend not to use --file-allocation=prealloc with --enable-mmap for MinGW32, because it triggers page faults even in the initial download. Anyway, the option is experimental.
* Use Win32 API for file I/O in AbstractDiskWriterTatsuhiro Tsujikawa2012-11-301-41/+135
| | | | Now file has been opened by aria2 is now readable by other processes.
* Set F_GLOBAL_NOCACHE for Mac OS XTatsuhiro Tsujikawa2012-11-281-0/+3
|
* Refactored file open codeTatsuhiro Tsujikawa2012-11-281-25/+21
|
* Removed trailing spacesTatsuhiro Tsujikawa2012-10-011-1/+1
|
* Use int64_t instead of off_tTatsuhiro Tsujikawa2012-07-231-14/+14
| | | | | | | | Using off_t, at least, in DiskAdaptor layer is problematic because torrent can contain under 2GiB files but total sum of those files may exceed 2GiB limit, which makes off_t overflow in 32 bit system without large file support. So we use int64_t in API. We'll check the file length before download so that it does not exceed max off_t.
* Use PRId64 for int64_t format specifierTatsuhiro Tsujikawa2012-06-251-2/+2
|
* Added --enable-mmap option.Tatsuhiro Tsujikawa2012-06-241-18/+97
| | | | | If this option is used, map files into memory using mmap(2). This option is experimental.
* No retry for close() with EINTR. Also reverted changes in d5ffa253.Tatsuhiro Tsujikawa2011-12-251-15/+3
|
* Log filename in the exception when AbstractDiskWriter::closeFile() failed.Tatsuhiro Tsujikawa2011-12-101-2/+4
|
* AbstractDiskWriter::closeFile(): Throw exception if close() failed.Tatsuhiro Tsujikawa2011-12-091-2/+12
| | | | | | | | | | | ~AbstractDiskWriter calles closeFile(), but suppresses exception. MultiDiskAdaptor::closeFile() logs error if child DiskWriter::closeFile() throws exception. This exception is not rethrown. If at least one exception is caught, MultiDiskAdaptor::closeFile() throws new DlAbortEx. RequestGroupMan::closeFile() just logs exception and suppress each exception. Generally, don't call closeFile() in destructor. If you need to call it, it must suppress the exception.
* Replaced uint64_t with off_t or int64_t.Tatsuhiro Tsujikawa2011-12-091-5/+5
| | | | | Since off_t is int64_t with LFS, we cannot take advantage of extra capacity of uint64_t.
* Added global::cerr. windows.h now included from common.hTatsuhiro Tsujikawa2011-08-101-4/+0
| | | | | | | We replaced most of std::cerr with global::cerr. windows.h is now included from common.h. Before including it, we define WINVER. We renamed some variable name because some macros in windows.h collide with them.
* Removed utf8ToNative from log message and exception message.Tatsuhiro Tsujikawa2011-08-081-6/+6
|
* In MinGW32, open file with UNICODE filename and print them in ANSI.Tatsuhiro Tsujikawa2011-08-041-10/+11
|
* Removed use of O_DIRECT because it performs bad.Tatsuhiro Tsujikawa2011-07-161-22/+1
|
* Implemented fast file allocation in MinGW32 build.Tatsuhiro Tsujikawa2011-06-071-1/+18
| | | | | | We use SetFilePointerEx and SetEndOfFile to allocate extents. This only works with NTFS. To enable this feature, --file-allocation=falloc must be given.
* Use %lx for DWORD.Tatsuhiro Tsujikawa2010-12-191-1/+1
| | | | GetLastError() returns DWORD, not C-String.
* Fixed compile error which occurs when system has posix_fallocate() butTatsuhiro Tsujikawa2010-12-051-1/+1
| | | | does not have fallocate().
* Added more error code values.Tatsuhiro Tsujikawa2010-12-011-27/+45
| | | | | I have not set error code for all exception invocation. In this change, I set error code where error likely occurs.