Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1071: tango.stat.patch

File tango.stat.patch, 5.4 kB (added by e-t172, 7 months ago)

Fix to the stat_t structure

  • tango/stdc/posix/config.d

    old new  
    1717    const bool  __USE_FILE_OFFSET64 = false; 
    1818    const bool  __USE_LARGEFILE64   = false; 
    1919    const bool  __REDIRECT          = false; 
     20 
     21    version( X86 ) 
     22    { 
     23        const uint __WORDSIZE = 32; 
     24    } 
     25 
     26    version( X86_64 ) 
     27    { 
     28        const uint __WORDSIZE = 64; 
     29    } 
    2030} 
  • tango/stdc/posix/sys/types.d

    old new  
    3636 
    3737version( linux ) 
    3838{ 
    39   static if( __USE_FILE_OFFSET64 ) 
    40   { 
     39    // From <bits/typesizes.h> 
     40 
    4141    alias long      blkcnt_t; 
     42    alias long      blkcnt64_t; 
     43    alias long      blksize_t; 
     44    alias ulong     dev_t; 
     45    alias uint      gid_t; 
    4246    alias ulong     ino_t; 
    43     alias long      off_t; 
     47    alias ulong     ino64_t; 
     48    alias uint      mode_t; 
     49  static if( __WORDSIZE == 32 ) 
     50  { 
     51    alias uint      nlink_t; 
    4452  } 
    4553  else 
    4654  { 
    47     alias c_long    blkcnt_t; 
    48     alias c_ulong   ino_t; 
    49     alias c_long    off_t; 
     55    alias ulong     nlink_t; 
    5056  } 
    51     alias c_long    blksize_t; 
    52     alias ulong     dev_t; 
    53     alias uint      gid_t; 
    54     alias uint      mode_t; 
    55     alias uint      nlink_t; 
     57    alias long      off_t; 
     58    alias long      off64_t; 
    5659    alias int       pid_t; 
    5760    //size_t (defined in tango.stdc.stddef) 
     61  static if( __WORDSIZE == 32 ) 
     62  { 
    5863    alias int       ssize_t; 
     64  } 
     65  else 
     66  { 
     67    alias long      ssize_t; 
     68  } 
    5969    //time_t (defined in tango.stdc.time) 
    6070    alias uint      uid_t; 
    6171} 
     
    107117 
    108118version( linux ) 
    109119{ 
    110   static if( __USE_FILE_OFFSET64 ) 
    111   { 
     120    // From <bits/typesizes.h> 
     121 
     122    // clock_t (defined in tango.stdc.time) 
    112123    alias ulong     fsblkcnt_t; 
     124    alias ulong     fsblkcnt64_t; 
    113125    alias ulong     fsfilcnt_t; 
    114   } 
    115   else 
    116   { 
    117     alias c_ulong   fsblkcnt_t; 
    118     alias c_ulong   fsfilcnt_t; 
    119   } 
    120     // clock_t (defined in tango.stdc.time) 
     126    alias ulong     fsfilcnt64_t; 
    121127    alias uint      id_t; 
    122128    alias int       key_t; 
    123     alias c_long    suseconds_t; 
     129    alias long      suseconds_t; 
    124130    alias uint      useconds_t; 
    125131} 
    126132else version( darwin ) 
  • tango/stdc/posix/sys/stat.d

    old new  
    7979        struct stat_t 
    8080        { 
    8181            dev_t       st_dev; 
     82          static if( __WORDSIZE == 64 ) 
     83          { 
     84            ino64_t     st_ino; 
     85            nlink_t     st_nlink; 
     86            mode_t      st_mode; 
     87          } 
     88          else 
     89          { 
    8290            uint        __pad1; 
    8391            ino_t       __st_ino; 
    8492            mode_t      st_mode; 
    8593            nlink_t     st_nlink; 
     94          } 
    8695            uid_t       st_uid; 
    8796            gid_t       st_gid; 
     97          static if( __WORDSIZE == 64 ) 
     98          { 
     99            int         pad0; 
    88100            dev_t       st_rdev; 
     101            off_t       st_size; 
     102          } 
     103          else 
     104          { 
     105            dev_t       st_rdev; 
    89106            uint        __pad2; 
    90107            off64_t     st_size; 
     108          } 
    91109            blksize_t   st_blksize; 
    92110            blkcnt64_t  st_blocks; 
    93111 
     
    109127            time_t      st_ctime; 
    110128            c_ulong     st_ctimensec; 
    111129          } 
     130          static if ( __WORDSIZE == 64 ) 
     131          { 
     132            long        __unused[3]; 
     133          } 
     134          else 
     135          { 
    112136            ino64_t     st_ino; 
     137          } 
    113138        } 
    114139    } 
    115140    else 
     
    117142        struct stat_t 
    118143        { 
    119144            dev_t       st_dev; 
     145          static if( __WORDSIZE == 32 ) 
     146          { 
    120147            ushort      __pad1; 
    121           static if( __USE_FILE_OFFSET64 ) 
     148          } 
     149          static if( __WORDSIZE != 64 && __USE_FILE_OFFSET64 ) 
    122150          { 
    123151            ino_t       __st_ino; 
    124152          } 
     
    126154          { 
    127155            ino_t       st_ino; 
    128156          } 
     157          static if( __WORDSIZE == 32 ) 
     158          { 
    129159            mode_t      st_mode; 
    130160            nlink_t     st_nlink; 
     161          } 
     162          else 
     163          { 
     164            nlink_t     st_nlink; 
     165            mode_t      st_mode; 
     166          } 
    131167            uid_t       st_uid; 
    132168            gid_t       st_gid; 
     169          static if( __WORDSIZE == 64 ) 
     170          { 
     171            int         pad0; 
     172          } 
    133173            dev_t       st_rdev; 
     174          static if( __WORDSIZE == 32 ) 
     175          { 
    134176            ushort      __pad2; 
     177          } 
    135178            off_t       st_size; 
    136179            blksize_t   st_blksize; 
     180          static if( __WORDSIZE != 64 && __USE_FILE_OFFSET64 ) 
     181          { 
     182            blkcnt64_t  st_blocks; 
     183          } 
     184          else 
     185          { 
    137186            blkcnt_t    st_blocks; 
     187          } 
    138188          static if( false /*__USE_MISC*/ ) // true if _BSD_SOURCE || _SVID_SOURCE 
    139189          { 
    140190            timespec    st_atim; 
     
    153203            time_t      st_ctime; 
    154204            c_ulong     st_ctimensec; 
    155205          } 
     206          static if( __WORDSIZE == 64 ) 
     207          { 
     208            long[3]     __unused; 
     209          } 
    156210          static if( __USE_FILE_OFFSET64 ) 
    157211          { 
    158             ino_t       st_ino; 
     212            ino64_t     st_ino; 
    159213          } 
    160214          else 
    161215          {