2018-08-06 10:55 GMT-03:00 Elias M. Mariani <marianiel...@gmail.com>:
> #include <sys/types.h>
> #include <stdio.h>
> int main()
> {
>     ino_t ino;
>     off_t off;
>
>     printf("Size of ino: %ld bytes\n",sizeof(ino));
>     printf("Size of off: %ld bytes\n",sizeof(off));
>
>     return 0;
> }
>
> Both are 64 bits.
> But still cant figure out why the struct seems to be out of alignment.
>
> Cheers.
> Elias.
>
> 2018-08-04 21:10 GMT-03:00 Elias M. Mariani <marianiel...@gmail.com>:
>> Hi ports@,
>> I'm tying to port a python package that uses the dirent struct
>> defining the fields like this:
>>
>> _fields_ = (
>>                     ('d_ino', ctypes.c_uint32),  # must be uint32, not ulong
>>                     ('d_off', ctypes.c_long),
>>                     ('d_reclen', ctypes.c_ushort),
>>                     ('d_type', ctypes.c_ubyte),
>>                     ('d_namlen', ctypes.c_ubyte),
>>                     ('d_name', ctypes.c_char * 256),
>>                 )
I was missing this:
        __uint8_t  __d_padding[4];      /* suppress padding after d_name */

>>
>> Now, aren't ino_t and off_t architecture dependent ? If not, how do I
>> find the length of each types ?
>> The others are defined in the dirent description.
>> If dependent of the architecture, I should find a way of using the
>> real definitions in python...
>>
>> Cheers.
>> Elias.

Reply via email to