diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-06-16 16:54:30 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-06-16 16:54:30 +0000 |
commit | 9e8563ebc33bbae323eead47a41b9d6333fca065 (patch) | |
tree | a1f2bca48bf254416d596a1babaea2103a21eaec /sys/kern | |
parent | f87cf415222bef86c12f14f4f25072a7a0f1f99a (diff) |
When processing the KERN_VNODE sysctl, the kernel builds a packed structure,
while pstat(8) expects a C structure abiding the regular structure packing
rules. This caused pstat -v to break on powerpc.
Unbreak the confusion by defining the structure in a common header file,
and having the kernel use it.
ok millert@ deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_subr.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0b7a3ac78e1..4d899a48ce5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.85 2002/06/08 18:36:45 art Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.86 2002/06/16 16:54:25 miod Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1433,10 +1433,8 @@ sysctl_vnode(where, sizep, p) char *ewhere; int error; -#define VPTRSZ sizeof (struct vnode *) -#define VNODESZ sizeof (struct vnode) if (where == NULL) { - *sizep = (numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ); + *sizep = (numvnodes + KINFO_VNODESLOP) * sizeof(struct e_vnode); return (0); } ewhere = where + *sizep; @@ -1465,15 +1463,19 @@ again: goto again; } nvp = vp->v_mntvnodes.le_next; - if (bp + VPTRSZ + VNODESZ > ewhere) { + if (bp + sizeof(struct e_vnode) > ewhere) { simple_unlock(&mntvnode_slock); *sizep = bp - where; return (ENOMEM); } - if ((error = copyout((caddr_t)&vp, bp, VPTRSZ)) || - (error = copyout((caddr_t)vp, bp + VPTRSZ, VNODESZ))) + if ((error = copyout((caddr_t)&vp, + &((struct e_vnode *)bp)->vptr, + sizeof(struct vnode *))) || + (error = copyout((caddr_t)vp, + &((struct e_vnode *)bp)->vnode, + sizeof(struct vnode)))) return (error); - bp += VPTRSZ + VNODESZ; + bp += sizeof(struct e_vnode); simple_lock(&mntvnode_slock); } |