lsof and ZFS

NOTE: Vic Abell has released lsof-4.82D.sun, making this obsolete.

Sadly, Sun still doesn't ship ZFS headers with Solaris. I looked at the history of zfs_znode.h and created this patch by trial and error. It should work for systems using versions of zfs_znode.h between 3897 (26-Mar-2007) and 5367 (29-Oct-2007), including Solaris 10 10/2008 (a.k.a. Solaris 10 U6). Click the diff below to dowload the patch file.

--- lsof_4.81_src/dnode.c.DIST  Sat Jan  3 06:09:54 2009
+++ lsof_4.81_src/dnode.c       Sat Jan  3 06:29:58 2009
@@ -58,9 +58,8 @@
 typedef struct znode {
        zfsvfs_t        *z_zfsvfs;      /* pointer to associated vfs */
        vnode_t         *z_vnode;       /* pointer to associated vnode */
-       uint8_t         d1[16];
        uint64_t        z_id;           /* node ID */
-       uint8_t         d2[136];
+       uint8_t         d1[160]; 
        znode_phys_t    *z_phys;        /* pointer to persistent znode */
 } znode_t;
 # else /* HAS_ZFS!=1 */