>The results are:
>
>$ sudo dtrace -s process_filesize.d -c ./stat
>Path: /home/triddel/stat.c
>File mode: 63676
>File size: 0
>File inode: 0
>File uid: 33188
>File fstype:
>
>File size is definitely not zero, and nor is the inode. Clearly the
>technique is working for the file path but it seems I'm doing
>something incorrect when accessing members of the stat64 struct.
>
>Can someone point me to what I'm doing wrong?

There are three different stat structures in the kernel:

        - stat32
        - stat64 (native)
        - stat64_32 (for 32 bit large file environment)

*stat64 returns the latter and the differences are:

> ::print -a "struct stat64"
0 {
    0 st_dev 
    8 st_ino 
    10 st_mode 
    14 st_nlink 
    18 st_uid 
    1c st_gid 
    20 st_rdev 
    28 st_size 
    30 st_atim {
        30 tv_sec 
        38 tv_nsec 
    }
    40 st_mtim {
        40 tv_sec 
        48 tv_nsec 
    }
    50 st_ctim {
        50 tv_sec 
        58 tv_nsec 
    }
    60 st_blksize 
    68 st_blocks 
    70 st_fstype 
}
> ::print -a "struct stat64_32"
0 {
    0 st_dev 
    4 st_pad1 
    10 st_ino 
    18 st_mode 
    1c st_nlink 
    20 st_uid 
    24 st_gid 
    28 st_rdev 
    2c st_pad2 
    38 st_size 
    40 st_atim {
        40 tv_sec 
        44 tv_nsec 
    }
    48 st_mtim {
        48 tv_sec 
        4c tv_nsec 
    }
    50 st_ctim {
        50 tv_sec 
        54 tv_nsec 
    }
    58 st_blksize 
    60 st_blocks 
    68 st_fstype 
    78 st_pad4 
}

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to