On Fri, Jan 04, 2008 at 07:08:55PM +0100, Martin Carpenter wrote: > > Hello all, > > I'm trying to determine the file attributes (mode, owner, group) from an > open() via the syscall probe. I have found fds[] and fileinfo_t and also > > curthread->t_procp->p_user.u_finfo.fi_list[arg0].uf_file->f_vnode > > which gets me as far as the vnode. But I don't see how to get to struct > vattr from there, or if there is a function that will enable me to access > these in the predicate. > > Many thanks for any illumination, > > Martin.
There is no way to statically examine that data because it's up to each filesystem to implement a function, VOP_GETATTR(), that fills that structure in, and there is no requirement everything in sitting in an in-core vattr_t already. And if the object is not in core, that function will need to read it in from disk etc. So you can't generically use DTrace to examine in-memory data and be assured of getting this data. You'll need to look at the code for the underlying filesystem of your open() and, assuming all the data is in-memory, write a function for that filesystem to get what you need. As one example if you look at ufs_getattr(), you will see that you can do a relatively straightforward conversion from f_vnode to the ufs inode structure, and from there get at i_uid, i_gid, i_mode, etc. ZFS is more complicated due to the use of FUIDs, but in the common case you should be able to get what you need from the znode. -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/ _______________________________________________ dtrace-discuss mailing list [email protected]
