diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index ea226c53b..51ab6dc94 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -399,6 +399,24 @@ TrOpenFile( tr_session * session, } #endif +#if defined( SYS_DARWIN ) + /** + * 1. Enable readahead for reasons described above w/POSIX_FADV_SEQUENTIAL. + * + * 2. Disable OS-level caching due to user reports of adverse effects of + * excessive inactive memory. However this is experimental because + * previous attempts at this have *also* had adverse effects (see r8198) + * + * It's okay for this to fail silently, so don't let it affect errno + */ + { + const int err = errno; + fcntl( file->fd, F_NOCACHE, 1 ); + fcntl( file->fd, F_RDAHEAD, 1 ); + errno = err; + } +#endif + return 0; }