diff options
author | sjg <sjg@FreeBSD.org> | 2013-10-13 02:35:19 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-10-13 02:35:19 +0000 |
commit | 7fcd33c1faf567506b5c0b4148c7a15a10788a5d (patch) | |
tree | 2c6f4d1ca5d1c643faea64e1f4c90105a1ab406a /lib/libprocstat | |
parent | 2a59274eda20cc626e28052fff7aa8b7bf6a3683 (diff) | |
parent | 5cca672bb0892f1c5da630c34a1f98e2de4d7064 (diff) | |
download | FreeBSD-src-7fcd33c1faf567506b5c0b4148c7a15a10788a5d.zip FreeBSD-src-7fcd33c1faf567506b5c0b4148c7a15a10788a5d.tar.gz |
Merge head@256284
Diffstat (limited to 'lib/libprocstat')
-rw-r--r-- | lib/libprocstat/libprocstat.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 9056151..e1ec7af 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <sys/conf.h> #include <sys/ksem.h> #include <sys/mman.h> +#include <sys/capability.h> #define _KERNEL #include <sys/mount.h> #include <sys/pipe.h> @@ -395,7 +396,10 @@ filestat_new_entry(void *typedep, int type, int fd, int fflags, int uflags, entry->fs_ref_count = refcount; entry->fs_offset = offset; entry->fs_path = path; - entry->fs_cap_rights = *cap_rightsp; + if (cap_rightsp != NULL) + entry->fs_cap_rights = *cap_rightsp; + else + cap_rights_init(&entry->fs_cap_rights); return (entry); } @@ -478,21 +482,21 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap /* root directory vnode, if one. */ if (filed.fd_rdir) { entry = filestat_new_entry(filed.fd_rdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL, 0); + PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* current working directory vnode. */ if (filed.fd_cdir) { entry = filestat_new_entry(filed.fd_cdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL, 0); + PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* jail root, if any. */ if (filed.fd_jdir) { entry = filestat_new_entry(filed.fd_jdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL, 0); + PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -500,14 +504,14 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap if (kp->ki_tracep) { entry = filestat_new_entry(kp->ki_tracep, PS_FST_TYPE_VNODE, -1, PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE, - PS_FST_UFLAG_TRACE, 0, 0, NULL, 0); + PS_FST_UFLAG_TRACE, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* text vnode, if one */ if (kp->ki_textvp) { entry = filestat_new_entry(kp->ki_textvp, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL, 0); + PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -515,7 +519,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap if ((vp = getctty(kd, kp)) != NULL) { entry = filestat_new_entry(vp, PS_FST_TYPE_VNODE, -1, PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE, - PS_FST_UFLAG_CTTY, 0, 0, NULL, 0); + PS_FST_UFLAG_CTTY, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -578,7 +582,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap } /* XXXRW: No capability rights support for kvm yet. */ entry = filestat_new_entry(data, type, i, - to_filestat_flags(file.f_flag), 0, 0, 0, NULL, 0); + to_filestat_flags(file.f_flag), 0, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -637,7 +641,7 @@ do_mmapped: */ entry = filestat_new_entry(object.handle, PS_FST_TYPE_VNODE, -1, fflags, - PS_FST_UFLAG_MMAP, 0, 0, NULL, 0); + PS_FST_UFLAG_MMAP, 0, 0, NULL, NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -878,7 +882,7 @@ procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp, path = NULL; entry = filestat_new_entry(kve, PS_FST_TYPE_VNODE, -1, fflags, PS_FST_UFLAG_MMAP, refcount, offset, path, - 0); + NULL); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } |