memstat_uma.c (148007) | memstat_uma.c (148038) |
---|---|
1/*- 2 * Copyright (c) 2005 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2005 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libmemstat/memstat_uma.c 148007 2005-07-14 20:01:04Z rwatson $ | 26 * $FreeBSD: head/lib/libmemstat/memstat_uma.c 148038 2005-07-15 10:13:50Z rwatson $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31 32#include <vm/uma.h> 33 34#include <err.h> --- 41 unchanged lines hidden (view full) --- 76 size = sizeof(maxcpus); 77 if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &size, NULL, 0) < 0) { 78 error = errno; 79 perror("kern.smp.maxcpus"); 80 errno = error; 81 return (-1); 82 } 83 if (size != sizeof(maxcpus)) { | 27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31 32#include <vm/uma.h> 33 34#include <err.h> --- 41 unchanged lines hidden (view full) --- 76 size = sizeof(maxcpus); 77 if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &size, NULL, 0) < 0) { 78 error = errno; 79 perror("kern.smp.maxcpus"); 80 errno = error; 81 return (-1); 82 } 83 if (size != sizeof(maxcpus)) { |
84 fprintf(stderr, "kern.smp.maxcpus: wronge size"); | 84 fprintf(stderr, "kern.smp.maxcpus: wrong size"); |
85 errno = EINVAL; 86 return (-1); 87 } 88 89 if (maxcpus > MEMSTAT_MAXCPU) { 90 fprintf(stderr, "kern.smp.maxcpus: too many CPUs\n"); 91 errno = EINVAL; 92 return (-1); 93 } 94 95 size = sizeof(count); 96 if (sysctlbyname("vm.zone_count", &count, &size, NULL, 0) < 0) { 97 error = errno; 98 perror("vm.zone_count"); 99 errno = error; 100 return (-1); 101 } 102 if (size != sizeof(count)) { | 85 errno = EINVAL; 86 return (-1); 87 } 88 89 if (maxcpus > MEMSTAT_MAXCPU) { 90 fprintf(stderr, "kern.smp.maxcpus: too many CPUs\n"); 91 errno = EINVAL; 92 return (-1); 93 } 94 95 size = sizeof(count); 96 if (sysctlbyname("vm.zone_count", &count, &size, NULL, 0) < 0) { 97 error = errno; 98 perror("vm.zone_count"); 99 errno = error; 100 return (-1); 101 } 102 if (size != sizeof(count)) { |
103 fprintf(stderr, "vm.zone_count: wronge size"); | 103 fprintf(stderr, "vm.zone_count: wrong size"); |
104 errno = EINVAL; 105 return (-1); 106 } 107 108 size = sizeof(*uthp) + count * (sizeof(*uthp) + sizeof(*upsp) * 109 maxcpus); 110 111 buffer = malloc(size); --- 120 unchanged lines hidden --- | 104 errno = EINVAL; 105 return (-1); 106 } 107 108 size = sizeof(*uthp) + count * (sizeof(*uthp) + sizeof(*upsp) * 109 maxcpus); 110 111 buffer = malloc(size); --- 120 unchanged lines hidden --- |