That's definitely an improvement - thanks.
On 6 September 2011 17:55, Jonathan Adams <jonathan.ad...@oracle.com> wrote: > On Tue, Sep 06, 2011 at 10:53:13AM +0100, Toby Riddell wrote: >> I managed to get it working by hard-coding the offset (ugh!): >> >> syscall::lstat64:return >> / self->stat && pid == $target / >> { >> this->path = copyinstr(self->path); >> printf("Path: %s\n", this->path); >> >> this->stat = copyin( self->stat + 0x34, sizeof(long long) ); >> printf("File size: %lld\n", *((long long *)(this->stat))); >> >> self->stat = 0; >> } > > The problem is that dtrace is trying to prevent unaligned loads, mainly > because SPARC faults on them; I'm not entirely sure, but I believe > amd64 wouldn't have a problem with performing the load. > > If you want to make this less hardcoded, you could do: > > this->stat = copyin(self->stat + offsetof(struct stat64_32, st_size), > sizeof (long long)); > > Cheers, > - jonathan > >> On 6 September 2011 09:51, <casper....@oracle.com> wrote: >> > >> > >> >>The size of the file (hex a8) appears at byte 34 which doesn't agree >> >>with any of the different structs... (in struct stat32 it's at offset >> >>30). >> > >> > I run the mdb command on SPARC, on x86 it is: >> > >> >> ::print -at "struct stat64_32" >> > 0 struct stat64_32 { >> > 0 dev32_t st_dev >> > 4 int32_t [3] st_pad1 >> > 10 ino64_t st_ino >> > 18 mode32_t st_mode >> > 1c nlink32_t st_nlink >> > 20 uid32_t st_uid >> > 24 gid32_t st_gid >> > 28 dev32_t st_rdev >> > 2c int32_t [2] st_pad2 >> > 34 off64_t st_size <--- offset 0x34 >> > 3c timestruc32_t st_atim { >> > 3c time32_t tv_sec >> > 40 int32_t tv_nsec >> > } >> > 44 timestruc32_t st_mtim { >> > 44 time32_t tv_sec >> > 48 int32_t tv_nsec >> > } >> > 4c timestruc32_t st_ctim { >> > 4c time32_t tv_sec >> > 50 int32_t tv_nsec >> > } >> > 54 int32_t st_blksize >> > 58 blkcnt64_t st_blocks >> > 60 char [16] st_fstype >> > 70 int32_t [8] st_pad4 >> > } >> > >> > >> > Not sure about the why the code doesn't work. >> > >> > Casper >> > >> > >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss@opensolaris.org > _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org