Example #1
0
 internal static unsafe int fstat(int fd, out structStat buf)
 {
     int result;
     if (IntPtr.Size == 4)
     {
         stat_layout_32 buf32 = default(stat_layout_32);
         result = __fxstat(_STAT_VER_LINUX_32, fd, (byte*)&buf32);
         CopyStat32(ref buf32, out buf);
     }
     else
     {
         stat_layout_64 buf64 = default(stat_layout_64);
         result = __fxstat(_STAT_VER_LINUX_64, fd, (byte*)&buf64);
         CopyStat64(ref buf64, out buf);
     }
     return result;
 }
Example #2
0
        internal static unsafe int fstat(int fd, out structStat buf)
        {
            int result;

            if (IntPtr.Size == 4)
            {
                stat_layout_32 buf32 = default(stat_layout_32);
                result = __fxstat(_STAT_VER_LINUX_32, fd, (byte *)&buf32);
                CopyStat32(ref buf32, out buf);
            }
            else
            {
                stat_layout_64 buf64 = default(stat_layout_64);
                result = __fxstat(_STAT_VER_LINUX_64, fd, (byte *)&buf64);
                CopyStat64(ref buf64, out buf);
            }
            return(result);
        }
Example #3
0
 private static void CopyStat64(ref stat_layout_64 src, out structStat dst)
 {
     dst.st_dev       = src.st_dev;
     dst.st_ino       = src.st_ino;
     dst.st_mode      = src.st_mode;
     dst.st_nlink     = src.st_nlink;
     dst.st_uid       = src.st_uid;
     dst.st_gid       = src.st_gid;
     dst.st_rdev      = src.st_rdev;
     dst.st_size      = (long)src.st_size;
     dst.st_blksize   = src.st_blksize;
     dst.st_blocks    = (long)src.st_blocks;
     dst.st_atime     = src.st_atime;
     dst.st_atimensec = src.st_atimensec;
     dst.st_mtime     = src.st_mtime;
     dst.st_mtimensec = src.st_mtimensec;
     dst.st_ctime     = src.st_ctime;
     dst.st_ctimensec = src.st_ctimensec;
 }
Example #4
0
        // WARNING: While field size differences based on architecture could be handled by using
        // IntPtr as the field type, the layout of types here actually changes based on architecture,
        // e.g. the ordering of the st_mode and st_nlink fields.  As such, the stat type we expose
        // isn't the one we actually use for interop marshaling.

        private static void CopyStat32(ref stat_layout_32 src, out structStat dst)
        {
            dst.st_dev       = src.st_dev;
            dst.st_ino       = src.st_ino;
            dst.st_mode      = src.st_mode;
            dst.st_nlink     = src.st_nlink;
            dst.st_uid       = src.st_uid;
            dst.st_gid       = src.st_gid;
            dst.st_rdev      = src.st_rdev;
            dst.st_size      = src.st_size;
            dst.st_blksize   = src.st_blksize;
            dst.st_blocks    = src.st_blocks;
            dst.st_atime     = src.st_atime;
            dst.st_atimensec = IntPtr.Zero;
            dst.st_mtime     = src.st_mtime;
            dst.st_mtimensec = IntPtr.Zero;
            dst.st_ctime     = src.st_ctime;
            dst.st_ctimensec = IntPtr.Zero;
        }
Example #5
0
 private static void CopyStat64(ref stat_layout_64 src, out structStat dst)
 {
     dst.st_dev = src.st_dev;
     dst.st_ino = src.st_ino;
     dst.st_mode = src.st_mode;
     dst.st_nlink = src.st_nlink;
     dst.st_uid = src.st_uid;
     dst.st_gid = src.st_gid;
     dst.st_rdev = src.st_rdev;
     dst.st_size = src.st_size;
     dst.st_blksize = src.st_blksize;
     dst.st_blocks = (long)src.st_blocks;
     dst.st_atime = src.st_atime;
     dst.st_atimensec = src.st_atimensec;
     dst.st_mtime = src.st_mtime;
     dst.st_mtimensec = src.st_mtimensec;
     dst.st_ctime = src.st_ctime;
     dst.st_ctimensec = src.st_ctimensec;
 }
Example #6
0
        // WARNING: While field size differences based on architecture could be handled by using
        // IntPtr as the field type, the layout of types here actually changes based on architecture,
        // e.g. the ordering of the st_mode and st_nlink fields.  As such, the stat type we expose
        // isn't the one we actually use for interop marshaling.

        private static void CopyStat32(ref stat_layout_32 src, out structStat dst)
        {
            dst.st_dev = src.st_dev;
            dst.st_ino = src.st_ino;
            dst.st_mode = src.st_mode;
            dst.st_nlink = src.st_nlink;
            dst.st_uid = src.st_uid;
            dst.st_gid = src.st_gid;
            dst.st_rdev = src.st_rdev;
            dst.st_size = src.st_size;
            dst.st_blksize = src.st_blksize;
            dst.st_blocks = src.st_blocks;
            dst.st_atime = src.st_atime;
            dst.st_atimensec = IntPtr.Zero;
            dst.st_mtime = src.st_mtime;
            dst.st_mtimensec = IntPtr.Zero;
            dst.st_ctime = src.st_ctime;
            dst.st_ctimensec = IntPtr.Zero;
        }