eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

Switch to u64 from usize in many places #147

Closed h33p closed 3 years ago

h33p commented 3 years ago

Apologies for such a long delay, work got in the way.

I've implemented the base changes needed to fix https://github.com/eminence/procfs/issues/141. Both diskstats and stat were changed to use u64. I've noticed my NAS having diskstat numbers in the tens of billions so I thought the change there was appropriate. Some places I'm still not sure what to do about:

sys/vm admin_reserve_kbytes was kept as usize, as it would not make much sense to reserve billions of kilobytes. sys/fs file_max was kept as usize, since I am not sure where would billions of files be opened.

However, both of these are rather arbitrary, and could be changed to u64. If you'd like that I'll be glad to make the change.

In the end, procfs now works just fine as a 32-bit executable on 64-bit machines.

eminence commented 3 years ago

Thanks for this PR, these changes look good to me. I'm OK keeping admin_reserve_kbytes and file_max as they are. If anyone does run into that 32-bit limit, hopefully they'll open an issue :)