diff options
-rw-r--r-- | sys/miscfs/procfs/procfs.h | 53 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_ctl.c | 6 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_mem.c | 8 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_subr.c | 12 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vfsops.c | 45 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 346 |
6 files changed, 297 insertions, 173 deletions
diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h index 37ef12e6f0d..2c48bb225ec 100644 --- a/sys/miscfs/procfs/procfs.h +++ b/sys/miscfs/procfs/procfs.h @@ -1,4 +1,5 @@ -/* $NetBSD: procfs.h,v 1.14 1995/10/09 11:18:51 mycroft Exp $ */ +/* $OpenBSD: procfs.h,v 1.2 1996/02/27 08:03:34 niklas Exp $ */ +/* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -118,53 +119,15 @@ int procfs_validfile __P((struct proc *)); int procfs_validfpregs __P((struct proc *)); int procfs_validregs __P((struct proc *)); +int procfs_rw __P((void *)); + #define PROCFS_LOCKED 0x01 #define PROCFS_WANT 0x02 -extern int (**procfs_vnodeop_p)(); +extern int (**procfs_vnodeop_p) __P((void *)); extern struct vfsops procfs_vfsops; -/* - * Prototypes for procfs vnode ops - */ -int procfs_badop(); /* varargs */ -int procfs_rw __P((struct vop_read_args *)); -int procfs_lookup __P((struct vop_lookup_args *)); -#define procfs_create ((int (*) __P((struct vop_create_args *))) procfs_badop) -#define procfs_mknod ((int (*) __P((struct vop_mknod_args *))) procfs_badop) -int procfs_open __P((struct vop_open_args *)); -int procfs_close __P((struct vop_close_args *)); -int procfs_access __P((struct vop_access_args *)); -int procfs_getattr __P((struct vop_getattr_args *)); -int procfs_setattr __P((struct vop_setattr_args *)); -#define procfs_read procfs_rw -#define procfs_write procfs_rw -int procfs_ioctl __P((struct vop_ioctl_args *)); -#define procfs_select ((int (*) __P((struct vop_select_args *))) procfs_badop) -#define procfs_mmap ((int (*) __P((struct vop_mmap_args *))) procfs_badop) -#define procfs_fsync ((int (*) __P((struct vop_fsync_args *))) procfs_badop) -#define procfs_seek ((int (*) __P((struct vop_seek_args *))) procfs_badop) -#define procfs_remove ((int (*) __P((struct vop_remove_args *))) procfs_badop) -#define procfs_link ((int (*) __P((struct vop_link_args *))) procfs_badop) -#define procfs_rename ((int (*) __P((struct vop_rename_args *))) procfs_badop) -#define procfs_mkdir ((int (*) __P((struct vop_mkdir_args *))) procfs_badop) -#define procfs_rmdir ((int (*) __P((struct vop_rmdir_args *))) procfs_badop) -#define procfs_symlink ((int (*) __P((struct vop_symlink_args *))) procfs_badop) -int procfs_readdir __P((struct vop_readdir_args *)); -int procfs_readlink __P((struct vop_readlink_args *)); -int procfs_abortop __P((struct vop_abortop_args *)); -int procfs_inactive __P((struct vop_inactive_args *)); -int procfs_reclaim __P((struct vop_reclaim_args *)); -#define procfs_lock ((int (*) __P((struct vop_lock_args *))) nullop) -#define procfs_unlock ((int (*) __P((struct vop_unlock_args *))) nullop) -int procfs_bmap __P((struct vop_bmap_args *)); -#define procfs_strategy ((int (*) __P((struct vop_strategy_args *))) procfs_badop) -int procfs_print __P((struct vop_print_args *)); -#define procfs_islocked ((int (*) __P((struct vop_islocked_args *))) nullop) -#define procfs_advlock ((int (*) __P((struct vop_advlock_args *))) procfs_badop) -#define procfs_blkatoff ((int (*) __P((struct vop_blkatoff_args *))) procfs_badop) -#define procfs_valloc ((int (*) __P((struct vop_valloc_args *))) procfs_badop) -#define procfs_vfree ((int (*) __P((struct vop_vfree_args *))) nullop) -#define procfs_truncate ((int (*) __P((struct vop_truncate_args *))) procfs_badop) -#define procfs_update ((int (*) __P((struct vop_update_args *))) nullop) +void procfs_init __P((void)); +int procfs_root __P((struct mount *, struct vnode **)); + #endif /* _KERNEL */ diff --git a/sys/miscfs/procfs/procfs_ctl.c b/sys/miscfs/procfs/procfs_ctl.c index 3993f81ae4c..d10fe26313f 100644 --- a/sys/miscfs/procfs/procfs_ctl.c +++ b/sys/miscfs/procfs/procfs_ctl.c @@ -1,4 +1,5 @@ -/* $NetBSD: procfs_ctl.c,v 1.13 1995/08/13 09:06:02 mycroft Exp $ */ +/* $OpenBSD: procfs_ctl.c,v 1.2 1996/02/27 08:03:35 niklas Exp $ */ +/* $NetBSD: procfs_ctl.c,v 1.14 1996/02/09 22:40:48 christos Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -49,6 +50,7 @@ #include <sys/tty.h> #include <sys/resource.h> #include <sys/resourcevar.h> +#include <sys/signalvar.h> #include <sys/ptrace.h> #include <miscfs/procfs/procfs.h> @@ -98,6 +100,8 @@ static vfs_namemap_t signames[] = { { 0 }, }; +static int procfs_control __P((struct proc *, struct proc *, int)); + static int procfs_control(curp, p, op) struct proc *curp; diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c index 439d6f56d0c..901f13c5e07 100644 --- a/sys/miscfs/procfs/procfs_mem.c +++ b/sys/miscfs/procfs/procfs_mem.c @@ -1,4 +1,5 @@ -/* $NetBSD: procfs_mem.c,v 1.7 1995/01/05 07:10:54 chopps Exp $ */ +/* $OpenBSD: procfs_mem.c,v 1.2 1996/02/27 08:03:36 niklas Exp $ */ +/* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -56,6 +57,8 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> +static int procfs_rwmem __P((struct proc *, struct uio *)); + static int procfs_rwmem(p, uio) struct proc *p; @@ -182,7 +185,8 @@ procfs_rwmem(p, uio) * Now do the i/o move. */ if (!error) - error = uiomove(kva + page_offset, len, uio); + error = uiomove((caddr_t) (kva + page_offset), + len, uio); vm_map_remove(kernel_map, kva, kva + PAGE_SIZE); } diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 1390a71c5ee..a1eb3e48039 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,5 @@ -/* $NetBSD: procfs_subr.c,v 1.13 1994/06/29 06:34:57 cgd Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.2 1996/02/27 08:03:37 niklas Exp $ */ +/* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -113,7 +114,7 @@ loop: } pfsvplock |= PROCFS_LOCKED; - if (error = getnewvnode(VT_PROCFS, mp, procfs_vnodeop_p, vpp)) + if ((error = getnewvnode(VT_PROCFS, mp, procfs_vnodeop_p, vpp)) != 0) goto out; vp = *vpp; @@ -212,9 +213,10 @@ procfs_freevp(vp) } int -procfs_rw(ap) - struct vop_read_args *ap; +procfs_rw(v) + void *v; { + struct vop_read_args *ap = v; struct vnode *vp = ap->a_vp; struct uio *uio = ap->a_uio; struct proc *curp = uio->uio_procp; @@ -281,7 +283,7 @@ vfs_getuserstr(uio, buf, buflenp) return (EMSGSIZE); xlen = uio->uio_resid; - if (error = uiomove(buf, xlen, uio)) + if ((error = uiomove(buf, xlen, uio)) != 0) return (error); /* allow multiple writes without seeks */ diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c index d20bf8c8a53..e13d196f499 100644 --- a/sys/miscfs/procfs/procfs_vfsops.c +++ b/sys/miscfs/procfs/procfs_vfsops.c @@ -1,4 +1,5 @@ -/* $NetBSD: procfs_vfsops.c,v 1.24 1995/06/18 14:47:39 cgd Exp $ */ +/* $OpenBSD: procfs_vfsops.c,v 1.2 1996/02/27 08:03:38 niklas Exp $ */ +/* $NetBSD: procfs_vfsops.c,v 1.25 1996/02/09 22:40:53 christos Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -46,6 +47,7 @@ #include <sys/param.h> #include <sys/time.h> #include <sys/kernel.h> +#include <sys/systm.h> #include <sys/proc.h> #include <sys/buf.h> #include <sys/syslog.h> @@ -55,12 +57,25 @@ #include <miscfs/procfs/procfs.h> #include <vm/vm.h> /* for PAGE_SIZE */ +int procfs_mount __P((struct mount *, char *, caddr_t, + struct nameidata *, struct proc *)); +int procfs_start __P((struct mount *, int, struct proc *)); +int procfs_unmount __P((struct mount *, int, struct proc *)); +int procfs_quotactl __P((struct mount *, int, uid_t, caddr_t, + struct proc *)); +int procfs_statfs __P((struct mount *, struct statfs *, struct proc *)); +int procfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); +int procfs_vget __P((struct mount *, ino_t, struct vnode **)); +int procfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, + struct vnode **, int *, struct ucred **)); +int procfs_vptofh __P((struct vnode *, struct fid *)); /* * VFS Operations. * * mount system call */ /* ARGSUSED */ +int procfs_mount(mp, path, data, ndp, p) struct mount *mp; char *path; @@ -92,6 +107,7 @@ procfs_mount(mp, path, data, ndp, p) /* * unmount system call */ +int procfs_unmount(mp, mntflags, p) struct mount *mp; int mntflags; @@ -108,12 +124,13 @@ procfs_unmount(mp, mntflags, p) flags |= FORCECLOSE; } - if (error = vflush(mp, 0, flags)) + if ((error = vflush(mp, 0, flags)) != 0) return (error); return (0); } +int procfs_root(mp, vpp) struct mount *mp; struct vnode **vpp; @@ -123,6 +140,7 @@ procfs_root(mp, vpp) } /* ARGSUSED */ +int procfs_start(mp, flags, p) struct mount *mp; int flags; @@ -135,6 +153,7 @@ procfs_start(mp, flags, p) /* * Get file system statistics. */ +int procfs_statfs(mp, sbp, p) struct mount *mp; struct statfs *sbp; @@ -162,6 +181,8 @@ procfs_statfs(mp, sbp, p) return (0); } +/*ARGSUSED*/ +int procfs_quotactl(mp, cmds, uid, arg, p) struct mount *mp; int cmds; @@ -173,14 +194,20 @@ procfs_quotactl(mp, cmds, uid, arg, p) return (EOPNOTSUPP); } -procfs_sync(mp, waitfor) +/*ARGSUSED*/ +int +procfs_sync(mp, waitfor, uc, p) struct mount *mp; int waitfor; + struct ucred *uc; + struct proc *p; { return (0); } +/*ARGSUSED*/ +int procfs_vget(mp, ino, vpp) struct mount *mp; ino_t ino; @@ -190,15 +217,22 @@ procfs_vget(mp, ino, vpp) return (EOPNOTSUPP); } -procfs_fhtovp(mp, fhp, vpp) +/*ARGSUSED*/ +int +procfs_fhtovp(mp, fhp, mb, vpp, what, anon) struct mount *mp; struct fid *fhp; + struct mbuf *mb; struct vnode **vpp; + int *what; + struct ucred **anon; { return (EINVAL); } +/*ARGSUSED*/ +int procfs_vptofh(vp, fhp) struct vnode *vp; struct fid *fhp; @@ -207,10 +241,9 @@ procfs_vptofh(vp, fhp) return (EINVAL); } +void procfs_init() { - - return (0); } struct vfsops procfs_vfsops = { diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 84aea9e2a61..b12ee8f47fd 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,5 @@ -/* $NetBSD: procfs_vnops.c,v 1.35 1995/10/09 14:03:38 mycroft Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.2 1996/02/27 08:03:39 niklas Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.39 1996/02/13 13:12:59 mycroft Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -95,6 +96,102 @@ static int nproc_targets = sizeof(proc_targets) / sizeof(proc_targets[0]); static pid_t atopid __P((const char *, u_int)); /* + * Prototypes for procfs vnode ops + */ +int procfs_badop __P((void *)); + +int procfs_lookup __P((void *)); +#define procfs_create procfs_badop +#define procfs_mknod procfs_badop +int procfs_open __P((void *)); +int procfs_close __P((void *)); +int procfs_access __P((void *)); +int procfs_getattr __P((void *)); +int procfs_setattr __P((void *)); +#define procfs_read procfs_rw +#define procfs_write procfs_rw +int procfs_ioctl __P((void *)); +#define procfs_select procfs_badop +#define procfs_mmap procfs_badop +#define procfs_fsync procfs_badop +#define procfs_seek procfs_badop +#define procfs_remove procfs_badop +int procfs_link __P((void *)); +#define procfs_rename procfs_badop +#define procfs_mkdir procfs_badop +#define procfs_rmdir procfs_badop +int procfs_symlink __P((void *)); +int procfs_readdir __P((void *)); +int procfs_readlink __P((void *)); +int procfs_abortop __P((void *)); +int procfs_inactive __P((void *)); +int procfs_reclaim __P((void *)); +#define procfs_lock nullop +#define procfs_unlock nullop +int procfs_bmap __P((void *)); +#define procfs_strategy procfs_badop +int procfs_print __P((void *)); +int procfs_pathconf __P((void *)); +#define procfs_islocked nullop +#define procfs_advlock procfs_badop +#define procfs_blkatoff procfs_badop +#define procfs_valloc procfs_badop +#define procfs_vfree nullop +#define procfs_truncate procfs_badop +#define procfs_update nullop + +static pid_t atopid __P((const char *, u_int)); + +/* + * procfs vnode operations. + */ +int (**procfs_vnodeop_p) __P((void *)); +struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { + { &vop_default_desc, vn_default_error }, + { &vop_lookup_desc, procfs_lookup }, /* lookup */ + { &vop_create_desc, procfs_create }, /* create */ + { &vop_mknod_desc, procfs_mknod }, /* mknod */ + { &vop_open_desc, procfs_open }, /* open */ + { &vop_close_desc, procfs_close }, /* close */ + { &vop_access_desc, procfs_access }, /* access */ + { &vop_getattr_desc, procfs_getattr }, /* getattr */ + { &vop_setattr_desc, procfs_setattr }, /* setattr */ + { &vop_read_desc, procfs_read }, /* read */ + { &vop_write_desc, procfs_write }, /* write */ + { &vop_ioctl_desc, procfs_ioctl }, /* ioctl */ + { &vop_select_desc, procfs_select }, /* select */ + { &vop_mmap_desc, procfs_mmap }, /* mmap */ + { &vop_fsync_desc, procfs_fsync }, /* fsync */ + { &vop_seek_desc, procfs_seek }, /* seek */ + { &vop_remove_desc, procfs_remove }, /* remove */ + { &vop_link_desc, procfs_link }, /* link */ + { &vop_rename_desc, procfs_rename }, /* rename */ + { &vop_mkdir_desc, procfs_mkdir }, /* mkdir */ + { &vop_rmdir_desc, procfs_rmdir }, /* rmdir */ + { &vop_symlink_desc, procfs_symlink }, /* symlink */ + { &vop_readdir_desc, procfs_readdir }, /* readdir */ + { &vop_readlink_desc, procfs_readlink }, /* readlink */ + { &vop_abortop_desc, procfs_abortop }, /* abortop */ + { &vop_inactive_desc, procfs_inactive }, /* inactive */ + { &vop_reclaim_desc, procfs_reclaim }, /* reclaim */ + { &vop_lock_desc, procfs_lock }, /* lock */ + { &vop_unlock_desc, procfs_unlock }, /* unlock */ + { &vop_bmap_desc, procfs_bmap }, /* bmap */ + { &vop_strategy_desc, procfs_strategy }, /* strategy */ + { &vop_print_desc, procfs_print }, /* print */ + { &vop_islocked_desc, procfs_islocked }, /* islocked */ + { &vop_pathconf_desc, procfs_pathconf }, /* pathconf */ + { &vop_advlock_desc, procfs_advlock }, /* advlock */ + { &vop_blkatoff_desc, procfs_blkatoff }, /* blkatoff */ + { &vop_valloc_desc, procfs_valloc }, /* valloc */ + { &vop_vfree_desc, procfs_vfree }, /* vfree */ + { &vop_truncate_desc, procfs_truncate }, /* truncate */ + { &vop_update_desc, procfs_update }, /* update */ + { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } +}; +struct vnodeopv_desc procfs_vnodeop_opv_desc = + { &procfs_vnodeop_p, procfs_vnodeop_entries }; +/* * set things up for doing i/o on * the pfsnode (vp). (vp) is locked * on entry, and should be left locked @@ -105,14 +202,16 @@ static pid_t atopid __P((const char *, u_int)); * is to support exclusive open on process * memory images. */ -procfs_open(ap) +int +procfs_open(v) + void *v; +{ struct vop_open_args /* { struct vnode *a_vp; int a_mode; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); switch (pfs->pfs_type) { @@ -120,8 +219,8 @@ procfs_open(ap) if (PFIND(pfs->pfs_pid) == 0) return (ENOENT); /* was ESRCH, jsp */ - if ((pfs->pfs_flags & FWRITE) && (ap->a_mode & O_EXCL) || - (pfs->pfs_flags & O_EXCL) && (ap->a_mode & FWRITE)) + if (((pfs->pfs_flags & FWRITE) && (ap->a_mode & O_EXCL)) || + ((pfs->pfs_flags & O_EXCL) && (ap->a_mode & FWRITE))) return (EBUSY); if (ap->a_mode & FWRITE) @@ -143,14 +242,16 @@ procfs_open(ap) * nothing to do for procfs other than undo * any exclusive open flag (see _open above). */ -procfs_close(ap) +int +procfs_close(v) + void *v; +{ struct vop_close_args /* { struct vnode *a_vp; int a_fflag; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); switch (pfs->pfs_type) { @@ -158,6 +259,17 @@ procfs_close(ap) if ((ap->a_fflag & FWRITE) && (pfs->pfs_flags & O_EXCL)) pfs->pfs_flags &= ~(FWRITE|O_EXCL); break; + case Pctl: + case Pstatus: + case Pnotepg: + case Pnote: + case Proot: + case Pcurproc: + case Pproc: + case Pfile: + case Pregs: + case Pfpregs: + break; } return (0); @@ -167,15 +279,10 @@ procfs_close(ap) * do an ioctl operation on pfsnode (vp). * (vp) is not locked on entry or exit. */ -procfs_ioctl(ap) - struct vop_ioctl_args /* { - struct vnode *a_vp; - u_long a_command; - caddr_t a_data; - int a_fflag; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap; +/*ARGSUSED*/ +int +procfs_ioctl(v) + void *v; { return (ENOTTY); @@ -191,14 +298,16 @@ procfs_ioctl(ap) * usual no-op bmap, although returning * (EIO) would be a reasonable alternative. */ -procfs_bmap(ap) +int +procfs_bmap(v) + void *v; +{ struct vop_bmap_args /* { struct vnode *a_vp; daddr_t a_bn; struct vnode **a_vpp; daddr_t *a_bnp; - } */ *ap; -{ + } */ *ap = v; if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; @@ -223,11 +332,13 @@ procfs_bmap(ap) * * (vp) is not locked on entry or exit. */ -procfs_inactive(ap) +int +procfs_inactive(v) + void *v; +{ struct vop_inactive_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); if (PFIND(pfs->pfs_pid) == 0) @@ -243,11 +354,13 @@ procfs_inactive(ap) * to free any private data and remove the node * from any private lists. */ -procfs_reclaim(ap) +int +procfs_reclaim(v) + void *v; +{ struct vop_reclaim_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; return (procfs_freevp(ap->a_vp)); } @@ -255,13 +368,15 @@ procfs_reclaim(ap) /* * Return POSIX pathconf information applicable to special devices. */ -procfs_pathconf(ap) +int +procfs_pathconf(v) + void *v; +{ struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; register_t *a_retval; - } */ *ap; -{ + } */ *ap = v; switch (ap->a_name) { case _PC_LINK_MAX: @@ -293,15 +408,50 @@ procfs_pathconf(ap) * just print a readable description * of (vp). */ -procfs_print(ap) +int +procfs_print(v) + void *v; +{ struct vop_print_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); - printf("tag VT_PROCFS, type %s, pid %d, mode %x, flags %x\n", + printf("tag VT_PROCFS, type %d, pid %d, mode %x, flags %x\n", pfs->pfs_type, pfs->pfs_pid, pfs->pfs_mode, pfs->pfs_flags); + return 0; +} + +int +procfs_link(v) + void *v; +{ + struct vop_link_args /* { + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; + } */ *ap = v; + + VOP_ABORTOP(ap->a_dvp, ap->a_cnp); + vput(ap->a_dvp); + return (EROFS); +} + +int +procfs_symlink(v) + void *v; +{ + struct vop_symlink_args /* { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + char *a_target; + } */ *ap = v; + + VOP_ABORTOP(ap->a_dvp, ap->a_cnp); + vput(ap->a_dvp); + return (EROFS); } /* @@ -310,12 +460,14 @@ procfs_print(ap) * for undoing any side-effects caused by the lookup. * this will always include freeing the pathname buffer. */ -procfs_abortop(ap) +int +procfs_abortop(v) + void *v; +{ struct vop_abortop_args /* { struct vnode *a_dvp; struct componentname *a_cnp; - } */ *ap; -{ + } */ *ap = v; if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) FREE(ap->a_cnp->cn_pnbuf, M_NAMEI); @@ -325,7 +477,10 @@ procfs_abortop(ap) /* * generic entry point for unsupported operations */ -procfs_badop() +/*ARGSUSED*/ +int +procfs_badop(v) + void *v; { return (EIO); @@ -340,14 +495,16 @@ procfs_badop() * * this is relatively minimal for procfs. */ -procfs_getattr(ap) +int +procfs_getattr(v) + void *v; +{ struct vop_getattr_args /* { struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); struct vattr *vap = ap->a_vap; struct proc *procp; @@ -413,6 +570,11 @@ procfs_getattr(ap) vap->va_uid = procp->p_ucred->cr_uid; vap->va_gid = procp->p_ucred->cr_gid; break; + case Pproc: + case Pfile: + case Proot: + case Pcurproc: + break; } /* @@ -489,13 +651,10 @@ procfs_getattr(ap) return (error); } -procfs_setattr(ap) - struct vop_setattr_args /* { - struct vnode *a_vp; - struct vattr *a_vap; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap; +/*ARGSUSED*/ +int +procfs_setattr(v) + void *v; { /* * just fake out attribute setting @@ -518,22 +677,24 @@ procfs_setattr(ap) * but does mean that the i/o entry points need to check * that the operation really does make sense. */ -procfs_access(ap) +int +procfs_access(v) + void *v; +{ struct vop_access_args /* { struct vnode *a_vp; int a_mode; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct vattr va; int error; - if (error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred, ap->a_p)) + if ((error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred, ap->a_p)) != 0) return (error); return (vaccess(va.va_mode, va.va_uid, va.va_gid, ap->a_mode, - ap->a_cred)); + ap->a_cred)); } /* @@ -545,13 +706,15 @@ procfs_access(ap) * filesystem doesn't do any locking of its own. otherwise * read and inwardly digest ufs_lookup(). */ -procfs_lookup(ap) +int +procfs_lookup(v) + void *v; +{ struct vop_lookup_args /* { struct vnode * a_dvp; struct vnode ** a_vpp; struct componentname * a_cnp; - } */ *ap; -{ + } */ *ap = v; struct componentname *cnp = ap->a_cnp; struct vnode **vpp = ap->a_vpp; struct vnode *dvp = ap->a_dvp; @@ -650,7 +813,10 @@ procfs_validfile(p) * * this should just be done through read() */ -procfs_readdir(ap) +int +procfs_readdir(v) + void *v; +{ struct vop_readdir_args /* { struct vnode *a_vp; struct uio *a_uio; @@ -658,8 +824,7 @@ procfs_readdir(ap) int *a_eofflag; u_long *a_cookies; int a_ncookies; - } */ *ap; -{ + } */ *ap = v; struct uio *uio = ap->a_uio; struct dirent d; struct pfsnode *pfs; @@ -704,7 +869,7 @@ procfs_readdir(ap) bcopy(pt->pt_name, d.d_name, pt->pt_namlen + 1); d.d_type = pt->pt_type; - if (error = uiomove((caddr_t)&d, UIO_MX, uio)) + if ((error = uiomove((caddr_t)&d, UIO_MX, uio)) != 0) break; if (ncookies-- > 0) *cookies++ = i + 1; @@ -731,7 +896,9 @@ procfs_readdir(ap) if (pcnt > 3) pcnt = 3; +#ifdef PROCFS_ZOMBIE again: +#endif for (; p && uio->uio_resid >= UIO_MX; i++, pcnt++) { switch (i) { case 0: /* `.' */ @@ -765,7 +932,7 @@ procfs_readdir(ap) break; } - if (error = uiomove((caddr_t)&d, UIO_MX, uio)) + if ((error = uiomove((caddr_t)&d, UIO_MX, uio)) != 0) break; if (ncookies-- > 0) *cookies++ = i + 1; @@ -796,10 +963,11 @@ procfs_readdir(ap) /* * readlink reads the link of `curproc' */ -procfs_readlink(ap) - struct vop_readlink_args *ap; +int +procfs_readlink(v) + void *v; { - struct uio *uio = ap->a_uio; + struct vop_readlink_args *ap = v; char buf[16]; /* should be enough */ int len; @@ -832,53 +1000,3 @@ atopid(b, len) return (p); } - -/* - * procfs vnode operations. - */ -int (**procfs_vnodeop_p)(); -struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { - { &vop_default_desc, vn_default_error }, - { &vop_lookup_desc, procfs_lookup }, /* lookup */ - { &vop_create_desc, procfs_create }, /* create */ - { &vop_mknod_desc, procfs_mknod }, /* mknod */ - { &vop_open_desc, procfs_open }, /* open */ - { &vop_close_desc, procfs_close }, /* close */ - { &vop_access_desc, procfs_access }, /* access */ - { &vop_getattr_desc, procfs_getattr }, /* getattr */ - { &vop_setattr_desc, procfs_setattr }, /* setattr */ - { &vop_read_desc, procfs_read }, /* read */ - { &vop_write_desc, procfs_write }, /* write */ - { &vop_ioctl_desc, procfs_ioctl }, /* ioctl */ - { &vop_select_desc, procfs_select }, /* select */ - { &vop_mmap_desc, procfs_mmap }, /* mmap */ - { &vop_fsync_desc, procfs_fsync }, /* fsync */ - { &vop_seek_desc, procfs_seek }, /* seek */ - { &vop_remove_desc, procfs_remove }, /* remove */ - { &vop_link_desc, procfs_link }, /* link */ - { &vop_rename_desc, procfs_rename }, /* rename */ - { &vop_mkdir_desc, procfs_mkdir }, /* mkdir */ - { &vop_rmdir_desc, procfs_rmdir }, /* rmdir */ - { &vop_symlink_desc, procfs_symlink }, /* symlink */ - { &vop_readdir_desc, procfs_readdir }, /* readdir */ - { &vop_readlink_desc, procfs_readlink }, /* readlink */ - { &vop_abortop_desc, procfs_abortop }, /* abortop */ - { &vop_inactive_desc, procfs_inactive }, /* inactive */ - { &vop_reclaim_desc, procfs_reclaim }, /* reclaim */ - { &vop_lock_desc, procfs_lock }, /* lock */ - { &vop_unlock_desc, procfs_unlock }, /* unlock */ - { &vop_bmap_desc, procfs_bmap }, /* bmap */ - { &vop_strategy_desc, procfs_strategy }, /* strategy */ - { &vop_print_desc, procfs_print }, /* print */ - { &vop_islocked_desc, procfs_islocked }, /* islocked */ - { &vop_pathconf_desc, procfs_pathconf }, /* pathconf */ - { &vop_advlock_desc, procfs_advlock }, /* advlock */ - { &vop_blkatoff_desc, procfs_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, procfs_valloc }, /* valloc */ - { &vop_vfree_desc, procfs_vfree }, /* vfree */ - { &vop_truncate_desc, procfs_truncate }, /* truncate */ - { &vop_update_desc, procfs_update }, /* update */ - { (struct vnodeop_desc*)NULL, (int(*)())NULL } -}; -struct vnodeopv_desc procfs_vnodeop_opv_desc = - { &procfs_vnodeop_p, procfs_vnodeop_entries }; |