|
|
| version 1.12, 2004/04/24 04:32:05 | version 1.13, 2004/05/02 03:05:11 |
|---|---|
| Line 123 static pid_t atopid (const char *, u_int | Line 123 static pid_t atopid (const char *, u_int |
| * in particular for i/o. all that is done | * in particular for i/o. all that is done |
| * is to support exclusive open on process | * is to support exclusive open on process |
| * memory images. | * memory images. |
| * | |
| * procfs_open(struct vnode *a_vp, int a_mode, struct ucred *a_cred, | |
| * struct thread *a_td) | |
| */ | */ |
| static int | static int |
| procfs_open(ap) | procfs_open(struct vop_open_args *ap) |
| struct vop_open_args /* { | |
| struct vnode *a_vp; | |
| int a_mode; | |
| struct ucred *a_cred; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| struct pfsnode *pfs = VTOPFS(ap->a_vp); | struct pfsnode *pfs = VTOPFS(ap->a_vp); |
| struct proc *p1, *p2; | struct proc *p1, *p2; |
| Line 174 procfs_open(ap) | Line 171 procfs_open(ap) |
| * | * |
| * nothing to do for procfs other than undo | * nothing to do for procfs other than undo |
| * any exclusive open flag (see _open above). | * any exclusive open flag (see _open above). |
| * | |
| * procfs_close(struct vnode *a_vp, int a_fflag, struct ucred *a_cred, | |
| * struct thread *a_td) | |
| */ | */ |
| static int | static int |
| procfs_close(ap) | procfs_close(struct vop_close_args *ap) |
| struct vop_close_args /* { | |
| struct vnode *a_vp; | |
| int a_fflag; | |
| struct ucred *a_cred; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| struct pfsnode *pfs = VTOPFS(ap->a_vp); | struct pfsnode *pfs = VTOPFS(ap->a_vp); |
| struct proc *p; | struct proc *p; |
| Line 228 procfs_close(ap) | Line 222 procfs_close(ap) |
| * (vp) is not locked on entry or exit. | * (vp) is not locked on entry or exit. |
| */ | */ |
| static int | static int |
| procfs_ioctl(ap) | procfs_ioctl(struct vop_ioctl_args *ap) |
| struct vop_ioctl_args *ap; | |
| { | { |
| struct pfsnode *pfs = VTOPFS(ap->a_vp); | struct pfsnode *pfs = VTOPFS(ap->a_vp); |
| struct proc *procp; | struct proc *procp; |
| Line 324 procfs_ioctl(ap) | Line 317 procfs_ioctl(ap) |
| * of this function. for sanity, this is the | * of this function. for sanity, this is the |
| * usual no-op bmap, although returning | * usual no-op bmap, although returning |
| * (EIO) would be a reasonable alternative. | * (EIO) would be a reasonable alternative. |
| * | |
| * procfs_bmap(struct vnode *a_vp, daddr_t a_bn, struct vnode **a_vpp, | |
| * daddr_t *a_bnp, int *a_runp) | |
| */ | */ |
| static int | static int |
| procfs_bmap(ap) | procfs_bmap(struct vop_bmap_args *ap) |
| struct vop_bmap_args /* { | |
| struct vnode *a_vp; | |
| daddr_t a_bn; | |
| struct vnode **a_vpp; | |
| daddr_t *a_bnp; | |
| int *a_runp; | |
| } */ *ap; | |
| { | { |
| if (ap->a_vpp != NULL) | if (ap->a_vpp != NULL) |
| *ap->a_vpp = ap->a_vp; | *ap->a_vpp = ap->a_vp; |
| if (ap->a_bnp != NULL) | if (ap->a_bnp != NULL) |
| Line 353 procfs_bmap(ap) | Line 341 procfs_bmap(ap) |
| * used. | * used. |
| * | * |
| * (vp) is locked on entry, but must be unlocked on exit. | * (vp) is locked on entry, but must be unlocked on exit. |
| * | |
| * procfs_inactive(struct vnode *a_vp, struct thread *a_td) | |
| */ | */ |
| static int | static int |
| procfs_inactive(ap) | procfs_inactive(struct vop_inactive_args *ap) |
| struct vop_inactive_args /* { | |
| struct vnode *a_vp; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| struct vnode *vp = ap->a_vp; | struct vnode *vp = ap->a_vp; |
| Line 374 procfs_inactive(ap) | Line 360 procfs_inactive(ap) |
| * free list. at this time the filesystem needs | * free list. at this time the filesystem needs |
| * to free any private data and remove the node | * to free any private data and remove the node |
| * from any private lists. | * from any private lists. |
| * | |
| * procfs_reclaim(struct vnode *a_vp) | |
| */ | */ |
| static int | static int |
| procfs_reclaim(ap) | procfs_reclaim(struct vop_reclaim_args *ap) |
| struct vop_reclaim_args /* { | |
| struct vnode *a_vp; | |
| } */ *ap; | |
| { | { |
| return (procfs_freevp(ap->a_vp)); | return (procfs_freevp(ap->a_vp)); |
| } | } |
| Line 389 procfs_reclaim(ap) | Line 373 procfs_reclaim(ap) |
| * _print is used for debugging. | * _print is used for debugging. |
| * just print a readable description | * just print a readable description |
| * of (vp). | * of (vp). |
| * | |
| * procfs_print(struct vnode *a_vp) | |
| */ | */ |
| static int | static int |
| procfs_print(ap) | procfs_print(struct vop_print_args *ap) |
| struct vop_print_args /* { | |
| struct vnode *a_vp; | |
| } */ *ap; | |
| { | { |
| struct pfsnode *pfs = VTOPFS(ap->a_vp); | struct pfsnode *pfs = VTOPFS(ap->a_vp); |
| Line 407 procfs_print(ap) | Line 390 procfs_print(ap) |
| * generic entry point for unsupported operations | * generic entry point for unsupported operations |
| */ | */ |
| static int | static int |
| procfs_badop() | procfs_badop(void) |
| { | { |
| return (EIO); | return (EIO); |
| } | } |
| Line 421 procfs_badop() | Line 403 procfs_badop() |
| * to be computed, and nothing cares anyway. | * to be computed, and nothing cares anyway. |
| * | * |
| * this is relatively minimal for procfs. | * this is relatively minimal for procfs. |
| * | |
| * procfs_getattr(struct vnode *a_vp, struct vattr *a_vap, | |
| * struct ucred *a_cred, struct thread *a_td) | |
| */ | */ |
| static int | static int |
| procfs_getattr(ap) | procfs_getattr(struct vop_getattr_args *ap) |
| struct vop_getattr_args /* { | |
| struct vnode *a_vp; | |
| struct vattr *a_vap; | |
| struct ucred *a_cred; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| struct pfsnode *pfs = VTOPFS(ap->a_vp); | struct pfsnode *pfs = VTOPFS(ap->a_vp); |
| struct vattr *vap = ap->a_vap; | struct vattr *vap = ap->a_vap; |
| Line 593 procfs_getattr(ap) | Line 572 procfs_getattr(ap) |
| return (error); | return (error); |
| } | } |
| /* | |
| * procfs_setattr(struct vnode *a_vp, struct vattr *a_vap, | |
| * struct ucred *a_cred, struct thread *a_td) | |
| */ | |
| static int | static int |
| procfs_setattr(ap) | procfs_setattr(struct vop_setattr_args *ap) |
| struct vop_setattr_args /* { | |
| struct vnode *a_vp; | |
| struct vattr *a_vap; | |
| struct ucred *a_cred; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| if (ap->a_vap->va_flags != VNOVAL) | if (ap->a_vap->va_flags != VNOVAL) |
| return (EOPNOTSUPP); | return (EOPNOTSUPP); |
| Line 630 procfs_setattr(ap) | Line 606 procfs_setattr(ap) |
| * objects. this doesn't cause any particular trouble | * objects. this doesn't cause any particular trouble |
| * but does mean that the i/o entry points need to check | * but does mean that the i/o entry points need to check |
| * that the operation really does make sense. | * that the operation really does make sense. |
| * | |
| * procfs_access(struct vnode *a_vp, int a_mode, struct ucred *a_cred, | |
| * struct thread *a_td) | |
| */ | */ |
| static int | static int |
| procfs_access(ap) | procfs_access(struct vop_access_args *ap) |
| struct vop_access_args /* { | |
| struct vnode *a_vp; | |
| int a_mode; | |
| struct ucred *a_cred; | |
| struct thread *a_td; | |
| } */ *ap; | |
| { | { |
| struct vattr *vap; | struct vattr *vap; |
| struct vattr vattr; | struct vattr vattr; |
| Line 689 found: | Line 662 found: |
| * unless you want to get a migraine, just make sure your | * unless you want to get a migraine, just make sure your |
| * filesystem doesn't do any locking of its own. otherwise | * filesystem doesn't do any locking of its own. otherwise |
| * read and inwardly digest ufs_lookup(). | * read and inwardly digest ufs_lookup(). |
| * | |
| * procfs_lookup(struct vnode *a_dvp, struct vnode **a_vpp, | |
| * struct componentname *a_cnp) | |
| */ | */ |
| static int | static int |
| procfs_lookup(ap) | procfs_lookup(struct vop_lookup_args *ap) |
| struct vop_lookup_args /* { | |
| struct vnode * a_dvp; | |
| struct vnode ** a_vpp; | |
| struct componentname * a_cnp; | |
| } */ *ap; | |
| { | { |
| struct componentname *cnp = ap->a_cnp; | struct componentname *cnp = ap->a_cnp; |
| struct vnode **vpp = ap->a_vpp; | struct vnode **vpp = ap->a_vpp; |
| Line 778 procfs_lookup(ap) | Line 749 procfs_lookup(ap) |
| * Does this process have a text file? | * Does this process have a text file? |
| */ | */ |
| int | int |
| procfs_validfile(p) | procfs_validfile(struct proc *p) |
| struct proc *p; | |
| { | { |
| return (procfs_findtextvp(p) != NULLVP); | return (procfs_findtextvp(p) != NULLVP); |
| } | } |
| Line 790 procfs_validfile(p) | Line 759 procfs_validfile(p) |
| * | * |
| * We generate just one directory entry at a time, as it would probably | * We generate just one directory entry at a time, as it would probably |
| * not pay off to buffer several entries locally to save uiomove calls. | * not pay off to buffer several entries locally to save uiomove calls. |
| * | |
| * procfs_readdir(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred, | |
| * int *a_eofflag, int *a_ncookies, u_long **a_cookies) | |
| */ | */ |
| static int | static int |
| procfs_readdir(ap) | procfs_readdir(struct vop_readdir_args *ap) |
| struct vop_readdir_args /* { | |
| struct vnode *a_vp; | |
| struct uio *a_uio; | |
| struct ucred *a_cred; | |
| int *a_eofflag; | |
| int *a_ncookies; | |
| u_long **a_cookies; | |
| } */ *ap; | |
| { | { |
| struct uio *uio = ap->a_uio; | struct uio *uio = ap->a_uio; |
| struct dirent d; | struct dirent d; |
| Line 960 procfs_readdir(ap) | Line 924 procfs_readdir(ap) |
| * readlink reads the link of `curproc' or `file' | * readlink reads the link of `curproc' or `file' |
| */ | */ |
| static int | static int |
| procfs_readlink(ap) | procfs_readlink(struct vop_readlink_args *ap) |
| struct vop_readlink_args *ap; | |
| { | { |
| char buf[16]; /* should be enough */ | char buf[16]; /* should be enough */ |
| struct proc *procp; | struct proc *procp; |
| Line 1006 procfs_readlink(ap) | Line 969 procfs_readlink(ap) |
| * convert decimal ascii to pid_t | * convert decimal ascii to pid_t |
| */ | */ |
| static pid_t | static pid_t |
| atopid(b, len) | atopid(const char *b, u_int len) |
| const char *b; | |
| u_int len; | |
| { | { |
| pid_t p = 0; | pid_t p = 0; |