svn commit: r237792 - stable/9/lib/libprocstat
John Baldwin
jhb at FreeBSD.org
Fri Jun 29 15:30:15 UTC 2012
Author: jhb
Date: Fri Jun 29 15:30:14 2012
New Revision: 237792
URL: http://svn.freebsd.org/changeset/base/237792
Log:
MFC 236717:
Teach procstat_get_shm_info_kvm() how to fetch the pathname of a SHM file
descriptor from a core and set it in fts->fs_path.
Modified:
stable/9/lib/libprocstat/libprocstat.c
Directory Properties:
stable/9/lib/libprocstat/ (props changed)
Modified: stable/9/lib/libprocstat/libprocstat.c
==============================================================================
--- stable/9/lib/libprocstat/libprocstat.c Fri Jun 29 15:27:17 2012 (r237791)
+++ stable/9/lib/libprocstat/libprocstat.c Fri Jun 29 15:30:14 2012 (r237792)
@@ -881,6 +881,8 @@ procstat_get_shm_info_kvm(kvm_t *kd, str
{
struct shmfd shmfd;
void *shmfdp;
+ char *path;
+ int i;
assert(kd);
assert(shm);
@@ -896,6 +898,21 @@ procstat_get_shm_info_kvm(kvm_t *kd, str
}
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:
More information about the svn-src-stable-9
mailing list