[MPlayer-dev-eng] [PATCH] Use posix_fadvise in stream_file if available

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Nov 8 14:40:19 CET 2009


On Sun, Nov 08, 2009 at 02:30:56PM +0100, Tobias Diedrich wrote:
>  static int fill_buffer(stream_t *s, char* buffer, int max_len){
>    int r = read(s->fd,buffer,max_len);
> +#ifdef POSIX_FADV_WILLNEED
> +  posix_fadvise(s->fd, s->pos + r, PREFETCH_LEN, POSIX_FADV_WILLNEED);
> +#endif
>    return (r <= 0) ? -1 : r;

Then you have to check for r <= 0 before the fadvise (I think that looks nicer anyway).



More information about the MPlayer-dev-eng mailing list