memstat.c (148357) | memstat.c (148359) |
---|---|
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.c 148357 2005-07-24 01:28:54Z rwatson $ | 26 * $FreeBSD: head/lib/libmemstat/memstat.c 148359 2005-07-24 01:41:47Z rwatson $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31 32#include <err.h> 33#include <errno.h> 34#include <stdio.h> 35#include <stdlib.h> 36#include <string.h> 37 38#include "memstat.h" 39#include "memstat_internal.h" 40 | 27 */ 28 29#include <sys/param.h> 30#include <sys/sysctl.h> 31 32#include <err.h> 33#include <errno.h> 34#include <stdio.h> 35#include <stdlib.h> 36#include <string.h> 37 38#include "memstat.h" 39#include "memstat_internal.h" 40 |
41const char * 42memstat_strerror(int error) 43{ 44 45 switch (error) { 46 case MEMSTAT_ERROR_NOMEMORY: 47 return ("Cannot allocate memory"); 48 case MEMSTAT_ERROR_VERSION: 49 return ("Version mismatch"); 50 case MEMSTAT_ERROR_PERMISSION: 51 return ("Permission denied"); 52 case MEMSTAT_ERROR_TOOMANYCPUS: 53 return ("Too many CPUs"); 54 case MEMSTAT_ERROR_DATAERROR: 55 return ("Data format error"); 56 case MEMSTAT_ERROR_UNDEFINED: 57 default: 58 return ("Unknown error"); 59 } 60} 61 |
|
41struct memory_type_list * 42memstat_mtl_alloc(void) 43{ 44 struct memory_type_list *mtlp; 45 46 mtlp = malloc(sizeof(*mtlp)); 47 if (mtlp == NULL) 48 return (NULL); --- 339 unchanged lines hidden --- | 62struct memory_type_list * 63memstat_mtl_alloc(void) 64{ 65 struct memory_type_list *mtlp; 66 67 mtlp = malloc(sizeof(*mtlp)); 68 if (mtlp == NULL) 69 return (NULL); --- 339 unchanged lines hidden --- |