Changeset 9066
- Timestamp:
- Sep 8, 2009, 6:25:40 AM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/fdlimit.c
r8960 r9066 353 353 /* this doubles the OS level readahead buffer, which in practice 354 354 * turns out to be a good thing, because many (most?) clients request 355 * chunks of blocks in order */ 356 posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL ); 355 * chunks of blocks in order. 356 * It's okay for this to fail silently, so don't let it affect errno */ 357 { 358 const int err = errno; 359 posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL ); 360 errno = err; 361 } 357 362 #endif 358 363 -
trunk/libtransmission/inout.c
r8935 r9066 101 101 102 102 if( ( ioMode == TR_IO_READ ) && !fileExists ) /* does file exist? */ 103 err = ENOENT; 104 else if( ( fd = tr_fdFileCheckout( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 ) { 103 105 err = errno; 104 else if( ( fd = tr_fdFileCheckout ( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 ) 106 tr_torerr( tor, "tr_fdFileCheckout failed for \"%s\": %s", file->name, tr_strerror( err ) ); 107 } 108 else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 ) { 105 109 err = errno; 106 else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 ) 110 tr_torerr( tor, "tr_lseek failed for \"%s\": %s", file->name, tr_strerror( err ) ); 111 } 112 else if( func( fd, buf, buflen ) != buflen ) { 107 113 err = errno; 108 else if( func( fd, buf, buflen ) != buflen )109 err = errno;114 tr_torerr( tor, "read/write failed for \"%s\": %s", file->name, tr_strerror( err ) ); 115 } 110 116 else 111 117 err = 0; … … 176 182 { 177 183 const tr_file * file = &info->files[fileIndex]; 178 const uint64_t 184 const uint64_t bytesThisPass = MIN( buflen, file->length - fileOffset ); 179 185 180 186 err = readOrWriteBytes( tor, ioMode, fileIndex, fileOffset, buf, bytesThisPass );
Note: See TracChangeset
for help on using the changeset viewer.