summaryrefslogtreecommitdiffstats
path: root/lib/libprocstat
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libprocstat')
-rw-r--r--lib/libprocstat/Makefile7
-rw-r--r--lib/libprocstat/common_kvm.h3
-rw-r--r--lib/libprocstat/libprocstat.c29
-rw-r--r--lib/libprocstat/libprocstat.h2
4 files changed, 24 insertions, 17 deletions
diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
index 9804483..a29afc7 100644
--- a/lib/libprocstat/Makefile
+++ b/lib/libprocstat/Makefile
@@ -8,8 +8,6 @@ SRCS= cd9660.c \
common_kvm.c \
libprocstat.c \
msdosfs.c \
- ntfs.c \
- smbfs.c \
udf.c
VERSION_DEF= ${.CURDIR}/Versions.def
@@ -24,11 +22,6 @@ LDADD= -lkvm -lutil
MAN= libprocstat.3
-.if ${MK_NCP} != "no"
-CFLAGS+= -DLIBPROCSTAT_NWFS
-SRCS+= nwfs.c
-.endif
-
# XXX This is a hack.
.if ${MK_CDDL} != "no"
CFLAGS+= -DLIBPROCSTAT_ZFS
diff --git a/lib/libprocstat/common_kvm.h b/lib/libprocstat/common_kvm.h
index d0b5307..d5e08e1 100644
--- a/lib/libprocstat/common_kvm.h
+++ b/lib/libprocstat/common_kvm.h
@@ -41,9 +41,6 @@ int devfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int isofs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int msdosfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int nfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
-int ntfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
-int nwfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
-int smbfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int udf_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int ufs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
int zfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn);
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 167d91a..9d9c111 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -184,15 +184,18 @@ procstat_getprocs(struct procstat *procstat, int what, int arg,
struct kinfo_proc *p0, *p;
size_t len;
int name[4];
+ int cnt;
int error;
assert(procstat);
assert(count);
p = NULL;
if (procstat->type == PROCSTAT_KVM) {
- p0 = kvm_getprocs(procstat->kd, what, arg, count);
- if (p0 == NULL || count == 0)
+ *count = 0;
+ p0 = kvm_getprocs(procstat->kd, what, arg, &cnt);
+ if (p0 == NULL || cnt <= 0)
return (NULL);
+ *count = cnt;
len = *count * sizeof(*p);
p = malloc(len);
if (p == NULL) {
@@ -881,6 +884,8 @@ procstat_get_shm_info_kvm(kvm_t *kd, struct filestat *fst,
{
struct shmfd shmfd;
void *shmfdp;
+ char *path;
+ int i;
assert(kd);
assert(shm);
@@ -896,6 +901,21 @@ procstat_get_shm_info_kvm(kvm_t *kd, struct filestat *fst,
}
shm->mode = S_IFREG | shmfd.shm_mode;
shm->size = shmfd.shm_size;
+ if (fst->fs_path == NULL && shmfd.shm_path != NULL) {
+ path = malloc(MAXPATHLEN);
+ for (i = 0; i < MAXPATHLEN - 1; i++) {
+ if (!kvm_read_all(kd, (unsigned long)shmfd.shm_path + i,
+ path + i, 1))
+ break;
+ if (path[i] == '\0')
+ break;
+ }
+ path[i] = '\0';
+ if (i == 0)
+ free(path);
+ else
+ fst->fs_path = path;
+ }
return (0);
fail:
@@ -953,11 +973,6 @@ procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat *fst,
FSTYPE(isofs),
FSTYPE(msdosfs),
FSTYPE(nfs),
- FSTYPE(ntfs),
-#ifdef LIBPROCSTAT_NWFS
- FSTYPE(nwfs),
-#endif
- FSTYPE(smbfs),
FSTYPE(udf),
FSTYPE(ufs),
#ifdef LIBPROCSTAT_ZFS
diff --git a/lib/libprocstat/libprocstat.h b/lib/libprocstat/libprocstat.h
index c00a179..662ea37 100644
--- a/lib/libprocstat/libprocstat.h
+++ b/lib/libprocstat/libprocstat.h
@@ -144,6 +144,7 @@ struct sockstat {
STAILQ_HEAD(filestat_list, filestat);
+__BEGIN_DECLS
void procstat_close(struct procstat *procstat);
void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p);
void procstat_freefiles(struct procstat *procstat,
@@ -164,5 +165,6 @@ int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst,
struct vnstat *vn, char *errbuf);
struct procstat *procstat_open_sysctl(void);
struct procstat *procstat_open_kvm(const char *nlistf, const char *memf);
+__END_DECLS
#endif /* !_LIBPROCSTAT_H_ */
OpenPOWER on IntegriCloud