Make android_os_Process_readProcFile allocate less

Make android_os_Process_readProcFile read small proc files into a
stack-allocated buffer and fall back to the heap only for larger
files. Avoid pointless zeroing of memory that we're going to use for
read() buffers. Read proc files atomically instead of
piece-by-piece. Use Android RAII helpers instead of explicit
resource management.

Bug: 140439982
Test: booted, works
Change-Id: Ifc02a4bbab0cfd968aff841d7ce0af846db613eb
1 file changed