From owner-svn-src-stable@FreeBSD.ORG Fri Jun 29 15:30:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 648C0106564A; Fri, 29 Jun 2012 15:30:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EBBF8FC14; Fri, 29 Jun 2012 15:30:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TFUFV4053814; Fri, 29 Jun 2012 15:30:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TFUFNh053812; Fri, 29 Jun 2012 15:30:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291530.q5TFUFNh053812@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 15:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237792 - stable/9/lib/libprocstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 15:30:15 -0000 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: