tobert / pcstat

Page Cache stat: get page cache stats for files on Linux
Apache License 2.0
1.23k stars 153 forks source link

skip invalid/error cases instead of fataling. #6

Closed aybabtme closed 10 years ago

aybabtme commented 10 years ago

To skip directories requires adding additional logic in the getMincore func, to tell the loop it should skip. I do this by returning errors. Since other cases were fataling, I made them return errors and the loop skip them too.

Since the loop skips pcStat entries, the size is not known in advance, so I initialize the stats slice with a capacity instead of a length, and use append to insert values in.

r: @tobert