Convert from C file IO to UNIX file IO

Unix file IO allows finer control than C file IO.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Test read error before calculating pixel value

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Advice the read data will not be accessed in the near future

Advice the system the data that was just read won't be accessed in the near
future. This prevents buffer cache pollution in Linux.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>