diff options
author | as198278 <none@none> | 2007-01-17 22:41:40 -0800 |
---|---|---|
committer | as198278 <none@none> | 2007-01-17 22:41:40 -0800 |
commit | 81eba2fddf0016dd9d1a1a01d7b3e4829fe7b074 (patch) | |
tree | fe747a943e4be7b669aa601d762902a60c334db9 /usr/src | |
parent | 2f15eac90d333799a61f99c8b0f11a8524a716b9 (diff) | |
download | illumos-joyent-81eba2fddf0016dd9d1a1a01d7b3e4829fe7b074.tar.gz |
6479563 cpustat fails on system with 256 cpus
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/cpc/common/cpustat.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/cmd/cpc/common/cpustat.c b/usr/src/cmd/cpc/common/cpustat.c index 6653830a67..0fe4549b1d 100644 --- a/usr/src/cmd/cpc/common/cpustat.c +++ b/usr/src/cmd/cpc/common/cpustat.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,6 +46,7 @@ #include <kstat.h> #include <synch.h> #include <libcpc.h> +#include <sys/resource.h> #include "cpucmds.h" @@ -121,6 +121,7 @@ main(int argc, char *argv[]) char *errstr; double period; char *endp; + struct rlimit rl; (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); @@ -130,6 +131,15 @@ main(int argc, char *argv[]) else opts->pgmname++; + /* Make sure we can open enough files */ + rl.rlim_max = rl.rlim_cur = RLIM_INFINITY; + if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + errstr = strerror(errno); + (void) fprintf(stderr, + gettext("%s: setrlimit failed - %s\n"), + opts->pgmname, errstr); + } + if ((cpc = cpc_open(CPC_VER_CURRENT)) == NULL) { errstr = strerror(errno); (void) fprintf(stderr, gettext("%s: cannot access performance " |