Re: Inconsistency about struct stat and dev_t on mips and mipsel

James Cowgill <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
On Tue, 2015-09-15 at 10:49 +0200, Thomas Schmitt wrote:
> Hi,
> 
> meanwhile i plan to settle with a generic solution:
> 
>   dev_t dev_param;
>   ...
>      /* Do not rely on sizeof(stbuf->st_rdev)==sizeof(dev_t), (Debian mips) */
>      Xorriso_node_get_dev(xorriso, *node, path, &dev_param, 0);
>      stbuf->st_rdev = dev_param;
> 
> 
> James Cowgill wrote:
> > I don't think Linux (the kernel) currently supports 64-bit device
> > numbers on any arch.
> 
> Now i wonder why dev_t is 64 bit on the first hand.

I'm not entirely sure. My guess is that the glibc maintainers did it to
avoid having to change the ABI again in the future if 64-bit device
numbers were ever used. This says a little on it:
https://sourceware.org/ml/libc-alpha/1999-q1/msg00428.html

> Isn't it a kernel interface type ?
> I understand that on my machine #include  is read from
>   /usr/include/x86_64-linux-gnu/sys/types.h
> and merely maps kernel types to userland types.
>
> 
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/types.h?id=refs/tags/v4.3-rc1
> 
> Doesn't  stem from this file on mips ?

No the kernel and glibc headers are completely different. glibc
contains lots of code to convert between the types (and differing
struct stat layouts etc).

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/xstatconv.c

In glibc sizeof(dev_t) is defined in
/usr/include/<multiarch>/bits/typesizes.h (as 64-bit on every arch).

James
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABCgAGBQJV9+fKAAoJEMfxZ23qLQHvELAP/A8AkQNDPH3QQgWm6addE02C
6eTltbewfcf4/K1s9dSlDWaJkQ9361I4OkU/9GTJJvvQfO8GFhl/4cA1sNfhgH8D
hWyrRLRPIv9qRM4BboMq4X6oCI5iFsdPAtCdS7EMe1vULF8oEgUKG07BENUZUPeG
jjbptTQBD/bxAOJ89cV7J7hZ+RMYZSdbGjRb1ZmBG1S8Gda4alwAodUBY2zqIa/2
m6gbEJC98/PSpWsae9RLsgkT9VoD4jG/vaCdxbu81mNliKcq/l7BnYBLnq3++83e
opLAKls48WJUi/KRdhyX7FWU3iim4If59nFtPSNBsYHC2Zryb17Sx6RWVfdtPGS0
mO35JOx3JW1EqeGHg2bbc1bDnI7WkdWfa802/RjLUGb1awLIKLgQiD+q0ktPnDeF
vXEgRp5Vn6MSvZr2MUvnNwQmQfigqh7EhnX0MuOkR5mbliwbNl3j7jj76D1H9M8U
VqaQncQeS480hB0q3lkJyNTcbcrVkr9MZ0N1Vn+tnomCB/hiF34g9zFBobeZaTmY
GOJ1lozGGY8+FL4STgZF4++NvAJEgIhAyTSy3asfvVF0RAIaBwZr/XOVI+9hu6r1
J29xay18oq0TmCF+cWun9Z1RmH9wzD0KKo0gFUanKxdRRgyqA4/zUTvHcB8tyQqC
Yx9Gzfoq9cuNioxULCsB
=2FmI
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.