mono / mono.posix

POSIX/Unix interface for Mono, .NET and .NET Core. Provides functionality for managed code to access POSIX/Unix features not accessible via the BCL. This repository supersedes the older code in https://github.com/mono/mono
MIT License
40 stars 9 forks source link

Inode should be ulong instead of long #51

Open Kimi-Arthur opened 1 week ago

Kimi-Arthur commented 1 week ago

According to stat.h, st_ino is of type __darwin_ino64_t, which is an alias of __uint64_t defined in _types.h (for Apple?)

Another example is from opengroup: stat.h says st_ino is of type ino_t and types.h says ino_t is unsigned integer types.

Normally it won't be an issue, but with mergerfs, the calculated inode number can be very big. With current code here, it can raise a conversion error like

System.OverflowException: Value was either too large or too small for an Int64.
   at System.Convert.ThrowInt64OverflowException()
   at System.Convert.ToInt64(UInt64 value)
   at Mono.Unix.UnixFileSystemInfo.get_Inode()