summaryrefslogtreecommitdiff
path: root/usr/src/lib/libproc/common
diff options
context:
space:
mode:
authorjhaslam <none@none>2007-10-16 02:38:11 -0700
committerjhaslam <none@none>2007-10-16 02:38:11 -0700
commitcd11e1921ad6f73580a20aa774b4a70ea2157f5f (patch)
tree427ee87e1d87d2d256d9d118d445496b4058f876 /usr/src/lib/libproc/common
parent43a183a496eff954b46c32e6e99a01ba2cae3453 (diff)
downloadillumos-joyent-cd11e1921ad6f73580a20aa774b4a70ea2157f5f.tar.gz
6277664 Pgrab() failures due to the fd rlimit are not well reported
Contributed by Chad Mynhier (cmynhier@gmail.com).
Diffstat (limited to 'usr/src/lib/libproc/common')
-rw-r--r--usr/src/lib/libproc/common/Pcontrol.c14
-rw-r--r--usr/src/lib/libproc/common/libproc.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/usr/src/lib/libproc/common/Pcontrol.c b/usr/src/lib/libproc/common/Pcontrol.c
index 9e3c26fc04..fd4e10fb74 100644
--- a/usr/src/lib/libproc/common/Pcontrol.c
+++ b/usr/src/lib/libproc/common/Pcontrol.c
@@ -22,6 +22,8 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2007 Chad Mynhier
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -584,6 +586,9 @@ again: /* Come back here if we lose it in the Window of Vulnerability */
case EPERM:
rc = G_PERM;
break;
+ case EMFILE:
+ rc = G_NOFD;
+ break;
case EBUSY:
if (!(flags & PGRAB_FORCE) || geteuid() != 0) {
rc = G_BUSY;
@@ -607,6 +612,9 @@ again: /* Come back here if we lose it in the Window of Vulnerability */
case ENOENT:
rc = G_NOPROC;
break;
+ case EMFILE:
+ rc = G_NOFD;
+ break;
default:
dprintf("Pgrab: failed to open %s: %s\n",
procname, strerror(errno));
@@ -625,6 +633,9 @@ again: /* Come back here if we lose it in the Window of Vulnerability */
case ENOENT:
rc = G_NOPROC;
break;
+ case EMFILE:
+ rc = G_NOFD;
+ break;
default:
dprintf("Pgrab: failed to open %s: %s\n",
procname, strerror(errno));
@@ -905,6 +916,9 @@ Pgrab_error(int error)
case G_BADLWPS:
str = "bad lwp specification";
break;
+ case G_NOFD:
+ str = "too many open files";
+ break;
default:
str = "unknown error";
break;
diff --git a/usr/src/lib/libproc/common/libproc.h b/usr/src/lib/libproc/common/libproc.h
index 07c6ee1622..e12d41f3ae 100644
--- a/usr/src/lib/libproc/common/libproc.h
+++ b/usr/src/lib/libproc/common/libproc.h
@@ -21,6 +21,8 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright 2007 Chad Mynhier
*/
/*
@@ -150,6 +152,7 @@ extern int _libproc_no_qsort; /* set non-zero to inhibit sorting */
#define G_NOTE 14 /* Required PT_NOTE Phdr not present in core */
#define G_ISAINVAL 15 /* Wrong ELF machine type */
#define G_BADLWPS 16 /* Bad '/lwps' specification */
+#define G_NOFD 17 /* No more file descriptors */
/* Flags accepted by Prelease */