2018-06-04 03:11:21 -07:00
|
|
|
/*
|
2020-06-24 05:59:10 -07:00
|
|
|
* Copyright (c) 2018 Alastair Roy Poole <netstar@gmail.com>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2018-06-04 03:11:21 -07:00
|
|
|
*/
|
2020-07-11 05:09:38 -07:00
|
|
|
|
2018-06-04 03:11:21 -07:00
|
|
|
#define _DEFAULT_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <math.h>
|
2019-08-29 15:55:43 -07:00
|
|
|
#include <sys/stat.h>
|
2018-06-04 03:11:21 -07:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
2020-06-16 09:29:51 -07:00
|
|
|
#if !defined(__linux__)
|
2020-04-14 10:24:27 -07:00
|
|
|
# include <sys/sysctl.h>
|
|
|
|
#endif
|
2018-06-04 03:11:21 -07:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
|
|
|
#define __MacOS__
|
|
|
|
# include <mach/mach.h>
|
|
|
|
# include <mach/vm_statistics.h>
|
|
|
|
# include <mach/mach_types.h>
|
|
|
|
# include <mach/mach_init.h>
|
|
|
|
# include <mach/mach_host.h>
|
|
|
|
# include <net/if_mib.h>
|
|
|
|
#endif
|
|
|
|
|
2020-06-16 13:32:33 -07:00
|
|
|
#if defined(__OpenBSD__)
|
2019-05-25 07:34:33 -07:00
|
|
|
# include <sys/sched.h>
|
2018-06-04 03:11:21 -07:00
|
|
|
# include <sys/swap.h>
|
|
|
|
# include <sys/mount.h>
|
|
|
|
# include <sys/sensors.h>
|
|
|
|
# include <net/if_types.h>
|
|
|
|
# include <ifaddrs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
# include <net/if_mib.h>
|
|
|
|
# include <vm/vm_param.h>
|
2019-09-07 14:37:58 -07:00
|
|
|
# include <dev/acpica/acpiio.h>
|
2021-03-31 07:05:07 -07:00
|
|
|
# include <sys/resource.h>
|
2018-06-04 03:11:21 -07:00
|
|
|
#endif
|
|
|
|
|
2020-07-09 12:23:14 -07:00
|
|
|
#include "macros.h"
|
2020-07-10 03:50:49 -07:00
|
|
|
#include "machine.h"
|
2021-11-03 07:27:53 -07:00
|
|
|
#include "machine/machine.x"
|
|
|
|
#include "machine/cpu.x"
|
|
|
|
#include "machine/memory.x"
|
|
|
|
#include "machine/sensors.x"
|
|
|
|
#include "machine/network.x"
|
2018-06-04 03:11:21 -07:00
|
|
|
|