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

64bit linux support for stat() and friends

Moderators: kris

Posted: 11/17/08 02:28:04

Hello

I have patched my local copy of Tango to include support for the 64bit "struct stat_t" type.

I'm unsure how to properly setup the conditional compile but here is what I have

    /* in the module tango.stdc.posix.sys.stat */
version( linux )
{
    static if ( (void*).sizeof == 8 ) // WORDSIZE == 64 
    {
        struct stat_t
        {
          dev_t     st_dev;
          ino_t     st_ino;
          nlink_t   st_nlink;
          mode_t    st_mode;
          uid_t     st_uid;
          gid_t     st_gid;
          int __pad0;
          dev_t     st_rdev;
          off_t     st_size;
          blksize_t st_blksize;
          blkcnt_t  st_blocks;
          
          static if( false /*__USE_MISC*/ ) // true if _BSD_SOURCE || _SVID_SOURCE
          {
            timespec    st_atim;
            timespec    st_mtim;
            timespec    st_ctim;
            alias st_atim.tv_sec st_atime;
            alias st_mtim.tv_sec st_mtime;
            alias st_ctim.tv_sec st_ctime;
          }
          else
          {
            time_t  st_atime;
            ulong   st_atimensec;
            time_t  st_mtime;
            ulong   st_mtimensec;
            time_t  st_ctime;
            ulong   st_ctimensec;
          }
          
          long __unused[3];
        }
    }
    ...
    ...

There are no responses to display.