msync on Hurd, dev_t on MIPS

Julien ÉLIE julien at trigofacile.com
Thu May 5 13:21:35 UTC 2016


Hi Russ,

> Unfortunately, that doesn't have the same meaning if dev_t is an unsigned
> long long.  That takes -1, converts it to an unsigned long (which means
> it's now the positive integer ULONG_MAX) and then assigns it to an
> unsigned long long field, where it might be a perfectly valid device
> identifier in the middle of the available device number range rather than
> a sentinel "invalid device" number as intended.  :(  Chances of a
> collision are thankfully minute, but it's not formally correct.
>
> It *shouldn't* matter, because we always compare against st_ino as well,
> but the formally correct fix is probably to figure out the size of the
> struct stat st_dev field in Autoconf and explicitly cast -1 to that size,
> whatever it is.

OK, understood.  Thanks for the detailed explanation!


> Not sure if it's worth the trouble, though.

Agreed.  I've just added a comment in the source code to mention that a 
few architectures define dev_t to be 64-bits whereas st_dev is 32-bits, 
but that does not matter in our use cases.

-- 
Julien ÉLIE

« – Les sangliers apprécient mieux que toi ma musique !
   – C'est normal, tu chantes comme un cochon !!! » (Astérix)


More information about the inn-workers mailing list