diff options
author | Dave Eddy <dave@daveeddy.com> | 2015-02-23 14:43:52 -0500 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2015-02-25 18:23:10 -0800 |
commit | d907f8b938aec9d8b57fdb15c241b98641b8b052 (patch) | |
tree | 5c8a9ccc627af59d9b69f1691d79867f0bbe188e /usr/src/lib/libproc/common/Pfdinfo.c | |
parent | eb459a53dd5ee2db4c6c3eb63fe988a901174fc2 (diff) | |
download | illumos-joyent-d907f8b938aec9d8b57fdb15c241b98641b8b052.tar.gz |
5397 pfiles slow with many open sockets
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/lib/libproc/common/Pfdinfo.c')
-rw-r--r-- | usr/src/lib/libproc/common/Pfdinfo.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/lib/libproc/common/Pfdinfo.c b/usr/src/lib/libproc/common/Pfdinfo.c index 124439773b..27264091f8 100644 --- a/usr/src/lib/libproc/common/Pfdinfo.c +++ b/usr/src/lib/libproc/common/Pfdinfo.c @@ -134,10 +134,20 @@ load_fdinfo(struct ps_prochandle *P) info->pr_offset = pr_llseek(P, fd, 0, SEEK_CUR); /* attempt to determine the path to it */ - (void) snprintf(path, sizeof (path), - "%s/%d/path/%d", procfs_path, (int)P->pid, fd); - len = readlink(path, info->pr_path, - sizeof (info->pr_path) - 1); + switch (info->pr_mode & S_IFMT) { + case S_IFDOOR: + case S_IFSOCK: + /* not applicable */ + len = -1; + break; + default: + (void) snprintf(path, sizeof (path), + "%s/%d/path/%d", procfs_path, (int)P->pid, + fd); + len = readlink(path, info->pr_path, + sizeof (info->pr_path) - 1); + break; + } if (len < 0) { info->pr_path[0] = 0; |