[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: