Keep reading until end-of-file in reading procfs
As the pread(2) says "it is not an error for a successful call to transfer fewer bytes than requested". The only way to verify we're hitting the end-of-file is to keep reading from the file until it returns 0. Here we're following this rule, in order to make sure we read the whole procfs file to avoid the parser errors. The drawback is that, now for every procfs read, it'll have to hit the pread() at least twice. But if it has reached to the end-of-file, the last read should return within microseconds. Bug: 351917521 Flag: EXEMPT bugfix Test: dumpsys cpuinfo Change-Id: If6a14c4e8f4f1821628f1efb984f8064d4969a8c
Loading
Please register or sign in to comment